|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (8 bit)
Join Date: May 1999
Location: Conroe, Texas, USA
Posts: 145
|
SQL: compound INDEX
I'm working a data base for a book shop and using mySQL.
Majority of queries use: WHERE media= 'media_name' AND authorLast LIKE '%A' WHERE media= 'media_name' AND title LIKE '%A' I know I can create a compound INDEX to speed up the results. ALTER TABLE inventory ADD INDEX media_authLast (media, authorLast); Can I re-use the media col in a second compound INDEX for (media, title) ? Isadora |
|
|
|
|
|
#2 |
|
Professional gadfly
|
Yes, you can reuse the media column in another compound index. I assume you meant to write the query is LIKE 'A%' instead of LIKE '%A'; indices are of no use if you are searching for things that end in A, instead of begin with A.
|
|
|
|
|
|
#3 |
|
Member (8 bit)
Join Date: May 1999
Location: Conroe, Texas, USA
Posts: 145
|
TY, Doc
Hey, Doc. Thanks for a speedy response. The client wants this up & running for their pre-Christmas sales, so I'm pushing with all nighters. Hence, the foggy thinking, like typing the '%A' . Duh.
This is the most complex e-commerce site I've ever designed. Like you, I share what I learn with others. When this project is over, man, oh, man, will I have a lot to share. Isadora |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|