Re: [PERFORM] Optimizer: limit not taken into account

2006-05-17 Thread Bruno Wolff III
Please don't reply to previous messages to start new threads. This makes it harder to find stuff in the archives and may keep people from noticing your message. On Wed, May 17, 2006 at 08:54:52 -0700, Craig A. James [EMAIL PROTECTED] wrote: Here's a corner case that might interest someone. It

Re: [PERFORM] Optimizer: limit not taken into account

2006-05-17 Thread Simon Riggs
On Wed, 2006-05-17 at 08:54 -0700, Craig A. James wrote: Here's a corner case that might interest someone. It tripped up one of our programmers. We have a table with 10 million rows. The ID column is indexed, the table has been vacuum/analyzed. Compare these two queries: select *

Re: [PERFORM] Optimizer: limit not taken into account

2006-05-17 Thread Tom Lane
Bruno Wolff III [EMAIL PROTECTED] writes: I suspect it wasn't intended to be a full table scan. But rather a sequential scan until it found a matching row. If the data in the table is ordered by by id, this strategy may not work out well. Where as if the data is randomly ordered, it would be

Re: [PERFORM] Optimizer: limit not taken into account

2006-05-17 Thread Craig A. James
Tom Lane wrote: There is not anything in there that considers whether the table's physical order is so nonrandom that the search will take much longer than it would given uniform distribution. It might be possible to do something with the correlation statistic in simple cases ... In this

Re: [PERFORM] Optimizer: limit not taken into account

2006-05-17 Thread Jim C. Nasby
On Wed, May 17, 2006 at 08:54:52AM -0700, Craig A. James wrote: Here's a corner case that might interest someone. It tripped up one of our programmers. We have a table with 10 million rows. The ID column is indexed, the table has been vacuum/analyzed. Compare these two queries: