Sharding - Java backend code implementation and best practices after database sharding and table cutting
过去多啦不再A梦
过去多啦不再A梦 2017-06-23 09:12:49
0
5
821

In the current business, as some tables are getting larger and larger, the pressure is very high when reading (the demand for writing is relatively small), so on the database side, we decided to cut some tables with particularly large amounts of data, but in the back-end code There are a lot of codes/queries that need to be joined to these tables. How do you solve this situation?

For example, we now have a SampleTable with about 100 million pieces of data. We have divided it into about 16 different tables based on logic: SampleTable 1, SampleTable2...SampleTable31,
There was a query in the previous code, which was similar to:

select * from  SampleTable join test_table

Do we need to execute this query multiple times and aggregate the data as the return result?

select * from  SampleTable1 join test_table

Is there a better method or library recommendation? Is there any beset practice or sample code?

If we want to split multiple tables into different database servers later, do we need to add database connections for different DBs in the back-end code?

The basic idea and sharding strategy of database Sharding
This article is more about the strategy of database sharding. Can anyone provide an actual project code sample?
Database sharding and JPA
what -to-do-instead-of-sql-joins-while-scaling-horizontally

Some answers on stackoverflow

过去多啦不再A梦
过去多啦不再A梦

reply all(5)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!