Re: OR on multiple columns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Jason Wong wrote:
On Thursday 09 January 2003 08:36, David Chamberlin wrote:

I was reading the mysql docs and noticed a section on searching on
multiple keys (stupid question - keys=columns?). It says doing an OR on
multiple keys is inefficient, and you should use a temp table. Here's
their example:

CREATE TEMPORARY TABLE tmp
SELECT field1_index, field2_index FROM test_table WHERE field1_index = '1';
INSERT INTO tmp
SELECT field1_index, field2_index FROM test_table WHERE field2_index = '1';
SELECT * from tmp;
DROP TABLE tmp;

My question is, is there a point at which this temp table is less
efficient?

That may depend upon your particular circumstances, and hence running your own tests on both methods would give you the best answer.
OK, so what's the best way to go about profiling this? Everything runs on my ISP's server.

Thanks,
Dave


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux