Recommendations for denormalizing data from relational to non-relational databases

I am launching a website that is starting to go beyond simple performance and tuning. This is a PHP application with MySQL as a backend. MySQL is configured correctly and the code is optimized.

The fact is that I see that I can use some kind of denormalization to speed up the process.

Suppose you have a site similar to ebay or Amazon. You have products in your database with some information (seller, product buyers, city, state, etc.). It will be several tables in a relational database, and it is good to keep this way to make good queries. But, for example, for the home page, you can have one denormalized document (for example, in MongoDB). Maybe a collection with the latest products, denormalized, looks like this:

products = {
   {
      id:13,
      name:"Some product",
      city:"aCity",
      state:"aState",
      price:"10"
   },
   {
      id:123,
      name:"another product",
      city:"aCity",
      state:"aState",
      price:"10"
   }
}

That way, I could query this collection instead of the MySQL database (with all connections involved), and everything can become very fast.

Now, here is the question. When and how do you denormalize this data? For example, I can decide that I want to denormalize data when pasting.

, "create-product.php" ( ). " " mysql, Mongo.

, . cron, .

. ? ?

.

+5
1

- , , , , , , , .

, HTML- JSON, - , .

: " , ?". , 24 , . : 10 ? , , . , . , , . " " , , , " nunber 23 ", , , .

+4

All Articles