Re: Slow Count-Distinct Query

From: Varadharajan Mukundan <srinathsmn(at)gmail(dot)com>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Slow Count-Distinct Query
Date: 2014-04-07 02:34:20
Message-ID: CACKkDGFM1+L0ZNJh19isYwK45QhMfVi8x2F0sPOaHu+mHqLezQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Johann Spies 2014-04-07 10:25:52 The same query - much different runtimes
Previous Message PARIS Nicolas 2014-04-06 22:21:43 Re: PGSQL 9.3 - Materialized View - multithreading