Skip site navigation (1) Skip section navigation (2)

Re: performance problems with subselects

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: John Taylor <postgres(at)jtresponse(dot)co(dot)uk>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: performance problems with subselects
Date: 2002-04-23 14:04:49
Message-ID: 11581.1019570689@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
John Taylor <postgres(at)jtresponse(dot)co(dot)uk> writes:
> I am aware that I am using almost the same select from orderheader 3
> times, but I'm not sure how I can improve on this.

Can you do this?

INSERT INTO target SELECT foo, bar, baz FROM source WHERE condition

To the extent that you are computing multiple fields from the same
row in the source table, this will help.

Also, avoid that IN construct.

			regards, tom lane

In response to

Responses

pgsql-novice by date

Next:From: John TaylorDate: 2002-04-23 14:34:18
Subject: Re: performance problems with subselects
Previous:From: John TaylorDate: 2002-04-23 13:29:34
Subject: performance problems with subselects

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group