Re: Creating an INDEX on multiple tables?
| From: | Karl DeSaulniers | Date: | Thu, 21 Oct 2010 12:00:15 +0000 |
| Subject: | Re: Creating an INDEX on multiple tables? | ||
| References: | 1 2 3 4 5 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-47406@lists.php.net to get a copy of this message | ||
I see.
Thanks for the explanation Bastien.
Best,
Karl
On Oct 21, 2010, at 6:56 AM, Bastien wrote:
FKs are constraints. They really are there to ensure that the data in the FK exists in the other table. They do not operate like a conventional index that is there to aid in selecting data. Bastien Koert 905-904-0334 Sent from my iPhone On 2010-10-21, at 7:24 AM, Karl DeSaulniers <karl@designdrumm.com> wrote:Karl DeSaulniers Design Drumm http://designdrumm.comExcuse me for intruding, but wouldn't this be a Foreign Key solution? If one field is the same on all tables, can't you just set a Foreign Key that all tables with that field get their data from? Then you only have to query the master table?? Or an I not grasping the idea behind Foreign Keys. I am still learning. TIA HTHS Karl On Oct 21, 2010, at 6:12 AM, Bastien wrote:Alternatively, you could try setting that index on each table and use a UNION to join multiple queries together provided each query returns the identical data set structures ( or the column types have to match) Bastien Koert 905-904-0334 Sent from my iPhone On 2010-10-21, at 7:06 AM, Artur Ejsmont <ejsmont.artur@gmail.com> wrote:Karl DeSaulniers Design Drumm http://designdrumm.com --PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpI dont think you can create such index across tables. If you are interested read up on sphinx. Im pretty sure you would be able to create what you need. Alternatively ... a super simplistic solution ..... create one extra search table with copy of the data and create index there? ;P hehehe + would let you do what you need - would require a lot more IO to support the extra writes (to keep copy in sync) It would be cool if a fulltext index could be created on a view :) Art On 21 October 2010 09:43, Ron Piggott <ron.piggott@actsministries.org> wrote:-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpIs it possible to create one index on multiple tables? I am trying to create a search function for my web site. The data the user needs to be able to search is stored in multiple tables. I would like to be able to use "MATCH / AGAINST", like the query below I found online. SELECT firstname, lastname,comments FROM users WHERE MATCH(firstname,lastname,comments) AGAINST ('$searchterm') Ron--PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php