Re: performance advice needed: join vs explicit subselect

From: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: performance advice needed: join vs explicit subselect
Date: 2009-01-27 22:58:28
Message-ID: 20090127225828.GH3820@merkur.hilbert.loc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jan 27, 2009 at 05:30:23PM -0500, Tom Lane wrote:

> Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net> writes:
> > the explain analyze of which is (I've actually gotten it to
> > work better in the meantime as you can see):
>
> Looks like most of the problem is in the subquery scans on v_staff,
> which seems to be a rather expensive view :-(. Maybe you can
> simplify that a bit.

Thanks so much. I wasn't quite sure how to correlate the
seemingly expensive parts of the explain with the view/query
parts. Will experiment with that...

Well, going directly to the dem.staff table below
dem.v_staff forces me to forego the actual name of the staff
entry - but the alias will need to suffice ;-)

This brings down query time from 2000ms to 7ms.

Our doctors won't complain about slow lab data retrieval
anymore ... ;-)

Thanks,
Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Noel Proffitt 2009-01-28 01:49:58 Re: [lapug] Seeking volunteers for SCALE (one more time)
Previous Message Tom Lane 2009-01-27 22:30:23 Re: performance advice needed: join vs explicit subselect