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


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly

Reply via email to