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