Re: Slow SQL? - Mailing list pgsql-general

From Albe Laurenz
Subject Re: Slow SQL?
Date
Msg-id A737B7A37273E048B164557ADEF4A58B5386C428@ntex2010i.host.magwien.gv.at
Whole thread Raw
In response to Re: Slow SQL?  (Bjørn T Johansen <btj@havleik.no>)
List pgsql-general
Bjørn T Johansen wrote:
> Thx for your suggestions. Tried to use NOT EXISTS and the query was about half a second quicker so not
> much difference...
> But when I try to run the 3 queries separately, then they are very quick, 2 barely measurable and the
> third takes about 1,5 seconds. The union query
> takes a little over 9 seconds, so I guess the union part is the bottleneck?

Looking at EXPLAIN (ANALYZE) output should tell you.

If yes, is UNION ALL an option for you?
That should be cheaper.

Yours,
Laurenz Albe

pgsql-general by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Re: Slow SQL?
Next
From: Sameer Kumar
Date:
Subject: Re: pg_restore out of memory