Skip site navigation (1) Skip section navigation (2)

Re: arrays and indexes

From: Greg Stark <gsstark(at)mit(dot)edu>
To: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: arrays and indexes
Date: 2004-07-26 06:27:20
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
"Ross J. Reedstrom" <reedstrm(at)rice(dot)edu> writes:

> In the new schema, the same thing is:
> SELECT * from content where 42 = ANY (authors);
> Works fine, but for the life of me I can't find nor figure out how to
> build an index that will be used to speed this along. Any ideas?

Well that's basically the problem with denormalized data like this.

Have you resolved what you're going to do if two sessions try to add a user to
the same group at the same time? Or how you'll go about removing a user from
all his groups in one shot?

Basically, if you denormalize in this fashion it becomes hard to use the
groups as anything but single monolithic objects. Whereas normalized data can
be queried and updated from other points of view like in the case you name

Postgres does have a way to do what you ask, though. It involves GiST indexes
and the operators from the contrib/intarray directory from the Postgres

However I warn you in advance that this is fairly esoteric stuff and will take
some time to get used to. And at least in my case I found the indexes didn't
actually help much for my data sets, probably because they just weren't big
enough to benefit.


In response to


pgsql-performance by date

Next:From: Gaetano MendolaDate: 2004-07-26 14:01:15
Subject: Re: hardware raid suggestions
Previous:From: Ross J. ReedstromDate: 2004-07-26 04:57:10
Subject: arrays and indexes

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group