Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 3CC45476769 for ; Wed, 27 Feb 2002 17:14:37 -0500 (EST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 1CEBED5FA; Wed, 27 Feb 2002 14:14:34 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 0C9155BFB; Wed, 27 Feb 2002 14:14:34 -0800 (PST) Date: Wed, 27 Feb 2002 14:14:33 -0800 (PST) From: Stephan Szabo To: "Zhang, Anna" Cc: "'pgsql-admin@postgresql.org'" Subject: Re: optimizer In-Reply-To: <5511D658682A7740BA295CCF1E1233A635A85F@vsvapostal2.bkup3> Message-ID: <20020227140841.Y7484-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200202/377 X-Sequence-Number: 3530 On Wed, 27 Feb 2002, Zhang, Anna wrote: > Hi, > I have a table named Domain that has 14M rows, here is the defination: > > xdap_regr=# \d domain > Table "domain" > Attribute | Type | Modifier > -----------------+-------+---------- > domainhandle | text | not null > domainname | text | not null > parentdomain | text | not null > holdername | text | > street | text | > city | text | > state | text | > postalcode | text | > country | text | > Indices: idx_domain_domainname, > idx_domain_holdername, > idx_domain_parentdoamin, > pk_domain > > An index on holdname has been created and the table analized. > > xdap_regr=# explain select domainname from domain where holdername = > 'NAMEZERO.COM'; > NOTICE: QUERY PLAN: > > Seq Scan on domain (cost=0.00..483192.89 rows=1532369 width=12) Is the estimate above (1.5M rows) reasonable? If so, it's probably doing the right thing. If not, what version are you using and are there any very common values that may throw off the estimates; what does select * from pg_statistic where starelid=(select oid from pg_class where relname='domain'); give? > Can we force optimizer to index scan? set enable_seqscan=off;