Re: How would you store read/unread topic status? - Mailing list pgsql-performance

From Greg Stark
Subject Re: How would you store read/unread topic status?
Date
Msg-id 407d949e0906231648x7b1bb17ft3a537082b4dc4cb@mail.gmail.com
Whole thread Raw
In response to Re: How would you store read/unread topic status?  (Mathieu Nebra <mateo21@siteduzero.com>)
List pgsql-performance
On Tue, Jun 23, 2009 at 9:04 PM, Mathieu Nebra<mateo21@siteduzero.com> wrote:
> We have indexes on them, so we can SELECT every topic WHERE the user has
> written. Is it the good way of doing this?

I'm kind of skeptical that a simple index on userid,topic isn't
sufficient to handle this case. But you would have to test it on
actual data to be sure. It depends whether you have enough topics and
enough userid,topic records for a given userid that scanning all the
topics for a given user is actually too slow.

Even if it's necessary you might consider having a "partial" index on
user,topic WHERE writtenstatus instead of having a three-column index.

--
greg
http://mit.edu/~gsstark/resume.pdf

pgsql-performance by date:

Previous
From: Alan McKay
Date:
Subject: SOLVED: processor running queue - general rule of thumb?
Next
From: Chris St Denis
Date:
Subject: Re: How would you store read/unread topic status?