On Jul 23, 2015, at 7:14 AM, Mohit Sindhwani <[email protected]> wrote:
> 
> * SELECT count(*) only with a limit of 900k records based on ID DESC, 
> followed by the recorded_on part = 700ms
> * SELECT count(*) on the whole table using only recorded_on in the WHERE = 
> 350ms

That's kind of what I expect. That adding the count(distinct...) makes them 
slower is not a surprise, but I was surprised that adding the 
count(distinct...) inverts the relative performance of those two.

So, anyway, it sounds like you might have gotten it fast enough. If not, bounce 
the discussion over to pg's general mail list, and we can talk about how to 
maintain a summary table without going through the hassle of full-on sharding 
;-)

-- 
Scott Ribe
[email protected]
http://www.elevated-dev.com/
https://www.linkedin.com/in/scottribe/
(303) 722-0567 voice





-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/A14D480F-1A7B-43EA-848F-633060CAE8DB%40elevated-dev.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to