Reply
Need for fast up the search cretieria
Old 03-20-2007, 05:23 AM Need for fast up the search cretieria
faisalzafar's Avatar
Experienced Talker

Posts: 41
Location: Pakistan
Trades: 0
hi i am using MYSQL Database with PHP, i have a table of "locations" with the data of almost 15,00,000 Records (Size 260 MB) , when i make the search in that table then it take long time to search and also take long time to display results , can any one give me idea how can i optimize this table or just divide this table into multiple tables or any thing else


Your suggestion are highly appreciated
__________________
[COLOR=Pink]Faisal Zafar[/COLOR]
faisalzafar is offline
Reply With Quote
View Public Profile Visit faisalzafar's homepage!
 
 
When You Register, These Ads Go Away!
Old 03-20-2007, 06:48 AM Re: Need for fast up the search cretieria
chrishirst's Avatar
Super Moderator

Posts: 26,511
Location: Blackpool. UK
Trades: 0
No idea

we would need to see the existing structure(s) and queries before even having a clue why it's slow to start with.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | Crowded Nightclub? | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-20-2007, 08:38 PM Re: Need for fast up the search cretieria
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,024
Name: Forrest Croce
Location: Seattle, WA
Trades: 0
Do you have any indexes on your table, or are you forcing the server to search 260 MB every time you run a query? If you do have indexes, are they being used

We would need to see the table structure(s), the query, and ideally the execution plan to really diagnose anything.
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 03-21-2007, 04:01 AM Re: Need for fast up the search cretieria
WebSavvy's Avatar
Extreme Talker

Posts: 166
Name: Deb
Trades: 0
If the db type is "MyISAM" you can set up indexes. To set up an index the fields to be used can be varchar or text type fields. The total length of an index field is 255.

So, lets say you're going to build an index called for_search and in it you'll use
`location`
`ID`
`city`

You can assign value length of the field as 85 for each of these in the index `for_search`

I have indexes set up on mine too because I have a search used on my directory and the fields included in the index are the site title, description, and keywords.

Then when a search is performed using my search script it uses the search index I have assigned those fields to. Then based on the information it dynamically pulls the categories, size, index date, etc., to display in the SERP along with the site title, description, and so forth.

Then I took it a step further and added an algorithm to determine relevance based on the factors stated above. Next to each return in the SERP a relevance factor is displayed.

Hope this helps.
__________________
WebSavvy Directory | IHY
WebSavvy is offline
Reply With Quote
View Public Profile Visit WebSavvy's homepage!
 
Old 03-21-2007, 05:01 AM Re: Need for fast up the search cretieria
faisalzafar's Avatar
Experienced Talker

Posts: 41
Location: Pakistan
Trades: 0
hi Thanks for your replies,

The db type is "MyISAM"

Please Deb can you send me the sample code (algorithm )


Many Thanks
__________________
[COLOR=Pink]Faisal Zafar[/COLOR]
faisalzafar is offline
Reply With Quote
View Public Profile Visit faisalzafar's homepage!
 
Old 03-21-2007, 05:07 AM Re: Need for fast up the search cretieria
WebSavvy's Avatar
Extreme Talker

Posts: 166
Name: Deb
Trades: 0
Sorry, the algorithm isn't public source. I wrote it and it's one of the things that makes my directory unique to all of the others. So, I can't give you my codes. But, you'd probably be able to do some research on writing algorithms and come up with something equally as useful, all on your own.
__________________
WebSavvy Directory | IHY
WebSavvy is offline
Reply With Quote
View Public Profile Visit WebSavvy's homepage!
 
Old 03-21-2007, 05:42 AM Re: Need for fast up the search cretieria
BruceWayne's Avatar
Extreme Talker

Posts: 182
Trades: 0
Try to divide results and use pagination, just like google <prev 1,2,3,4,5 Next>
BruceWayne is offline
Reply With Quote
View Public Profile Visit BruceWayne's homepage!
 
Old 03-21-2007, 06:33 AM Re: Need for fast up the search cretieria
WebSavvy's Avatar
Extreme Talker

Posts: 166
Name: Deb
Trades: 0
Faisal, if you need help with pagination, just ask. I can post codes for you to do this quite easily. Then if you run into any trouble, or it isn't working properly -- just post your code snippets and I'll help you through it.

Doing pagination isn't really hard per se, but it can be a pain in the butt sometimes.
__________________
WebSavvy Directory | IHY
WebSavvy is offline
Reply With Quote
View Public Profile Visit WebSavvy's homepage!
 
Reply     « Reply to Need for fast up the search cretieria
 

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.11121 seconds with 13 queries