On Sep 16, 3:20 pm, Roland Swingler <[email protected]> wrote:
> > What database are you using?
>
> MySQL - the bane of your life ;)
>
> > It currently does an unfiltered,
> > unordered, limited to 1 select, which should be fastest on most
> > databases For certain
> > databases that don't have a syntax for LIMIT and need to be emulated
> > with subselects, it's possible performance is bad if they don't have a
> > good query optimizer.
>
> This is probably the case for most databases and most queries. The
> sort of queries I'm running are aggregate and join heavy, so:
>
> DB[:table].select(:foo, :bar, :baz, 
> :sum[:quux]).join(...).join(...).join(...).filter(...).group(:foo, :bar, :baz)
>
> Datawarehousing/reporting style queries. This may be a MySQL-specific
> problem, but the grouping and lack of a WHERE clause forces the query
> to do full table scans building the whole resultset and then ordering,
> even if you limit the result to 1 row. Filtering makes a huge
> difference to this sort of query in MySQL (as you can see from the
> difference between 2ms and 8s). I don't know if this sort of query
> would have similar problems on other databases.
>
> > I think Sequel's current default behavior is best.  We should probably
> > modify the adapter you are using, though.
>
> Fair enough. I hacked up a rough implementation this afternoon, which
> solved my problems, but I haven't got it to the stage where I'm
> confident it handles every edge case for general consumption. I can
> polish this up and submit a patch for the MySQL adapter.

Wow, that (MySQL) sucks.  Is there a reason you are calling columns
before the query?  If you can call it after running the query, the
columns will already be filled in, and won't require an additional
database query.

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.

Reply via email to