If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Optimizing for large searches

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-30-11, 13:18
zullyrday zullyrday is offline
Registered User
 
Join Date: Dec 2011
Posts: 1
Optimizing for large searches

I have a big database with over 250.000 descriptions.

To prevent searching a lot with querys like %'searchword_here%' I thougt to make a separate table with the keywords.

So I have 2 tables
- table1, with the ids and original descriptions
for example,
description_id 1: description: word1,word2,word3,word4
description_id 2: description: word1,blabla2,word3,blabla4
description_id 3: description: blabla1,word2,word3,blabla4


- table 2, with the separate words from the descriptoins, and ids , extracted from table 1 and separated with a |
a short example:
id 1: word 1 description_ids: 1|2
id 2: word 2 description_ids: 1|3
id 3: word 3 description_ids: 1|2|3
id 4: word 4 description_ids: 1
id 4: word blabla2 description_ids: 2
id 5: word blabla1 description_ids: 3
id 6: word blabla4 description_ids: 3
with primary key on id, and index on the word

When searching query looks in table2 for the search words, get the description_ids and shows the complete description etc. getting it from table1

Searching now goes very fast.
But inserting new words in table 2 and/or updating the records, or starting from the beginning costs a lot of time when the table2 is getting bigger and bigger with more words and ids.

How can I make this more efficient and faster when building the table2 from the beginning?

Thanks for your help !
Valeria
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On