Re: How would you store read/unread topic status?

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Mathieu Nebra <mateo21(at)siteduzero(dot)com>
Cc: Scott Carey <scott(at)richrelevance(dot)com>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: How would you store read/unread topic status?
Date: 2009-06-23 23:48:24
Message-ID: 407d949e0906231648x7b1bb17ft3a537082b4dc4cb@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tue, Jun 23, 2009 at 9:04 PM, Mathieu Nebra<mateo21(at)siteduzero(dot)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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Chris St Denis 2009-06-24 07:16:38 Re: How would you store read/unread topic status?
Previous Message Alan McKay 2009-06-23 23:21:38 SOLVED: processor running queue - general rule of thumb?