[Ruby] Dumb ActiveRecord question

Chris chris at ochsnet.com
Sat Jan 6 13:33:24 PST 2007



> We're using postgres. We had our DBA look at the SQL AR generated and he
> found that changing the order of the JOINs made the query perform much
> better. Curiously I don't see the difference on my dev Postgres install.
> The  production system has a heck of a lot more data than my dev box. I'm 
> no
> Postgres expert, but I suspect that data size is influencing the query
> optimizer. Clearly this warrants some more investigation.

With postgresql you definitely need to fine tune things a bit to get the 
best performance.  I'm assuming the database is being analyzed and vacuumed 
on a regular basis?  You might try posting an 'explain analyze' of the query 
to the postgresql mailing list along with the schema.  The postgresql folks 
are above average in my book and I there are quite a few query optimization 
questions that pop up on the list.

Chris 



More information about the Ruby mailing list