Howdy all,

I've got a question regarding optimizing a query.

I've got two tables:

listing and listing_city_xref

listing is a pretty wide table with many fields that
can be queried by users. There is a subset of fields
that are always in queries of this table but there are
many additional fields that may or maynot be included.
The primary key consists of two fields, group_id int
and listing_id varchar(30).

The listing_city_xref table is very simple. It
consists of 3 fields: group_id, listing_id, city_id.
All three fields form the PK. There is an index on
group_id and listing_id as well as a foreign key that
points back to the listing table consisting of these
two fields.

I created an index on the listing table that contains
the group_id, listing_id, and the other fields that
all searches use.

When I run a query that joins the two tables on the
group_id and listing_id and I search only fields that
are included in the index that I mentioned the query
is really fast. If I add another field that's not
included in the index the query slows down by a factor
of 100. I can't simply index every field in the
listing table so what can I do? I don't understand why
added extra critieria to the query destroys its
performance. Any ideas?

Thanks,

Tripp

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to