On Tue, Jan 27, 2009 at 05:30:23PM -0500, Tom Lane wrote: > Karsten Hilbert <Karsten.Hilbert@xxxxxxx> 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 -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general