| From: | "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com> | 
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org | 
| Subject: | Re: slow query | 
| Date: | 2007-04-05 05:11:27 | 
| Message-ID: | 20070405051127.GA24814@a-kretschmer.de | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-sql | 
am  Wed, dem 04.04.2007, um 23:17:54 -0400 mailte Sumeet folgendes:
> sm=> explain analyze select * from ma limit 10;
>                                                              QUERY
> PLAN                                                             
> -------------------------------------------------------------------------------------------------------------------------------------
>  Limit  (cost=0.00..0.45 rows=10 width=76) (actual time=21985.292..22204.340
> rows=10 loops=1)
>    ->  Seq Scan on ma  (cost=0.00..2181956.92 rows=48235392 width=76) (actual
> time=21985.285..22204.308 rows=10 loops=1)
>  Total runtime: 22204.476 ms
> (3 rows)
which version?
I have 8.1 and on a table with 1.9 million records i got:
scholl=# explain analyse select * from bde_meldungen limit 10;
                                                         QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------
 Limit  (cost=0.00..0.34 rows=10 width=157) (actual time=19.570..19.660 rows=10 loops=1)
   ->  Seq Scan on bde_meldungen  (cost=0.00..65748.33 rows=1957933 width=157) (actual time=19.565..19.587 rows=10 loops=1)
 Total runtime: 19.845 ms
(3 rows)
If I remember correctly, since 8.0 or 8.1 we have a massive improvement with
LIMIT.
Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2007-04-05 05:23:50 | Re: Very slow DELETE on 4000 rows of 55000 row table | 
| Previous Message | Richard Broersma Jr | 2007-04-05 04:46:10 | Re: Very slow DELETE on 4000 rows of 55000 row table |