On Mar 17, 2:04 pm, Max <[email protected]> wrote:
> I find that when using the single table inheritance plugin, saves
> include a "WHERE `kind` IN ('MySubclass')" clause (assuming the class
> I'm saving is C and `kind` is my type column). Since saves also
> include the primary key in the WHERE clause, adding the `kind` check
> seems superfluous. Overall, the generated query might look something
> like
>
> UPDATE `a` SET `foo` = 6 WHERE ((`a`.`kind` IN ('MySubclass')) AND
> (`id` = 500)) LIMIT 1
The reason for is the Model's dataset has that filter by default, so
it's included in the update clause. Is this causing a noticeable
performance issue? If not, I'd just ignore it. If so, please provide
benchmarks so I can make an informed decision on what to do.
> Also, as a lesser optimization, it seems like the `kind` check should
> be = 'C', not IN('C'), when there's only one class being looked up.
>
> Thoughts? (this is using Sequel f07a68)
Any decent database should optimize the IN('C') to be the same
operation as = 'C'. The reason it uses IN instead of = is that it
supports multiple levels (e.g. Person->Employee->Manager, where
Employee.all should include Managers). Again, is this causing a
noticeable performance issue?
Jeremy
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en.