Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Sql > GiST/GIN index ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 3388 of 3799
Post > Topic >>

GiST/GIN index for field of type VARCHAR[]

by yuragal@[EMAIL PROTECTED] ("Yura Gal") Apr 3, 2008 at 07:38 PM

I have following table:
CREATE TABLE t1 (
  "name" VARCHAR(500) NOT NULL,
  "lid" INTEGER NOT NULL,
  "accs" VARCHAR(20)[] NOT NULL
  CONSTRAINT "t1_lid_key" UNIQUE("lid")
);

I interested in the possibility to speed-up search for rows like this:
SELECT lid
FROM t1
WHERE accs && ARRAY['item1','item2'...]::VARCHAR[];

For sure, I can use the typical way of data normalization to decrease
query time:
CREATE TABLE t2(
  "lid" INTEGER NOT NULL,
  "acc" VARCHAR(20) NOT NULL
);
with: t2.lid = t1.lid & t1.accs @[EMAIL PROTECTED]
> ARRAY[t2.acc]
and create hash index on acc.

Then I could SELECT lid FROM t2 WHERE acc IN(item1,item2);

But it's more interesting to implement GiST/GIN indexes for this purpose.
And what type of index is the most suitable if VARCHAR[] arrays are
1-dimensional and contain from 1 to 20000 elements?

Thanks in advance.

-- 
Best regards. Yuri.
mailto: yuragal@[EMAIL PROTECTED]
 
Sent via pgsql-sql mailing list (pgsql-sql@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
 




 1 Posts in Topic:
GiST/GIN index for field of type VARCHAR[]
yuragal@[EMAIL PROTECTED]  2008-04-03 19:38:49 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 21:34:31 CST 2008.