Search Entire Database

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Skiddles2010
Forum Newbie
Posts: 19
Joined: Tue Jul 06, 2010 11:05 pm

Search Entire Database

Post by Skiddles2010 »

Let's say I have a database with 12 tables. Each of these tables contains a "name" column and a "url" column. I want the user to be able to search a word or phrase, and pull information from the tables based on the search.

Currently, the way I'm doing it is... the user submits his search phrase and then each MySQL table is individually searched for a total of 12 queries, each returning their own results. It works fine, but I'm worried that this method may be wasteful. Searching through every single record, every single time, could become a bandwidth issue later when each table has thousands of entries, correct?

Any thoughts on how to be more efficient?
User avatar
Alex-V
Forum Newbie
Posts: 17
Joined: Mon Jul 19, 2010 3:53 pm

Re: Search Entire Database

Post by Alex-V »

Create a new table that contains only 'name' and 'url' and use a GUID to link them with other tables. That way you can use just 2 queries for search
Post Reply