Question

assume we have 1 Billion records and want to store them in One or Three tables by post_type.

post_id   -> primary key  
post_type -> ( page, group, user )
user_id   -> index
date      -> index

Note: we have enough RAM to store all data in buffer pool. ( about 40 GB )
In our situation, Reading from database is too much

the question is: WHILE the whole data is ON buffer pool ( RAM ), is there any difference in performance to have 3 separated tables and Join them, or have 1 big table and Select from it without any Join.

In some cases it's better for us to have separated tables for other kind of light queries.
But we fear of JOINS.

Was it helpful?

Solution

I found the below article on large joins in sql server. Going by the information in this article one very large table would likely be faster than joining three large tables. However, this is from 2006, so some of the information could be outdated.

http://www.mysqlperformanceblog.com/2006/06/09/why-mysql-could-be-slow-with-large-tables/

Edit: It is also worth noting that you should look at the frequency that you will use each operation. If you will be need to join the tables frequently, then you may want to use one table. If you will be joining the tables less frequently you may want to use three tables.

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