Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 07-07-2008, 09:20 PM MySQL response time
choskins102's Avatar
Super Talker

Posts: 137
Name: Casey
Trades: 3
I have a database that will house an etimated 100,000 results. Before, I was planning on breaking up the results into smaller table (about 10 tables to house all of the results.) However, I have run across several problems and I really need all these results to be in the same table. If I have a search page that searches all 100,000 results, is there a significant time issue when it comes to time? I don't want someone's search results to take several minutes just to look something up.
choskins102 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-07-2008, 10:03 PM Re: MySQL response time
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
If you are trying to search within text type fields using a similar approach:

SELECT * FROM table WHERE field LIKE '%keyword%'

Then you will have serious result time in a large database table. However, MySQL provides a way for use of Fulltext indexing.

Here is a good tutorial / article:
http://devzone.zend.com/node/view/id/1304
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 07-08-2008, 12:10 AM Re: MySQL response time
choskins102's Avatar
Super Talker

Posts: 137
Name: Casey
Trades: 3
Thanks, that's what I was looking for. Also, what about if I specifically tell the query what to look for.

Code:
mysql_query("SELECT * FROM table WHERE name = 'Bill'");
Will there still be a significant response time?
choskins102 is offline
Reply With Quote
View Public Profile
 
Old 07-08-2008, 12:17 AM Re: MySQL response time
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
Quote:
Originally Posted by choskins102 View Post
Thanks, that's what I was looking for. Also, what about if I specifically tell the query what to look for.

Code:
mysql_query("SELECT * FROM table WHERE name = 'Bill'");
Will there still be a significant response time?
I don't think so, but fulltext searching will allow you to return a result set with similar keyword(s). Your example above will only return exact match (case-sensitive) only which is highly rare.

Fulltext is very much the way to go.

SELECT * FROM table WHERE MATCH(name) AGAINST('Bill')
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 07-08-2008, 12:38 AM Re: MySQL response time
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
If you know what you are looking for then an index is appropriate. If it's for partial matches, do what mgraphic has said. If it's for exact, case-insensitive matches, then do an index on the first few characters (try to make it so that the index cardinality is high) and then do a LIKE match on it.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Reply     « Reply to MySQL response time
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.38511 seconds with 12 queries