Question

I have four tables as:

ProductAttribute            - Stored Product Attribute (Color, Size, etc.)
ProductAttributeValue       - Stored Product Attribute Value (Green, 10, etc.) 
MapProductAttributeValue    - Stored relation between Product Attribute and its Values (COlor-Green, COlor-Blue)
MapProductAndAttributeValue - Stored relation between Product table and MapProductAttributeValue table

How can I denormalize this schema MySQL? i do not want to go for NOSQL. i want to use RDBMS approach only or can i have some different storage mechanism?

No correct solution

OTHER TIPS

Well, you don't explain the problem you have in details, but as it is most likely performance related, there are some options without going to NoSQL or rather NewSQL.

It seems like you have some kind of a product database "with flavors", and modern systems should be able to handle HUGE product trees with normalized DB, provided that the application is a good citizen.

Before going to denormalizing the database, I say something, that you may have done already, but as your question does not have those details in place, just in case I add some things to be considered:

  • Your problem is most likely an io-bottleneck. Can you give any details of distribution of IO over different spindles? As performance impact from io-bootleneck (or maybe memory, which is even worse) as primary bottleneck is exponential instead of linear, off-loading and/or distributing the IO is first thing to check.
  • Have you analyzed the io-profile in details? Are you using "plain" MySQL or InnoDB?
  • Optimize the RAM use to cache the database. What is the size of DB? Few gigabytes of memory is cheap and buys you time to truly understand the challenge. Remember: Locality is a challenge, if your demand exceeds the resource (io/RAM) by 10% you might get a performance penalty of 90%. By solving the primary and secondary bottlenecks AND setting right parameters for your RDBMS, you may see a HUGE difference.
  • If none of above works, consider using SQL compliant IMDB (in-memory database) which most have quite sophisticated algorithms to optimize the "hot spots" of data.

Only if you have done/considered all of above I would go to denormalizing the database, unless it is brain dead from a beginning ;-)

So in short: Monitor the system, collect the evidence where the bottleneck is and then solve the true problem, what ever it might be.

cheers, //Jari

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top