Fw: Sub SELECTS

Fw: Sub SELECTS

am 25.09.2002 16:51:20 von Waruna Geekiyanage

This is a multi-part message in MIME format.

------=_NextPart_000_00A4_01C264D5.4D40CFE0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable




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?

------=_NextPart_000_00A4_01C264D5.4D40CFE0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable








 



I have a select query with 2 sub=20
selects.

When I run that query CPU usage goes =
to 98%=20
for postgres.

Does sub selects eat more resources a=
nd slower=20
the queries?

Is there any alternatives to sub=20
selects?


------=_NextPart_000_00A4_01C264D5.4D40CFE0--

Re: Fw: Sub SELECTS

am 25.09.2002 17:08:46 von Keary Suska

> 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--

Re: Fw: Sub SELECTS

am 27.09.2002 19:34:00 von Roland Roberts

>>>>> "Waruna" == Waruna Geekiyanage writes:

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

You are going to have to give us a clue as to what those sub-selects
are and what they are doing. If there is an "order by" clause
anywhere, that could cause high CPU. If the query is not using
indicies, that might cause a problem. Have you tried EXPLAIN?

roland
--
PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD RL Enterprises
roland@rlenter.com 76-15 113th Street, Apt 3B
roland@astrofoto.org Forest Hills, NY 11375

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html