For example, what I have seen and known so far is to stop using Mysql’s own functions in SQL statements and use PHP’s functions, but my heart has been unconvinced by this statement. If so, what is the significance of mysql’s own functions?
What’s wrong with mysql’s own functions?
1. It is likely that the conditions after where cannot be indexed.
2. Giving mysql some php-level simple business logic to do increases mysql’s pressure (although you may think that executing a sql statement has little impact), which is not important for small systems. For large systems, it would be a disaster. The bottleneck of large-scale systems is basically difficult to expand at the database level. php is easy to expand horizontally. php will not be the bottleneck. Therefore, reduce the processing pressure of the database as much as possible, including reducing the number of queries to be solved through cache, reducing the time of each query to be processed at the php level through indexing and as much business as possible. mysql only does the most basic and simple queries and uses less self-contained functions.
Why do mysql’s own functions exist?
1. For example, some data initialization is available, or stored procedures, etc. ..
2. Small systems can use mysql’s own functions. There is no bottleneck anyway
3. It is not allowed that large-scale systems do not recommend using self-contained functions for queries, because common requirements are taken into account.
For example, ORM design in PHPFrame is very resource-intensive and slow. Large-scale systems are not recommended. Small systems are used casually, which is convenient and fast.
The conclusion is that we can’t not provide some scenes just because they are not recommended … the price of convenience and speed is performance.
The above is purely personal …