Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 10-03-2002, 02:20 AM   #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
Isadora is offline   Reply With Quote
Old 10-03-2002, 08:26 AM   #2
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
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.
doctorgonzo is offline   Reply With Quote
Old 10-04-2002, 02:15 PM   #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
Isadora is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 12:24 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2