Re: OR on multiple columns

From: Date: Thu, 09 Jan 2003 22:41:38 +0000
Subject: Re: OR on multiple columns
References: 1 2  Groups: php.db php.db 
Request: Send a blank email to php-db+get-24730@lists.php.net to get a copy of this message
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

« previous php.db (#24730) next »