Received: from qmsql.netservers.net (hpmail1.netservers.net [209.196.128.163]) by postgresql.org (Postfix) with SMTP id 3FAFB475B20 for ; Fri, 22 Feb 2002 09:51:10 -0500 (EST) Received: (qmail 2047 invoked from network); 22 Feb 2002 14:51:14 -0000 Received: from unknown (HELO AARON) (66.26.63.73) by hpmail1.netservers.net with SMTP; 22 Feb 2002 14:51:14 -0000 Message-ID: <018a01c1bbaf$befb84b0$110a010a@headquarters.wcgroup.com> From: "Samuel J. Sutjiono" To: Subject: How does Index Scan get used Date: Fri, 22 Feb 2002 09:46:30 -0500 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0185_01C1BB85.CE1E47E0" 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: 200202/310 X-Sequence-Number: 6732 This is a multi-part message in MIME format. ------=_NextPart_000_0185_01C1BB85.CE1E47E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable =20 I tried an Index Scan but I kept on getting Seq Scan. Do you know why ? Wha= t do I need to do to get my query to use index scan (I tried to turn it on = by doing SET ENABLE_indexscan =3D on; but it didn't work) create table test (test_col text); create index test_index on test (test_col); insert into test values ('abc.xyz'); insert into test values ('abcxyz'); insert into test values ('abc/xyz'); explain select * from test where test_col like 'abc/%'; NOTICE: QUERY PLAN: Seq Scan on test (cost=3D0.00..22.50 rows=3D10 width=3D12) Another question: Does Regex (~*) or like use table scan ? Thanks, Sam _________________________________________________ Expand your wireless world with Arkdom PLUS http://www.arkdom.com/ ------=_NextPart_000_0185_01C1BB85.CE1E47E0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
 
I tried an Index Scan but I kept on g= etting=20 Seq Scan. Do you know why ? What do I need to do to get my query = to=20 use index scan (I tried to turn it on  by doing SET ENABLE_indexscan = =3D on;=20 but it didn't work)
 
create table test (test_col text);
crea= te index test_index on t= est=20 (test_col);
insert into test values ('abc.xyz');
insert into test val= ues=20 ('abcxyz');
insert into test values ('abc/xyz');
explain select * from test where test_col = like=20 'abc/%';
 
NOTICE:  QUERY PLAN:
 
Seq Scan on test&nb= sp;=20 (cost=3D0.00..22.50 rows=3D10 width=3D12)
 
Another question:
Does Regex (~*) or like use table scan=20 ?
 
Thanks,
Sam
_________________________________________________
 Expand = your=20 wireless world with Arkdom PLUS
 http://www.arkdom.com/
= ------=_NextPart_000_0185_01C1BB85.CE1E47E0--