NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP array_unique vs. SQL DISTINCT

David Krings ramons at gmx.net
Sun Jun 3 13:58:37 EDT 2007


David Krings wrote:
> Hi!
> 
> Which one is faster: PHP array_unique or SQL DISTINCT ?
> 

OK, while I still like to know what the answer is, the DISTINCT wasn't 
the culprit, but the way I join the tables. I ran the query across only 
two tables and with that got millions of records when I expected only a 
few hundred.
I guess it is time to learn some more SQL and not just go for broke and 
run queries without knowing what they really do. Worked fine in the test 
system with only a dozen records in each table. My approach apparently 
doesn't scale well.

David





More information about the talk mailing list