Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154]) by hub.org (8.10.1/8.10.1) with ESMTP id e94FMJG05569 for ; Wed, 4 Oct 2000 11:22:19 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.0/8.11.0) with ESMTP id e94FMBB03298; Wed, 4 Oct 2000 11:22:11 -0400 (EDT) To: "Emils Klotins" cc: pgsql-sql@hub.org Subject: Re: Q: performance on some selects (7.0.2)? In-reply-to: <39DB1CFB.10000.5BA3CB0@localhost> References: <39DB1CFB.10000.5BA3CB0@localhost> Comments: In-reply-to "Emils Klotins" message dated "Wed, 04 Oct 2000 12:05:15 +0200" Date: Wed, 04 Oct 2000 11:22:11 -0400 Message-ID: <3295.970672931@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200010/55 "Emils Klotins" writes: > Sort (cost=171.93..171.93 rows=1 width=56) > -> Nested Loop (cost=0.00..171.92 rows=1 width=56) > -> Nested Loop (cost=0.00..169.95 rows=1 width=36) > -> Seq Scan on articles_groups x (cost=0.00..12.10 > rows=1 width=4) > -> Seq Scan on articles a (cost=0.00..135.55 rows=636 > width=32) > -> Seq Scan on newscategories c (cost=0.00..1.43 rows=43 > width=20) Given the small estimated costs and row counts, I wonder whether you've ever vacuumed articles_groups and newscategories. The plan is not too unreasonable if the planner is right about how many rows will be matched in each of those tables --- but if you've never done a vacuum then the planner has no accurate stats to work with, so its guesses are likely way off. The plan is clearly handicapped by the lack of indexes on article.id and articles_groups.groupid, also. You seem to have indexes on all the wrong columns of articles :-( ... each of those indexes costs you on updates, but will it ever be useful in a query? regards, tom lane