From: | bpalmer <bpalmer(at)crimelabs(dot)net> |
---|---|
To: | Heather Johnson <hjohnson(at)nypost(dot)com> |
Cc: | pgsql-admin(at)postgresql(dot)org |
Subject: | Re: problems doing sub-selects on PostgreSQL 7.1.3 and |
Date: | 2001-12-10 22:34:00 |
Message-ID: | Pine.BSO.4.40.0112101732130.12851-100000@mizer. |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin pgsql-general |
> 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(at)crimelabs(dot)net pgp:crimelabs.net/bpalmer.pgp5
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-12-10 22:34:11 | Re: problems doing sub-selects on PostgreSQL 7.1.3 and Solaris 7 |
Previous Message | Heather Johnson | 2001-12-10 22:13:06 | FOLLOW UP: problems doing sub-selects on PostgreSQL 7.1.3 and Solaris 7 |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-12-10 22:34:11 | Re: problems doing sub-selects on PostgreSQL 7.1.3 and Solaris 7 |
Previous Message | Stephan Szabo | 2001-12-10 22:27:29 | Re: Need SQL help, I'm stuck. |