Skip site navigation (1) Skip section navigation (2)

BUG #1122: limit 1 doing a sequential scan

From: "PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1122: limit 1 doing a sequential scan
Date: 2004-04-02 20:18:28
Message-ID: 20040402201828.6981DCF5031@www.postgresql.com (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      1122
Logged by:          P Buder

Email address:      pb2(at)aracnet(dot)com

PostgreSQL version: 7.3.5

Operating system:   Debian Linux

Description:        limit 1 doing a sequential scan

Details: 

I am actually running 7.3.6 but that isn't available on the drop down menu 
to report a bug so there is another bug :) 

When I do a select * from table limit 1 
Postgresql does a sequential scan on the whole table.  It should just pick 
one row and be done with it.  The table has been analyzed but that shouldn't 
matter. This particular table has 4.3 million rows. Here is the explain 
select. 


book=# explain select * from imdata limit 1;
                              QUERY PLAN
----------------------------------------------------------------------
 Limit  (cost=0.00..55.85 rows=1 width=152)
   ->  Seq Scan on imdata  (cost=0.00..269569.27 rows=4827 width=152)
(2 rows)




Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2004-04-02 20:36:36
Subject: Re: BUG #1122: limit 1 doing a sequential scan
Previous:From: Stephen FrostDate: 2004-04-02 20:16:38
Subject: No error-checking on binary timestamp

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group