DarkRanger Posted July 6, 2011 Share Posted July 6, 2011 Does anybody know of some code/script for searching multiple tables/columns in one go. I wrote something, but it's 400 lines odd and with 14000 records to search, it takes way to long (20 - 30 seconds) or times out. Any help will be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/241184-multiple-table-search-with-mysql-php/ Share on other sites More sharing options...
QuickOldCar Posted July 6, 2011 Share Posted July 6, 2011 I'm assuming you are using JOIN and multiple WHERE,AND,OR or possible LIKE, MATCH mysql select statements. To speed the queries up you can create indexes on any WHERE,AND,OR values http://dev.mysql.com/doc/refman/5.6/en/create-index.html You can view the slow query log to find your bottlenecks http://dev.mysql.com/doc/refman/5.6/en/slow-query-log.html It does matter the order in which you place these, try EXPLAIN, SHOW STATUS, and SHOW PROCESSLIST http://dev.mysql.com/doc/refman/5.6/en/explain.html http://dev.mysql.com/doc/refman/5.6/en/show-status.html http://dev.mysql.com/doc/refman/5.6/en/show-processlist.html Look into memcache to lessen the queries by caching. http://memcached.org/ or http://php.net/manual/en/book.memcache.php If none of the above helps you (which they should), or to get quicker responses to queries, minimize results and only fetch data you need to. To show the solutions can help: http://dynaindex.com/search.php?s=%2Blisten+%2Bfree++%2Bmusic&filter=on&page=1 That's a multiple search sifting through a million plus posts for the correct content in multiple columns, pages will get cached and also is on one of my home computers (single core cpu and run it hard) on a residential line. The thumbs are live loading. Quote Link to comment https://forums.phpfreaks.com/topic/241184-multiple-table-search-with-mysql-php/#findComment-1238884 Share on other sites More sharing options...
DarkRanger Posted July 6, 2011 Author Share Posted July 6, 2011 Wow!! Super thank you!! I'll work through all those and aks any questions I have! Stunning, really appreciate it! Quote Link to comment https://forums.phpfreaks.com/topic/241184-multiple-table-search-with-mysql-php/#findComment-1238892 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.