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 8E968D1D903 for ; Tue, 16 Dec 2003 21:29:06 +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 13888-05 for ; Tue, 16 Dec 2003 17:28:36 -0400 (AST) Received: from fuji.krosing.net (217-159-136-226-dsl.kt.estpak.ee [217.159.136.226]) by svr1.postgresql.org (Postfix) with ESMTP id 05EB5D1D387 for ; Tue, 16 Dec 2003 17:24:53 -0400 (AST) Received: from fuji.krosing.net (localhost.localdomain [127.0.0.1]) by fuji.krosing.net (8.12.8/8.12.8) with ESMTP id hBGLOkLx005536; Tue, 16 Dec 2003 23:24:47 +0200 Received: (from hannu@localhost) by fuji.krosing.net (8.12.8/8.12.8/Submit) id hBGLOjMY005534; Tue, 16 Dec 2003 23:24:45 +0200 X-Authentication-Warning: fuji.krosing.net: hannu set sender to hannu@tm.ee using -f Subject: Re: Excessive rows/tuples seriously degrading query From: Hannu Krosing To: "Chadwick, Russell" Cc: pgsql-performance@postgresql.org In-Reply-To: References: Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1071609885.5397.8.camel@fuji.krosing.net> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Tue, 16 Dec 2003 23:24:45 +0200 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/239 X-Sequence-Number: 5099 Chadwick, Russell kirjutas L, 13.12.2003 kell 00:40: > > Hello everyone. > Can anyone explain why this table which has never had more than a > couple rows 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 updated a lot but I couldn't find any explanation for > this behavior. It can be that there is an idle transaction somewhere that has locked a lot of rows (i.e. all your updates have been running inside the same transaction for hour or days) try: $ ps ax| grep post on my linux box this gives 1683 ? S 0:00 /usr/bin/postmaster -p 5432 1704 ? S 0:00 postgres: stats buffer process 1705 ? S 0:00 postgres: stats collector process 5520 ? S 0:00 postgres: hu hannu [local] idle in transaction 5524 pts/2 S 0:00 grep post where backend 5520 seems to be the culprit. > Anything I could try besides droping db and recreating? make sure that no other backend is connected to db and do your > vacuum full; analyze; or if there seems to be something unidentifieable making your table unusable, then just recreate that table: begin; create table stock_log_positions_tmp as select * from stock_log_positions; drop table stock_log_positions; alter table stock_log_positions_tmp rename to stock_log_positions; -- if you have any constraints, indexes or foreign keys -- then recreate them here as well commit; > Thanks - Russ > --------------- hannu