Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id E9726475EE1 for ; Wed, 25 Sep 2002 11:08:43 -0400 (EDT) Received: from marsha.pcisys.net (marsha.pcisys.net [216.229.32.146]) by postgresql.org (Postfix) with ESMTP id 1594C475D64 for ; Wed, 25 Sep 2002 11:08:43 -0400 (EDT) Received: from [216.229.45.29] (moe.rbe45-29.cos.pcisys.net [216.229.45.29]) by marsha.pcisys.net (8.12.5/8.12.5) with ESMTP id g8PF8kOf006677 for ; Wed, 25 Sep 2002 09:08:46 -0600 (MDT) User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.0.4 Date: Wed, 25 Sep 2002 09:08:46 -0600 Subject: Re: Fw: Sub SELECTS From: Keary Suska To: Postgres-PHP Message-ID: In-Reply-To: <00a701c264a3$05bb4100$705e5ecb@A.GEEKIYANAGE> Mime-version: 1.0 Content-type: multipart/alternative; boundary="MS_Mac_OE_3115789726_2518518_MIME_Part" X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/55 X-Sequence-Number: 1510 > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --MS_Mac_OE_3115789726_2518518_MIME_Part Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit on 9/25/02 8:51 AM, waruna@nirmani.com purportedly said: I have a select query with 2 sub selects. When I run that query CPU usage goes to 98% for postgres. Does sub selects eat more resources and slower the queries? Is there any alternatives to sub selects? That high CPU usage seems odd. I wouldn't think that even extremely complex queries would effect CPU that much, unless there are other factors such as low memory that would contribute. If any case, if you post the query and table schemas we might be able to make suggestions. Sub-selects are generally fairly efficient unless the results from the sub-selects are particularly large. Postgres may not be able to use indexes on sub-select results, I am not sure. Keary Suska Esoteritech, Inc. "Leveraging Open Source for a better Internet" --MS_Mac_OE_3115789726_2518518_MIME_Part Content-type: text/html; charset="US-ASCII" Content-transfer-encoding: quoted-printable Re: [PHP] Fw: Sub SELECTS on 9/25/02 8:51 AM, waruna@nirmani.com purportedly said:

I have a select query wit= h 2 sub selects.
When I run that query CPU usage goes to 98% for postgres.
Does sub selects eat more resources and slower the queries?
Is there any alternatives to sub selects?

That high CPU usage seems odd. I wouldn't think that even extremely complex= queries would effect CPU that much, unless there are other factors such as= low memory that would contribute.

If any case, if you post the query and table schemas we might be able to ma= ke suggestions. Sub-selects are generally fairly efficient unless the resul= ts from the sub-selects are particularly large. Postgres may not be able to= use indexes on sub-select results, I am not sure.

Keary Suska
Esoteritech, Inc.
"Leveraging Open Source for a better Internet"
--MS_Mac_OE_3115789726_2518518_MIME_Part--