Re: Using the wrong index (very suboptimal), why?

From: "Shane Wright" <shane(dot)wright(at)edigitalresearch(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Using the wrong index (very suboptimal), why?
Date: 2008-12-23 14:28:58
Message-ID: 952015000A644E44B2FB8759E151093B01328287@exchange11.ad.edigitalresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom,

>> Index Scan using index_answers_nidiid1 on answers
>> (cost=0.00..114.14 rows=1 width=60) (actual time=0.206..2398.645
>> rows=21891 loops=1)
>> Index Cond: ((nid = 253869913) AND (iid1 = 535292129))
>> Total runtime: 2424.769 ms
>Well, here's the problem all right: 1 row estimated vs 21891 actual.
>Is there something odd about the joint distribution of these two
>columns?

I should also clarify, there will almost always be many many rows that
match any nid/iid1 pair (for any nid or iid1 value that exists in this
table anyway). The chance of there actually being only one result is
very small. Most of the time this will be hundreds/thousands - but will
also be tens of thousands on a regular basis. A hundred thousand or
more periodically.

Many thanks

Shane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Herouth Maoz 2008-12-23 14:43:56 Re: Copy/delete issue
Previous Message Shane Wright 2008-12-23 14:17:40 Re: Using the wrong index (very suboptimal), why?