Home » Performance » FullText » DB Design for search
DB Design for search [message #1551] Wed, 25 July 2007 05:10 Go to next message
shivaball  is currently offline shivaball
Messages: 3
Registered: July 2007
Junior Member
Hi Forum,

my name is Thomas and i'm new here.

I have a question about design for search engine on a platform where the given politic is to use mysiam engine.

No i designed a search engine for the given data and i don't know if this on is really a good choice or if any body has better ideas.

DB design:

takes the words and the link to the table this word is found in
CREATE TABLE `suchindex` (
`id` int(10) unsigned NOT NULL auto_increment,
`wort` varchar(64) collate latin1_german2_ci NOT NULL default '',
`tabelle` char(Cool collate latin1_german2_ci default NULL,
`count` int(11) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `u_wort` (`wort`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci


HOLDS ALL ITEMS AND THE SUCHINDEX ID
CREATE TABLE `artikelindex` (
`id` int(10) unsigned NOT NULL auto_increment,
`item_id` int(10) unsigned NOT NULL default '0',
`suchindex_id` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `u_ite,` (`item_id`,`suchindex_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci

IS USED TO CREATE A NEW TABLE LIKE WORD_[a-z0-9]
in word_a the wort_id is the reference to suchindex.id and item_id the reference to the item.id in the current database
CREATE TABLE `default_wort` (
`id` int(10) unsigned NOT NULL auto_increment,
`wort_id` int(10) unsigned NOT NULL default '0',
`item_id` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `u_item` (`wort_id`,`item_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci


Backtrace to the user if a user_search is performed
CREATE TABLE `items_currently_in_search` (
`item_id` int(10) unsigned NOT NULL default '0',
`user_id` mediumint(Cool unsigned NOT NULL default '0',
PRIMARY KEY (`item_id`),
KEY `status` (`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

IS ONLY USED IF A FULLTEXT SEARCH IS SEND
CREATE TABLE `titlefulltext` (
`id` int(10) unsigned NOT NULL auto_increment,
`title` varchar(155) collate latin1_german2_ci default NULL,
`item_id` int(10) unsigned default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `u_item` (`item_id`),
FULLTEXT KEY `title` (`title`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci

IS ONLY USED IF A FULLTEXT SEARCH IS SEND LIKE "give me a hand"
CREATE TABLE `descfulltext` (
`id` int(10) unsigned NOT NULL auto_increment,
`description` text collate latin1_german2_ci,
`item_id` int(11) NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `u_item` (`item_id`),
FULLTEXT KEY `desc` (`description`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci


Now i'm using Perl to fill the table, what takes a long time because i have to perform some =~s for data i want to get saved (like <script> aso.)

I have this design online and the search performance on the online page is okay (150.000 different items with a avg length of 814,3308 and max length of 120.000 signs ) now i will port this design to a web page how has 10 times of items and the length of them in avg is a little higher.

Anybody can see if the performance of my design can hold this increase of information?

Thanks to anybody how can tell me something.

Re: DB Design for search [message #1587 is a reply to message #1551 ] Thu, 16 August 2007 05:28 Go to previous messageGo to next message
Peter  is currently offline Peter
Messages: 405
Registered: August 2006
Senior Member
Super Guru
Do not use your own "word" tables. this will make search slow hard to maintain and hard to deal with complicated queries you may need to handle.

MyISAM Full Text Search is better choice for small/medium size projects when search speed is acceptable.


Peter Zaitsev, MySQL Performance Expert
MySQL Performance Blog - http://www.mysqlperformanceblog.com
MySQL Consulting http://www.mysqlperformanceblog.com/mysql-consulting/
Re: DB Design for search [message #1607 is a reply to message #1587 ] Thu, 16 August 2007 09:09 Go to previous messageGo to next message
shivaball  is currently offline shivaball
Messages: 3
Registered: July 2007
Junior Member
Quote:

Do not use your own "word" tables. this will make search slow hard to maintain and hard to deal with complicated queries you may need to handle.

MyISAM Full Text Search is better choice for small/medium size projects when search speed is acceptable.


This is the problme, the FULLTEXR tables are not anymore performed a search by against match on a short word (2 signes) takes to long

Thanks
Thomas
Re: DB Design for search [message #1615 is a reply to message #1607 ] Thu, 16 August 2007 10:50 Go to previous messageGo to next message
Peter  is currently offline Peter
Messages: 405
Registered: August 2006
Senior Member
Super Guru
If well tuned MySQL Full Text Search does not work well for you any more you should think about Sphinx

http://www.sphinxsearch.com

What is exact query you're running ?


Peter Zaitsev, MySQL Performance Expert
MySQL Performance Blog - http://www.mysqlperformanceblog.com
MySQL Consulting http://www.mysqlperformanceblog.com/mysql-consulting/
Re: DB Design for search [message #2286 is a reply to message #1551 ] Fri, 30 November 2007 08:15 Go to previous messageGo to next message
amri
Messages: 1
Registered: November 2007
Junior Member
Hi. Test with separated tables.Maybe this is the decision.Have a nice day.


Web Design, Web Development-> http://www.dhstudio.eu
Re: DB Design for search [message #2324 is a reply to message #2286 ] Tue, 04 December 2007 17:11 Go to previous message
shivaball  is currently offline shivaball
Messages: 3
Registered: July 2007
Junior Member
Hi Amri;


i change the hole design to sphinxsearch - for me the best, only the live update i need isn't there but with the delta shema i found a workaround, until the real live update is online for shpinxsearch


Bye Thomas
Previous Topic:Slow COUNT query that uses a fulltext index
Next Topic:How to search by using normal index and full text together
Goto Forum:
  



Current Time: Thu Jan 8 16:15:44 EST 2009

Total time taken to generate the page: 0.00872 seconds
.:: Contact :: Home :: MySQL Support by Percona.com ::.

Powered by: FUDforum 2.7.5.
Copyright ©2001-2006 FUD Forum Bulletin Board Software

MySQL Performance | Forum authority Badge