Re: [PERFORM] ORDER BY ... LIMIT and JOIN

2009-08-09 Thread Fizu
On Sat, Aug 8, 2009 at 2:09 PM, Michael Andreen wrote: > The planner is expecting one user with country_id = 1, but instead there are > 57309. Have you analyzed recently? Maybe increasing the statistics target will > help. > > /Michael Just after analyze user and ranking it still taking so long t

[PERFORM] ORDER BY ... LIMIT and JOIN

2009-08-07 Thread Fizu
Hello, I'm trying to optimize the follow query which returns the top users ordered by ranking. I'll show you my schema and "explain analyze" for each case. So, i'm asking two things: 1) Why "ranking" index is not used in the second query when sorting. 2) Am i missing some obvious optimization li