Re: help with making appropriate indexes.
| From: | Miles Thompson | Date: | Thu, 15 Aug 2002 14:33:16 +0000 |
| Subject: | Re: help with making appropriate indexes. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-112761@lists.php.net to get a copy of this message | ||
General rule of thumb - create indexes on any fields which will be used in the conditional part of a select statement, whether where or join. Since you are working with tables, you can save yourself a lot of typing by dropping the "table_" from the table names. After all, that's what they are. (You can do this unless you've gone too far with your system.)
Miles Thompson
At 02:15 PM 8/14/2002 +0200, lallous wrote:
give this query:
SELECT
table_routing.id AS routeid,
table_pricing.units AS price,
table_routing.provider AS providerid,
table_country.name AS countryname,
table_country.id AS countrycode
FROM
table_pricing,
table_routing,
table_country
WHERE
table_country.id = table_routing.country
AND
table_routing.country = table_pricing.country
AND
table_routing.provider = table_pricing.provider
AND
table_country.enabled = 1
ORDER BY routeid
what keys / indexes should I create on whatever tables to make this query
efficient?
I don't know if this query can be re-written even with JOINs and stuff.
Please advise,
If you've got an online doc. about that it will help too.
Elias
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php