What are some disadvantages of storing html in a database to use?

Although it is very easy to do a search on this topic, it is not so easy to come to a conclusion. What are some disadvantages of storing html in a database to use?

+4
source share
3 answers

HTML is static and querying data from a database uses database resources; database resources, as a rule, belong to more limited systems with moderate or heavy use, so it makes sense not to store HTML in the database, but to place them in the file system, where it can be extracted without the use of critical resources.

+3
source

It depends on the use of HTML in the database. If this is the data that you only ever get as blob (this means you never / rarely request HTML content), I think this might be a good idea in some cases. Then the question is basically the same as "Should I store xyz files in my database?" And the answer to such questions depends on several things:

  • How big are the files? Will they be stored in the file system, but only their name / path in the database will be more efficient?
  • Do you need to replicate data to other servers? If this is the case, storing raw files in the database may be easier than in FS if you already have a DB synchronization infrastructure.
  • How is your request used? Are they more database or file system friendly?

Now, if you are talking about storing HTML data that you often request, this completely changes the game.

Any normalization of the Nazi database will tell you that you never do this. But there may be times when this is useful. For example, if you use some kind of full-text search engine, you might want this in the database β€” or in any form used by the full-text search engine.

+2
source

In its broadest sense, HTML is a document markup language and serves to structure the data in a document. A database, on the other hand, should contain raw data organized by its logical relationships. Documents use formatting and may present data redundantly, but true underlying data is always committed. Therefore, you should store the most direct raw data form that you can possibly extract and extract it in meaningful ways using both the query language itself and create suitable views for your purposes, as well as other output-specific data processing for generation documents.

Of course, you may need to cache the result of the output formatting operation, and you can also save the cache in the database. Of course, that’s good. But as regards the raw payload data, I would always go for the above.

+2
source

All Articles