Re: planner question..

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rajesh Kumar Mallah <mallah(at)trade-india(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: planner question..
Date: 2003-04-17 14:26:43
Message-ID: 10432.1050589603@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Rajesh Kumar Mallah <mallah(at)trade-india(dot)com> writes:
> For a distribution of data like below why does the planner
> choses to do an index scan by default for source = 'REGIS' when > 50%
> of the rows are having source='REGIS'.

Are there a huge number of dead rows in the table? ("vacuum verbose"
would give some info)

The given result seems suspect; an indexscan couldn't possibly read >50%
of the rows in less than a quarter of the time for a seqscan. Unless
(a) the table contains vast amounts of empty space that the seqscan has to
slog through, or (b) your second measurement is bogus due to caching
performed by the first measurement.

Also, might the table be in order by the "source" column? A
sufficiently high correlation might have persuaded the planner to try an
indexscan even if point (a) isn't true.

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Marco Roda 2003-04-17 14:30:06 OUTER JOIN
Previous Message Marco Roda 2003-04-17 14:21:36 OUTER JOIN