From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | "Magnus Naeslund(f)" <mag(at)fbab(dot)net> |
Cc: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: 7.4 Wishlist |
Date: | 2002-12-03 05:01:06 |
Message-ID: | 200212030501.gB3516i17728@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-advocacy pgsql-general pgsql-hackers |
Magnus Naeslund(f) wrote:
> > select id, sum(sum_col)||'/'||count(*) from table_name
> > group by id;
> >
> > or
> >
> > select table_name.id, sum(sum_col)||'/'||t2.count from table_name,
> > (select id, count(*) as count from table_name group by id) as t2 where
> > table_name.id=t2.id group by table_name.id,t2.count;
> >
>
> Give it up already, i was MAKING A POINT, not trying to make an
> optimized count(*) thing :)
> There are other examples that you cannot get around, that will be
> evaluated more than once when a local "user variable" would make it not
> need to.
Here's an even slimmer query that makes a var:
test=> select var1.* from (select 1) as var1;
?column?
----------
1
(1 row)
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2002-12-03 05:02:53 | Re: Segmentation fault while COPY in 7.3 |
Previous Message | Justin Clift | 2002-12-03 03:41:27 | Re: PostgreSQL in Universities (Was: Re: 7.4 Wishlist) |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2002-12-03 05:02:53 | Re: Segmentation fault while COPY in 7.3 |
Previous Message | Joe Conway | 2002-12-03 04:00:45 | Re: Please help on MS SQL Procedure (@@rowcount) translate |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2002-12-03 05:02:53 | Re: Segmentation fault while COPY in 7.3 |
Previous Message | Justin Clift | 2002-12-03 03:41:27 | Re: PostgreSQL in Universities (Was: Re: 7.4 Wishlist) |