From: | Tomasz Myrta <jasiek(at)klaster(dot)net> |
---|---|
To: | vernonw(at)gatewaytech(dot)com |
Cc: | PgSQL Performance ML <pgsql-performance(at)postgresql(dot)org>, Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net> |
Subject: | Re: Is a better way to have the same result of this |
Date: | 2002-12-05 19:37:27 |
Message-ID: | 3DEFAAF7.6040000@klaster.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Vernon Wu wrote:
> Ron,
>
> The gender is indexed. Each user has account and preference, but not
necessary block.
Indexing on gender won't speed up your query - it can even slow it down.
You have probably 50% of "f" and 50% of "m". Using index on gender will
divide your potential answers by 2. Make index on columns, which
excludes much more useless rows.
I think you can create index on:
- block/personid
- profile/userid
I read in Postgres documentation(but didn't try) that you can also
change "id NOT IN (select id" to "not exists select * where id=". It may
help also.
Do user have more than one account or preference?
If no, you can change "not in" into "inner/outer join" which are the
best ones.
Regards,
Tomasz Myrta
From | Date | Subject | |
---|---|---|---|
Next Message | Jean-Luc Lachance | 2002-12-05 19:45:26 | Re: Is a better way to have the same result of this |
Previous Message | Vernon Wu | 2002-12-05 19:08:17 | Re: Is a better way to have the same result of this |