Re: Variables in PostgreSQL? [was: Is my MySQL Gaining?]

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Casey Allen Shobe <cshobe(at)softhome(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Variables in PostgreSQL? [was: Is my MySQL Gaining?]
Date: 2003-12-29 04:02:35
Message-ID: 20031229040235.GA4924@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-advocacy pgsql-general pgsql-hackers

On Sun, Dec 28, 2003 at 12:57:10 -0500,
Casey Allen Shobe <cshobe(at)softhome(dot)net> wrote:
>
> Ahh, I have seen those...but they're specific to psql, and if memory serves me
> correct I wasn't able to use the variables within queries, either. I need
> something I can use over ODBC (within a single transaction, of course).
> These can sometimes solve problems that you can't seem to solve any other
> way, and other times can improve query response time *greatly* (say, by
> running a subquery once and assigning the result to a variable used 40 times
> in the final statement instead of running 40 subqueries).

You should be handle to this case by using the subselect query in the from
clause and then doing a join to make the value available where needed.

In response to

Browse pgsql-advocacy by date

  From Date Subject
Next Message Shridhar Daithankar 2003-12-29 06:55:34 Re: [GENERAL] Is my MySQL Gaining ?
Previous Message Alex Satrapa 2003-12-29 03:16:03 Re: Is my MySQL Gaining ?

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-12-29 04:19:32 Re: pg_recvbuf errors
Previous Message Alex Satrapa 2003-12-29 03:16:03 Re: Is my MySQL Gaining ?

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-12-29 04:37:09 Re: Use of 'cp -r' in CREATE DATABASE
Previous Message Alex Satrapa 2003-12-29 03:16:03 Re: Is my MySQL Gaining ?