note 33466 added to function.array-intersect

From: Date: Thu, 26 Jun 2003 20:50:08 +0000
Subject: note 33466 added to function.array-intersect
Groups: php.notes 
Request: Send a blank email to php-notes+get-51062@lists.php.net to get a copy of this message
If you have a slow database query that uses JOIN, try to array_intersect() the table records. I hung up my server countless times before using this function. Simple select from one table and put the records in an array ($records_1), then select records from any other table and put them in another array($records_2). array_intersect() will emulate a JOIN for you. $emulated_join = array_intersect($records_1, $records_2); Remember to test if it really offers a speed improvement, your mileage may vary (database type, hardware, version, etc...) You could also emulate a JOIN from two text files, reading each line with the file() function. ---- Manual Page -- http://www.php.net/manual/en/function.array-intersect.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33466 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33466&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33466&report=yes

« previous php.notes (#51062) next »