Re: Yet another "Why won't PostgreSQL use my index?" - Mailing list pgsql-general

From Tom Lane
Subject Re: Yet another "Why won't PostgreSQL use my index?"
Date
Msg-id 12800.1024592083@sss.pgh.pa.us
Whole thread Raw
In response to Yet another "Why won't PostgreSQL use my index?"  ("Gregory Wood" <gregw@com-stock.com>)
List pgsql-general
"Gregory Wood" <gregw@com-stock.com> writes:
> Trying to use a single column index on a somewhat large table (1.9M rows),
> and PostgreSQL really doesn't want to. It estimates the number of rows at
> 12749 (actual 354), which is only .6% of the table... well within reasonable
> index range I would think. And yes, I've run an analyze on the table.

Could we see the analyze results --- ie, the pg_stats row for the
idx_siteid column?

Increasing the statistics target for that column might help, but I'm
interested to see what it thinks the distribution is right now.  The
problem AFAICT is the factor-of-36 overestimation of the number of
matching rows; had that estimate been even within a factor of 20 of
correct, the correct plan would have been chosen.

            regards, tom lane

pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Yet another "Why won't PostgreSQL use my index?"
Next
From: Manfred Koizar
Date:
Subject: Re: Yet another "Why won't PostgreSQL use my index?"