Re: Why is explain horribly optimistic for sorts?

From: Ben <bench(at)silentmedia(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Why is explain horribly optimistic for sorts?
Date: 2001-03-03 18:09:44
Message-ID: Pine.LNX.4.10.10103031007180.19743-100000@gilgamesh.eos.SilentMedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Yes, it is horribly wrong.

select count(*) FROM jennyann where target like '/music/%'

gives me 93686 rows.

On Sat, 3 Mar 2001, Tom Lane wrote:

> Ben <bench(at)silentmedia(dot)com> writes:
> > Here's what explain tells me:
>
> > explain SELECT * FROM jennyann where target like '/music/%' order by "LogTime" limit 1000;
> > NOTICE: QUERY PLAN:
>
> > Sort (cost=119.88..119.88 rows=2085 width=136)
> > -> Index Scan using jennyann_target_key on jennyann (cost=0.00..4.94 rows=2085 width=136)
>
> How many records are actually getting sorted here --- ie, how many would
> you get back if you didn't have the LIMIT? It seems to be estimating
> 2085, but I suspect that must be wildly wrong ...
>
> regards, tom lane
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-03-03 18:18:43 Re: Why is explain horribly optimistic for sorts?
Previous Message will trillich 2001-03-03 18:09:22 Re: can a trigger on insert -> update other tables?