开发者

mysql database design full-text question

开发者 https://www.devze.com 2023-03-05 08:12 出处:网络
I have a legacy mysql database and there\'s this table which has a few full-text indexed columns. In each of these columns the data stored is separated by space. It\'s li开发者_Python百科ke

I have a legacy mysql database and there's this table which has a few full-text indexed columns. In each of these columns the data stored is separated by space. It's li开发者_Python百科ke

token1 token2 token3

with the full-text index functioning, the code does a match as:

SELECT ... FROM mytable WHERE MATCH(column1) AGAINST('token1' IN BOOLEAN MODE) AND MATCH(column2) AGAINST('token2' IN BOOLEAN MODE) AND MATCH(column3) AGAINST('token3' IN BOOLEAN MODE) 

Now I want to refacter this particular design into a more normalized fashion. Another reason is that I want to use innoDB tables instead myism ones. The process seems to convert each column into one attribute table and then use another connect table to mark the one to many relationship between the attribute table and the original table. This would probably complicates the SQL a lot. I'm wondering if there's a better solution.


IMO you should create a many-many relation between your tables. That way you will obtain a better performance and a lot of more flexibility.

0

精彩评论

暂无评论...
验证码 换一张
取 消