Received: from mailsys01.intnet.net (mailhost.wwc.com [198.252.32.15]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f6UGhCf23361 for ; Mon, 30 Jul 2001 12:43:12 -0400 (EDT) (envelope-from joseph.conway@home.com) Received: from [206.19.64.3] (HELO jecw2k1) by mailsys01.intnet.net (CommuniGate Pro SMTP 3.4.8) with SMTP id 12268308; Mon, 30 Jul 2001 12:42:36 -0400 Message-ID: <01d501c11916$b81603f0$48d210ac@jecw2k1> From: "Joe Conway" To: "Chris Ruprecht" , "pgsql" References: <006401c11913$9a563ae0$5dd26383@corp.compucom.com> Subject: Re: Big table - using wrong index - why? Date: Mon, 30 Jul 2001 09:43:09 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Archive-Number: 200107/382 X-Sequence-Number: 4196 > phones=# \d i_pl_pseq > Index "i_pl_pseq" > Attribute | Type > -----------+---------------------- > entity | character varying(3) > pseq | bigint > btree > > phones=# explain select * from phonelog where entity = '001' and pseq >= > 9120 and pseq <= 9123; > NOTICE: QUERY PLAN: > > Index Scan using i_pl_loadtimestamp on phonelog (cost=0.00..209247.39 > rows=607 width=137) > > EXPLAIN > > phones=# \d i_pl_loadtimestamp > Index "i_pl_loadtimestamp" > Attribute | Type > -----------+---------------------- > entity | character varying(3) > loaddate | date > loadtime | time > btree Just a guess, but what happens if you build i_pl_pseq(pseq, entity), i.e. reverse the key fields? Also, has the table been vacuum analyzed? -- Joe