Re: Slow Count-Distinct Query - Mailing list pgsql-performance

From Varadharajan Mukundan
Subject Re: Slow Count-Distinct Query
Date
Msg-id CACKkDGFM1+L0ZNJh19isYwK45QhMfVi8x2F0sPOaHu+mHqLezQ@mail.gmail.com
Whole thread
In response to Slow Count-Distinct Query  (Jeff Janes <jeff.janes@gmail.com>)
List pgsql-performance
Hi Jeff,

Instead what I get is the index only scan (to provide order) feeding into a Group.

That's interesting. We tested out in two versions of Postgres (9.2 and 9.3) in different Mac machines and ended up with index-only scan only after the partial index. I remember doing a vacuum full analyse after each and every step.
 
I usually get this plan without the cluster, to.  I think it depends on the luck of the sampling in the autoanalyze.


That's interesting as well. I think something like increasing the sample size would make it much better? Because, we had to perform so many steps to get the index-only scan working whereas its really obvious for anyone to guess that it should be the right approach. Also in a far corner of my mind, i'm also thinking whether any OS specific parameter would be considered (and is different in your system compared to my system) for coming up plans and choosing one of them.

--
Thanks,
M. Varadharajan

------------------------------------------------

"Experience is what you get when you didn't get what you wanted"
               -By Prof. Randy Pausch in "The Last Lecture"

My Journal :- www.thinkasgeek.wordpress.com

pgsql-performance by date:

Previous
From: PARIS Nicolas
Date:
Subject: Re: PGSQL 9.3 - Materialized View - multithreading
Next
From: Johann Spies
Date:
Subject: The same query - much different runtimes