Home > Backend Development > PHP Tutorial > db - Can php use file storage instead of databases such as mysql to improve performance when the site has a small amount of data?

db - Can php use file storage instead of databases such as mysql to improve performance when the site has a small amount of data?

WBOY
Release: 2016-08-08 09:06:54
Original
1007 people have browsed it

, what are the disadvantages of doing this? Is there anything I need to pay attention to?

Reply content:

, what are the disadvantages of doing this? Is there anything I need to pay attention to?

I haven’t heard of anyone doing this. If you want fast and simple performance, why not use redis? Databases are files after all, and memory is much faster than files, right?

Depending on the I/O speed of your server disk, if the application and database server are the same, there is no need, why give up the advantages of the relational database. Of course, if the amount of data is really small, you can actually use xml or json to store the data.

One of the great advantages of sql is its relevance.

If there are two sets of related data and you want to query and assemble the results at the same time, then SQL join can do it.
But if it is file storage, you have to read the entire file and write the associated query statement yourself.
The same applies when writing new data. You have to write the concepts of updating, inserting, and deleting yourself.

But if the requirement is very simple, such as a static menu, then just use json to get it done, no pressure. My personal website menu is a json responsible for saving menu data, and a php responsible for rendering html. For such a simple requirement, using mysql is overkill and can be solved with one file.

It depends on your needs.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template