Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id C31BE2E38AE for ; Mon, 4 Feb 2008 17:43:23 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 44634-05 for ; Mon, 4 Feb 2008 17:43:17 -0400 (AST) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 3BE4A2E38A9 for ; Mon, 4 Feb 2008 17:43:21 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m14LhKMs008938; Mon, 4 Feb 2008 16:43:20 -0500 (EST) To: "Rainer Spittel" cc: pgsql-admin@postgresql.org Subject: Re: performance on selecting a row in large tables In-reply-to: <12B8F225666F99489CEFA8B3F261540CFAAE11@geneva.local.terralink> References: <12B8F225666F99489CEFA8B3F261540CFAAE11@geneva.local.terralink> Comments: In-reply-to "Rainer Spittel" message dated "Tue, 05 Feb 2008 10:24:11 +1300" Date: Mon, 04 Feb 2008 16:43:20 -0500 Message-ID: <8937.1202161400@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.478 tagged_above=0 required=5 tests=AWL=-2.522, BAYES_95=3 X-Spam-Level: X-Archive-Number: 200802/19 X-Sequence-Number: 28093 "Rainer Spittel" writes: > One of those slow queries are running on col02 which has a btree > index. But I use the 'in' expression to get a set of matching rows: > select * from table where col02 in ('...',[...],'...') > This query gets sometimes really slow, I guess it depends on the size > of the set used by 'in'. Don't guess. Use EXPLAIN ANALYZE and find out what is happening. regards, tom lane