Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 49AE8475458 for ; Sun, 26 Jan 2003 11:44:17 -0500 (EST) Received: from ece.rice.edu (ece.rice.edu [128.42.4.34]) by postgresql.org (Postfix) with ESMTP id D50D5474E5C for ; Sun, 26 Jan 2003 11:44:16 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by ece.rice.edu (Postfix) with SMTP id 65C7568A69 for ; Sun, 26 Jan 2003 10:44:21 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by ece.rice.edu (Postfix) with ESMTP id 5E0E168A66 for ; Sun, 26 Jan 2003 10:44:20 -0600 (CST) Received: from wallace.ece.rice.edu (wallace.ece.rice.edu [128.42.12.154]) by ece.rice.edu (Postfix) with ESMTP id 6F02A68A5F for ; Sun, 26 Jan 2003 10:44:19 -0600 (CST) Received: from reedstrm by wallace.ece.rice.edu with local (Exim 3.36 #1 (Debian)) id 18cptL-0005Lf-00 for ; Sun, 26 Jan 2003 10:44:19 -0600 Date: Sun, 26 Jan 2003 10:44:18 -0600 From: "Ross J. Reedstrom" To: Postgres Subject: Re: what is the cause that scan type is showing as 'seq scan' after indexing Message-ID: <20030126164418.GB20331@wallace.ece.rice.edu> Mail-Followup-To: "Ross J. Reedstrom" , Postgres References: <002701c2c53b$176df660$1201a8c0@a4005> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <002701c2c53b$176df660$1201a8c0@a4005> User-Agent: Mutt/1.4i X-Virus-Scanned: by AMaViS snapshot-20020300 X-DCC--Metrics: ece.rice.edu 1066; Body=1 Fuz1=1 Fuz2=1 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/274 X-Sequence-Number: 7116 On Sun, Jan 26, 2003 at 06:31:50PM +0530, shreedhar wrote: > Hi All, > > Before indexing query plan was showing cost as 40.00, after indexing query > plan again showing as 'seq scan' and cost as 3060.55. > The field which i indexed is primary key to this table. > May i know > 1) what is the cause that scan type is showing as 'seq scan' after indexing > also > 2) why it is showing cost as high value compare to previous. You trimmed out the other parts of the EXPLAIN, so I'm just guessing, but that cost seems suspiciously round: I'm guessing that you haven't run VACUUM ANALYZE at all. One thing indexing does is update the 'number of tuples' statistic. See the archives for why sequential scans still show up (short answer: index scans aren't free, so at some point, it's cheaper to scan the entire table than to scan both the index and the subset of the table returned) Ross