Re: Speed Opinion

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

 



PHP wrote:
Hi all,
I am seeking some knowledge, hopefully I explain this right.

I am wondering what you think is faster.

Say you have 1000 records from 2 different tables that you need to get from a MySQL database.
A simple table will be displayed for each record, the second table contains related info for each record in table 1.

Is if faster to just read all the records from both tables into two arrays, then use php to go through the array for table 1 and figure out what records from table 2 are related.

Or, you dump all the data in table 1 into an array, then as you go through each record you make a database query to table 2.

Make the db do it.

PS:
I know I can use a join, but I find anytime I use a join, the database query is extremely slow, I have tried it for each version of mysql and php for the last few years. The delay difference is in the order of 100x slower or more.

Then you're missing indexes or something, I've joined tables with hundreds of thousands of records and it's very fast.

--
Postgresql & php tutorials
http://www.designmagick.com/


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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux