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

Re: query planner and scanning methods

From: "Richard Broersma" <richard(dot)broersma(at)gmail(dot)com>
To: "Colin Copeland" <copelco(at)caktusgroup(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org, "team(at)caktusgroup(dot)com s" <team(at)caktusgroup(dot)com>
Subject: Re: query planner and scanning methods
Date: 2008-09-24 19:22:49
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
On Tue, Sep 23, 2008 at 3:57 PM, Richard Broersma
<richard(dot)broersma(at)gmail(dot)com> wrote:
> SELECT A."dimension_book"."call", SUM( B."dimension_book"."call" ) AS
> OrderedRowNbr
> FROM ( your_above_query_without_the_limits ) AS A
> INNER JOIN ( your_above_query_without_the_limits ) AS B
> ON A."dimension_book"."call" >= B."dimension_book"."call"
> ORDER BY A."dimension_book"."call"
> HAVING SUM( A."dimension_book"."call" ) % 10 = 0;

Oops I just noticed that I used sum() where count() should be used and
that I forgot to include the group by clause.  Other than that, I hope
the suggestion was at least halfway helpful.

Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)

In response to

pgsql-performance by date

Next:From: Matthew WakelingDate: 2008-09-25 12:07:09
Subject: Slow index
Previous:From: Axel RauDate: 2008-09-24 15:05:34
Subject: Re: UFS 2: soft updates vs. gjournal (AKA: Choosing a filesystem 2.)

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