pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christopher Smith <christopherl_smith@yahoo.com>
To: josh@agliodbs.com
To: pgsql-sql@postgresql.org
Subject: Re: query speed joining tables
Date: Mon, 13 Jan 2003 13:56:42 -0800 (PST)
Message-ID: <20030113215642.24981.qmail@web14103.mail.yahoo.com> (raw)
In-Reply-To: <200301131347.49013.josh@agliodbs.com>


I understand cachable functions but your proposed application is a little unclear.
is it possible to see an example?
thanks in advance.
 Josh Berkus <josh@agliodbs.com> wrote:
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 majordomo@postgresql.org so that your
message can get through to the mailing list cleanly


---------------------------------
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now

view thread (12+ messages)  latest in thread

Message-ID: <20030113215642.24981.qmail@web14103.mail.yahoo.com>
Permalink:  ../20030113215642.24981.qmail@web14103.mail.yahoo.com/
Also on:    postgresql.org/message-id/20030113215642.24981.qmail@web14103.mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: christopherl_smith@yahoo.com, josh@agliodbs.com
  Subject: Re: query speed joining tables
  In-Reply-To: <20030113215642.24981.qmail@web14103.mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox