Re: Variables in PostgreSQL? [was: Is my MySQL Gaining?] - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: Variables in PostgreSQL? [was: Is my MySQL Gaining?]
Date
Msg-id 20031229040235.GA4924@wolff.to
Whole thread Raw
In response to Variables in PostgreSQL? [was: Is my MySQL Gaining?]  (Casey Allen Shobe <cshobe@softhome.net>)
List pgsql-general
On Sun, Dec 28, 2003 at 12:57:10 -0500,
  Casey Allen Shobe <cshobe@softhome.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.

pgsql-general by date:

Previous
From: Alex Satrapa
Date:
Subject: Re: Is my MySQL Gaining ?
Next
From: Tom Lane
Date:
Subject: Re: pg_recvbuf errors