X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7F023D1B438 for ; Tue, 9 Dec 2003 08:38:09 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 84279-07 for ; Tue, 9 Dec 2003 04:37:40 -0400 (AST) Received: from TYO201.gate.nec.co.jp (TYO201.gate.nec.co.jp [202.32.8.214]) by svr1.postgresql.org (Postfix) with ESMTP id 7EBE0D1B561 for ; Tue, 9 Dec 2003 04:37:35 -0400 (AST) Received: from mailgate3.nec.co.jp ([10.7.69.186]) by TYO201.gate.nec.co.jp (8.11.7/3.7W01080315) with ESMTP id hB98bXc12630; Tue, 9 Dec 2003 17:37:34 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id hB98bXY14126; Tue, 9 Dec 2003 17:37:33 +0900 (JST) Received: from fireball.ntsp.nec.co.jp (postfix@[172.28.58.1]) by isgw1.nec.co.jp (8.11.7/3.7W-ISGW-NEC) with ESMTP id hB98bV516969; Tue, 9 Dec 2003 17:37:31 +0900 (JST) Received: from the-one (localhost [127.0.0.1]) by fireball.ntsp.nec.co.jp (Postfix) with ESMTP id C0FE629B0D; Tue, 9 Dec 2003 16:34:38 +0800 (HKT) Received: from 172.28.58.4 ([172.28.58.4] helo=galadriel.ntsp.nec.co.jp) by the-one ; 9 Dec 03 08:34:38 -0000 Received: from hq.ntsp.nec.co.jp (frytrix.hq.ntsp.nec.co.jp [172.28.58.129]) by galadriel.ntsp.nec.co.jp (Postfix) with ESMTP id 5726840202; Tue, 9 Dec 2003 16:36:02 +0800 (PHT) Received: (from smtp@localhost) by hq.ntsp.nec.co.jp (8.9.2/8.9.2) id QAA07084; Tue, 9 Dec 2003 16:16:30 +0800 (HKT) Received: from UNKNOWN(192.168.100.236), claiming to be "GREECE" via SMTP by frytrix, id smtpdAAACA9Lf_; Tue Dec 9 08:16:29 2003 Message-ID: <056801c3be2f$ab4e6d90$ec64a8c0@GREECE> From: "Ace" To: "Greg Stark" Cc: "PGSQL_SQL" References: <3FD0A87B.4010803@scmbb.ulb.ac.be><001101c3bbb6$8b0db840$ec64a8c0@GREECE> <87ptf11n1j.fsf@stark.dyndns.tv> Subject: Re: Index not recognized Date: Tue, 9 Dec 2003 16:37:24 +0800 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 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/61 X-Sequence-Number: 16227 Hello Greg, thanks for replying. I definitely lacked the expression you suggested in my 'SELECT' statement. > Is this *= operator from the contrib/array directory? It's not an indexable > operator at all using standard btree indexes. Yes, it is from contrib/array directory. > The GiST indexing does make indexable operators that can do things like *= but > that's a whole other ball of wax. I tried the btree_gist from contrib/, but I know I missed something because I got this error message: data type text[] has no default operator class for access method "gist". You must specify an operator class for the index or define a default operator class for the data type. > What are you really trying to do? I have tables with attributes whose datatype is TEXT[]. I'm interested to find out the time it will take to finish an array search with and without an index. --- Grace ----- Original Message ----- From: "Greg Stark" To: "Grace C. Unson" Cc: "PgSQL SQL" Sent: Sunday, December 07, 2003 8:36 AM Subject: Re: [SQL] Index not recognized > > "Grace C. Unson" writes: > > > Why is it that my index for text[] data type is not recognized by the > > Planner? > > > > I did these steps: > > > > 1. create function textarr(text[]) returns text language sql as 'select > > $1[1]' strict immutable > > 2. create index org_idx on EmpData (textarr(org)); > > This index will only be used if you use the expression textarr(org) in your > query. You would probably have some success if you did: > > select * from empdata where textarr(org) = 'math' > > > 3. vacuum full > > 4. explain analyze select name from EmpData where org *= 'math'; > > Is this *= operator from the contrib/array directory? It's not an indexable > operator at all using standard btree indexes. > > The GiST indexing does make indexable operators that can do things like *= but > that's a whole other ball of wax. > > What are you really trying to do? > > > Result: > > ========= > > Seq Scan on EmpData (cost=0.00..3193.20 rows=102 width=488) > > (actual time=3.71.35..371.35 rows=0 loops=1) > > > > Filter: (org[0]='math'::text) > > Well that's awfully odd. I don't know how that expression came out of the > query you gave. You'll have to give a lot more information about how you're > defining *= and why you think it's related to the function you used to define > the index. > > -- > greg > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) >