What is fastes - mysql or php?
If I want to display eg. two fields from a database... like first and last name... is it faster to use CONCAT in mysql to "join" the output or just make php echo "$field1 $field2"?

It is just not only the CONCAT function I wounder about... it more in generall... is it faster to use php or mysql where both can do the same function?

    I think the answer is: it depends.

    It depends on how many queries are made for each version of code, on how fast are the respective servers (if they arent on the same server), various implementations, that sort of thing.

    I would prefer using PHP to work with my data, but then that's because I'm more familiar with PHP and so can optimize and manipulate my code better than I can optimize and manipulate my queries.

      I would suggest that it be better to perform such functions within PHP. In this way your code becomes portable across different databases, for example , your code will be valid whether you use Oracle,MSSQL,mySQL etc. and does not become database dependant.

        I would suggest that it be better to perform such functions within PHP. In this way your code becomes portable across different databases, for example , your code will be valid whether you use Oracle,MSSQL,mySQL etc. and does not become database dependant.

        well. i got to agree with you... :p

          Write a Reply...