Re: Creating tons of tables to support a query

From: Jan Ploski <jpljpl(at)gmx(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Creating tons of tables to support a query
Date: 2002-09-08 23:54:08
Message-ID: 12285029.1031529248654.JavaMail.jpl@remotejava
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Sep 08, 2002 at 06:51:55PM -0500, Bruno Wolff III wrote:
> On Sun, Sep 08, 2002 at 23:58:44 +0200,
> Jan Ploski <jpljpl(at)gmx(dot)de> wrote:
> >
> > select count(*) from message where sectionID = ? and dateSent > ?
>
> If the dateDent is the same for each query, you should probably be doing
> it in one query. Something like:
> select sectionID, count(*) from message where dateSent > ? group by sectionID

Bruno,

The dateSent is not same for each section, though it may be same
for several sections (in my app, sections belong to forums, and dateSent
is same for all sections of the same forum). Anyway, I would like to avoid
counting by traversing a huge number of rows, and I think it's what the
backend does behind the scenes for such a query.

-JPL

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nathan Hopper 2002-09-09 00:08:33 Using the right tool
Previous Message Jan Ploski 2002-09-08 23:54:07 Re: Creating tons of tables to support a query