Re: Why is explain horribly optimistic for sorts? - Mailing list pgsql-general

From Tom Lane
Subject Re: Why is explain horribly optimistic for sorts?
Date
Msg-id 6964.983642652@sss.pgh.pa.us
Whole thread Raw
In response to Why is explain horribly optimistic for sorts?  (Ben <bench@silentmedia.com>)
Responses Re: Why is explain horribly optimistic for sorts?
List pgsql-general
Ben <bench@silentmedia.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

pgsql-general by date:

Previous
From: "Mitch Vincent"
Date:
Subject: Re: Why is explain horribly optimistic for sorts?
Next
From: Ben
Date:
Subject: Re: Why is explain horribly optimistic for sorts?