Re: 7.1.3 not using index - Mailing list pgsql-hackers

From Tom Lane
Subject Re: 7.1.3 not using index
Date
Msg-id 14769.1007400883@sss.pgh.pa.us
Whole thread Raw
In response to 7.1.3 not using index  (Daniel Kalchev <daniel@digsys.bg>)
Responses Re: 7.1.3 not using index
List pgsql-hackers
Daniel Kalchev <daniel@digsys.bg> writes:
> (table has ~30k rows)
> EXPLAIN SELECT * FROM r where d = 8;
> The result is 
> NOTICE: QUERY PLAN:
> Seq Scan on r (cost=0.00...3041.13 rows=7191 width=4)

Seqscan is the right plan to retrieve 7k rows out of a 30k table.
So the question is whether that estimate is in the right ballpark
or not.  How many rows are there really with d=8?  If it's way off,
what do you get from

select attname,attdispersion,s.*
from pg_statistic s, pg_attribute a, pg_class c
where starelid = c.oid and attrelid = c.oid and staattnum = attnum
and relname = 'r';
        regards, tom lane


pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: Second call for platform testing
Next
From: brett_schwarz@yahoo.com (Brett Schwarz)
Date:
Subject: OSDL