RE: - Mailing list pgsql-general

From tamsin
Subject RE:
Date
Msg-id NEBBKHBOBMJCHDMGKCNJGEFFDAAA.tg_mail@bryncadfan.co.uk
Whole thread Raw
In response to  ("Kapil Tilwani" <karan_pg_2@yahoo.com>)
List pgsql-general
i think performance is better in postgres if you rewrite this sort of query as:
 
select * from purchasemaster where exists (select 1 from itemmaster where itempriority = 2 and transactionid = purchasemaster.transactionid)
 
hope this helps,
tamsin
 
-----Original Message-----
From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org]On Behalf Of Kapil Tilwani
Sent: 28 May 2001 12:27
To: pgsql-general@postgresql.org; pgsql-sql@postgresql.org
Subject: [GENERAL]

Hi,
 
I have two tables purchasemaster (Master) and ItemMaster (child) linked through TransactionID
 
I have a query like
select * from purchasemaster where transactionid in (select transactionid from itemmaster where itempriority = 2)
 
****I need this query for MS-Access, MS-SQL and Postgres.  Because the application is supposed to be such that for upto 2-3 users, the application would be running on MS-Access or MSDE, while for heavier databases i.e., greater than 4 , the ideal database would be Postgres
 
Only the problem is ...  (correct me if i am wrong, PLEEEEEEEEEEEASE) that for each tuple in purchasemaster the sub-query is re-evaluated (True or False????).  What I am looking at is whether it is possible to execute the query in the sub-query just once, get its value as in "(1,2,5,23,7,90)", etc. in place of the sub-query and accordingly, execute the main query.
 
Thank you,
Kapil

pgsql-general by date:

Previous
From: Jan Wieck
Date:
Subject: Re: Triggers do the error checking
Next
From: "Fabrizio Mazzoni"
Date:
Subject: I: Help with indexes/queries/msaccess