String performacne: PHP vs MySQL -
this question has answer here:
- doing calculations in mysql vs php 5 answers
are there performance concerns of note when using mysql's concat()
function in select query? faster/slower/negligible simple select, , format strings view using php after result set database returned? or more complicated sql query multiple calls concat()
returns string formatted view better approach?
ie this:
select concat(lastname, ', ', firstname) people;
faster/slower/no difference this:
<?php $query = 'select lastname, firstname people'; ... $name = $data['lastname'] . ', ' . $data['firstname']; //or $name = sprintf("%s, %s", $data['lastname'], $data['firstname']); ?>
you're better off in cases doing filtering , data massaging sql engine versus on web server.
Comments
Post a Comment