Re: performance problems with subselects - Mailing list pgsql-novice

From Tom Lane
Subject Re: performance problems with subselects
Date
Msg-id 11581.1019570689@sss.pgh.pa.us
Whole thread Raw
In response to performance problems with subselects  (John Taylor <postgres@jtresponse.co.uk>)
Responses Re: performance problems with subselects  (John Taylor <postgres@jtresponse.co.uk>)
Re: performance problems with subselects  (John Taylor <postgres@jtresponse.co.uk>)
List pgsql-novice
John Taylor <postgres@jtresponse.co.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

pgsql-novice by date:

Previous
From: John Taylor
Date:
Subject: performance problems with subselects
Next
From: John Taylor
Date:
Subject: Re: performance problems with subselects