Re: problems doing sub-selects on PostgreSQL 7.1.3 and Solaris 7
Heather Johnson <hjohnson@nypost.com>
From: "Heather Johnson" <hjohnson@nypost.com>
To: "bpalmer" <bpalmer@crimelabs.net>
Cc: <pgsql-admin@postgresql.org>, "Harry Ford" <hford@globix.com>, "Serge Canizares" <serge@enluminaire.com>, "Marie Musacchio" <marie@nypost.com>
Date: 2001-12-11T14:47:41Z
Lists: pgsql-general
Thanks Brandon---that's a very good idea. I'd still like to know why my x86 box can handle the less effecient query better than an E-450, but this is what I'll do until I can get my curiosity satisfied. ;) Heather ----- Original Message ----- From: "bpalmer" <bpalmer@crimelabs.net> To: "Heather Johnson" <hjohnson@nypost.com> Cc: <pgsql-admin@postgresql.org> Sent: Monday, December 10, 2001 5:34 PM Subject: Re: [ADMIN] problems doing sub-selects on PostgreSQL 7.1.3 and Solaris 7 > > SELECT count(*) FROM users WHERE id NOT IN ( SELECT users_id FROM users_demographics ); > > I'm not sure about the difference in speed, but try the following for a > much faster query: > > SELECT count(id) > FROM users > > EXCEPT > > SELECT users_id > FROM users_demographics > > Should be a great deal faster. > > - Brandon > > > > -------------------------------------------------------------------------- -- > c: 646-456-5455 h: 201-798-4983 > b. palmer, bpalmer@crimelabs.net pgp:crimelabs.net/bpalmer.pgp5 >