Re: subqueries vs. separate queries

From: Guy Fraser <guy(at)incentre(dot)net>
To: CSN <cool_screen_name90001(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: subqueries vs. separate queries
Date: 2004-01-29 22:14:13
Message-ID: 401985B5.2030307@incentre.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

CSN wrote:

>Is there much difference between using subqueries and
>separating out them into separate queries?
>
>
That would depend on what results your expecting, and how you intend on using the results.

For example if you want all the data in a single statement, you can't break it up, but the request will likely use more resources to complete.
If your application can cut and paste the data from multiple transactions, then simple queries may need less resources to complete, but remember that your application will require resources to cut and paste the results as well.

I have written a number of PHP functions that uses an array the results of a query to generate formatted html tables, graphs and statistical information. It is easiest to use a single complex query with subqueries, but it is possible to 'fake' a complex query by 'stacking' multiple results into an array.

Hope that helps.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Christopher Browne 2004-01-29 22:35:10 Re: subqueries vs. separate queries
Previous Message CSN 2004-01-29 21:59:00 subqueries vs. separate queries