X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 2D6F2D1DFE7 for ; Fri, 12 Dec 2003 22:41:14 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 06322-02 for ; Fri, 12 Dec 2003 18:40:44 -0400 (AST) Received: from q.idc-mcs.com (unknown [64.156.199.9]) by svr1.postgresql.org (Postfix) with ESMTP id ADFBED1C919 for ; Fri, 12 Dec 2003 18:40:41 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C3C100.F1020EA8" Subject: Excessive rows/tuples seriously degrading query performance Date: Fri, 12 Dec 2003 14:40:28 -0800 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Excessive rows/tuples seriously degrading query performance Thread-Index: AcPBAPD/EOCvMLcRQ9isBa7sLviPMg== From: "Chadwick, Russell" To: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/235 X-Sequence-Number: 5094 This is a multi-part message in MIME format. ------_=_NextPart_001_01C3C100.F1020EA8 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable =20 Hello everyone. Can anyone explain why this table which has never had more than a couple ro= ws in it shows > 500k in the query planner even after running vacuum full. = Its terribly slow to return 2 rows of data. The 2 rows in it are being up= dated a lot but I couldn't find any explanation for this behavior. Anythin= g I could try besides droping db and recreating?=20=20 Thanks - Russ =20 toolshed=3D# explain analyze select * from stock_log_positions ; QUERY PLAN=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20 ---------------------------------------------------------------------------= ---------------------------------------------- Seq Scan on stock_log_positions (cost=3D0.00..10907.77 rows=3D613577 widt= h=3D22) (actual time=3D701.39..701.41 rows=3D2 loops=3D1) Total runtime: 701.54 msec (2 rows) =20 toolshed=3D# vacuum full analyze verbose stock_log_positions; INFO: --Relation public.stock_log_positions-- INFO: Pages 4773: Changed 1, reaped 767, Empty 0, New 0; Tup 613737: Vac 5= 7620, Keep/VTL 613735/613713, UnUsed 20652, MinLen 52, MaxLen 52; Re-using:= Free/Avail. Space 4322596/4322596; EndEmpty/Avail. Pages 0/4773. CPU 9.11s/13.68u sec elapsed 22.94 sec. INFO: Index idx_stock_log_positions_when_log_filename: Pages 9465; Tuples = 613737: Deleted 57620. CPU 1.55s/1.27u sec elapsed 6.69 sec. INFO: Rel stock_log_positions: Pages: 4773 --> 4620; Tuple(s) moved: 59022. CPU 1.00s/4.45u sec elapsed 8.83 sec. INFO: Index idx_stock_log_positions_when_log_filename: Pages 9778; Tuples = 613737: Deleted 2897. CPU 1.32s/0.44u sec elapsed 6.23 sec. INFO: Analyzing public.stock_log_positions VACUUM =20 toolshed=3D# explain analyze select * from stock_log_positions ; QUERY PLAN=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20 ---------------------------------------------------------------------------= ---------------------------------------------- Seq Scan on stock_log_positions (cost=3D0.00..10757.37 rows=3D613737 widt= h=3D22) (actual time=3D789.21..789.24 rows=3D2 loops=3D1) Total runtime: 789.40 msec (2 rows) =20 toolshed=3D# select * from stock_log_positions ; when_log | filename | position=20 ------------+--------------+---------- 2003-12-11 | ActiveTrader | 0 2003-12-11 | Headlines | 0 (2 rows) ------_=_NextPart_001_01C3C100.F1020EA8 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
 
Hello everyone.
Can anyone explain why this table which ha= s never=20 had more than a couple rows in it shows > 500k in the query planner even= =20 after running vacuum full.  Its terribly slow to return 2 rows of=20 data.  The 2 rows in it are being updated a lot but I couldn't find an= y=20 explanation for this behavior.  Anything I could try besides droping d= b and=20 recreating? 
Thanks - Russ
 
toolshed=3D# explain analyze select * from stock_log_positions=20 ;
           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;    =20 QUERY=20 PLAN            = ;            &n= bsp;            = ;            &n= bsp;     =20
-----------------------------------------------------------------------= --------------------------------------------------
 Seq=20 Scan on stock_log_positions  (cost=3D0.00..10907.77 rows=3D613577 widt= h=3D22)=20 (actual time=3D701.39..701.41 rows=3D2 loops=3D1)
 Total runtime: 7= 01.54=20 msec
(2 rows)
 
toolshed=3D# vacuum full analyze verbose stock_log_positions;
INFO:=  =20 --Relation public.stock_log_positions--
INFO:  Pages 4773: Changed = 1,=20 reaped 767, Empty 0, New 0; Tup 613737: Vac 57620, Keep/VTL 613735/613713,= =20 UnUsed 20652, MinLen 52, MaxLen 52; Re-using: Free/Avail. Space 4322596/432= 2596;=20 EndEmpty/Avail. Pages 0/4773.
       = CPU=20 9.11s/13.68u sec elapsed 22.94 sec.
INFO:  Index=20 idx_stock_log_positions_when_log_filename: Pages 9465; Tuples 613737: Delet= ed=20 57620.
        CPU 1.55s/1.27u sec el= apsed=20 6.69 sec.
INFO:  Rel stock_log_positions: Pages: 4773 --> 4620;= =20 Tuple(s) moved: 59022.
        CPU=20 1.00s/4.45u sec elapsed 8.83 sec.
INFO:  Index=20 idx_stock_log_positions_when_log_filename: Pages 9778; Tuples 613737: Delet= ed=20 2897.
        CPU 1.32s/0.44u sec ela= psed=20 6.23 sec.
INFO:  Analyzing public.stock_log_positions
VACUUM
 
toolshed=3D# explain analyze select * from stock_log_positions=20 ;
           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;    =20 QUERY=20 PLAN            = ;            &n= bsp;            = ;            &n= bsp;     =20
-----------------------------------------------------------------------= --------------------------------------------------
 Seq=20 Scan on stock_log_positions  (cost=3D0.00..10757.37 rows=3D613737 widt= h=3D22)=20 (actual time=3D789.21..789.24 rows=3D2 loops=3D1)
 Total runtime: 7= 89.40=20 msec
(2 rows)
 
toolshed=3D# select * from stock_log_positions ;
  when_log&nb= sp;=20 |   filename   | position=20
------------+--------------+----------
 2003-12-11 | ActiveTrad= er=20 |        0
 2003-12-11 |=20 Headlines    |        0(2=20 rows)
------_=_NextPart_001_01C3C100.F1020EA8--