Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 04-06-2006, 02:47 AM   #1
alex79
Confirmed User
 
Join Date: Jun 2002
Location: france
Posts: 996
mysql optimizing table question

I have a table with next structure:

Code:
CREATE TABLE `table` (
`keywords` TEXT NOT NULL
) TYPE = MYISAM ;
where the rows are like:
row1: keyword1,keyword2,keyword5,...
row2: keyword10,keyword435,keyword5123,keywordn...


i want to make selects like this:


Code:
select * from `table` where `keywords` like '%keyword2%'

how do i optimize the `table` for a such selects? if i create an index on `keywords` column don't help becouse index are created after the firsts characters from column and are useful for selects with where `keywords` like 'keyword2%' not for selects with where `keywords` like '%keyword2%'

How can optimize the table for a such select?
__________________
alex79 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-06-2006, 02:59 AM   #2
darksoul
Confirmed User
 
darksoul's Avatar
 
Join Date: Apr 2002
Location: /root/
Posts: 4,997
http://dev.mysql.com/doc/mysql/en/Fulltext_Search.html
__________________
1337 5y54|)m1n: 157717888
BM-2cUBw4B2fgiYAfjkE7JvWaJMiUXD96n9tN
Cambooth
darksoul is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-06-2006, 03:03 AM   #3
darksoul
Confirmed User
 
darksoul's Avatar
 
Join Date: Apr 2002
Location: /root/
Posts: 4,997
also another option (fastest) would be
table keywords (entry_id int auto_increment, keywords text, primary key(entry_id))
table keywords_index (keyword varchar(16), simulated_array varchar(256))
where simulated_array would reference table keywords
its more work but its the fastest for search
__________________
1337 5y54|)m1n: 157717888
BM-2cUBw4B2fgiYAfjkE7JvWaJMiUXD96n9tN
Cambooth
darksoul is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.