sql - Database vs. Front-End for Output Formatting -
I've read that (all things are the same) PHP is usually faster than MySQL in the operation of math and string manipulation. This is the case, where does one say to create a versus vs. database created by a web server (s)? We use stored procedures specifically as our Data-Access Layer. My unwritten rules have always been to leave the output formatting (string manipulation and arithmetic) on the web server, so our query returns:
- The following dates
- Zero value < / Li>
- There is no calculated value (i.e. return value for the column "foo" and "bar" column to the web server to calculate foo * times, if it needs to display the value for the forefront)
- No substring-less fields (except when small f Land is so importantly small that we want to reduce the result at the database level size)
- Give output to two separate columns according to the need of front-end case
This is the opinion that I am interested in this, it is generally a proper approach, or if others are aware of the forced performance / maintenance capability which is to push these activities into the database Au Ity proves. Note: I intentionally tag this question to be DBMS-anarchist, because I believe this is an architectural idea that comes in play without regard to any particular DBMS.
How can I move some layers in place for other implementations It is very likely that you can Will not use a separate RDBMS or mobile version of your site, but you never know.
There is a more orthogonal data point, the closer it should be to the database, in that form if your price A and B is given A * B on every theoretical version of your site, Should be returned as B and the client side will never be counted.
Let's say you have something that format is as heavy as a date. Sometimes you have to short dates, long dates, English dates ... a pure form should be returned from the database and then PHP should be formatted.
Then the orthogonality point works in reverse too. The more dynamic data point is in its representation / display, and it should be handled with the client side. If a string is always taken as the sub-substring of the first six characters, then it is returned from the database in the form of a pre-Austring 'aid. If the length of the substrings depends on some factors, such as six for mobile and ten for your web app, then return a large string from the database and format it on run time using PHP.
Comments
Post a Comment