Re: Inconsistant use of index.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ron Mayer <ron(at)intervideo(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Inconsistant use of index.
Date: 2002-04-03 20:22:50
Message-ID: 12245.1017865370@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Ron Mayer <ron(at)intervideo(dot)com> writes:
> I did quite a bit more playing with this, and no matter what the
> correlation was (1, -0.001), it never seemed to have any effect
> at all on the execution plan.

> Should it? With a high correlation the index scan is a much better choice.

I'm confused. Your examples show the planner correctly estimating the
indexscan as much cheaper than the seqscan.

> logs2=# explain analyze select count(*) from fact_by_dat where dat='2002-03-01';
> NOTICE: QUERY PLAN:
> Aggregate (cost=380347.31..380347.31 rows=1 width=0) (actual time=77785.14..77785.14 rows=1 loops=1)
> -> Seq Scan on fact (cost=0.00..379816.25 rows=212423 width=0) (actual time=20486.16..77420.05 rows=180295 loops=1)
> Total runtime: 77785.28 msec

Cut-and-paste mistake here somewhere, perhaps? The plan refers to fact
not fact_by_dat.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message ystein Thorsen 2002-04-03 20:40:30 a problem with case in psql
Previous Message Ron Mayer 2002-04-03 19:14:27 Re: Inconsistant use of index.