Re: partial indexed not being used. - Mailing list pgsql-novice

From Ron Arts
Subject Re: partial indexed not being used.
Date
Msg-id 45D0967D.5090103@neonova.nl
Whole thread Raw
In response to Re: partial indexed not being used.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
Tom Lane schreef:
> Ron Arts <ron.arts@neonova.nl> writes:
>> # select count(*) from cdr where billed = false;
>>   count
>> -------
>>       3
>> (1 row)
>
>>> =# explain select cdr.* from cdr where billed = false order by calldate;
>>>
>>>                             QUERY PLAN
>>> -------------------------------------------------------------------
>>>  Sort  (cost=37448.75..37526.94 rows=31273 width=465)
>>>    Sort Key: calldate
>>>    ->  Seq Scan on cdr  (cost=0.00..20323.81 rows=31273 width=465)
>                                                 ^^^^^^^^^^
>>>          Filter: (billed = false)
>
> You haven't ANALYZEd this table (lately, or perhaps ever).  The planner
> is thus working with a default selectivity estimate (which I think is
> 50% for a bool column --- that seems to match your numbers anyway), and
> that leads it to the conclusion that a seqscan is the right thing.
> Which it would indeed be, if half the table has to be retrieved.
>
>             regards, tom lane
>

Oh man,

I totally forgot about analyze because I have it running daily from a script.
And of course the script was broken, and I didn't notice.

Thanks!

Ron



--
NeoNova BV, The Netherlands
Professional internet and VoIP solutions

http://www.neonova.nl   Kruislaan 419              1098 VA Amsterdam
info: 020-5628292       servicedesk: 020-5628292   fax: 020-5628291
KvK Amsterdam 34151241

The following disclaimer applies to this email:
http://www.neonova.nl/maildisclaimer

Attachment

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: partial indexed not being used.
Next
From: Johannes Bruegmann
Date:
Subject: Re: relation 12345 is still open