Chris,
Here are probably your two main query problems:
> strpos(user_match_details.ethnicity,'Asian') !=0 AND
It is impossible for Postgres to use an index for the above as it is written.
I would suggest one of two improvements;
1) Modify the schema so that multiple ethnicity details are kept in a
sub-table rather than a free-form text field you have to search, or:
2) Create a cachable function for "contains_asian" and index on that.
> user_details_p.zipcode in (select zips_max.destination from zips_max where
zips_max.origin='90210' )
> order by user_login.last_login desc;
Use a "WHERE EXISTS" clause instead of "IN".
--
-Josh Berkus
Aglio Database Solutions
San Francisco