使用executorservice计算mysql表的sum()

qjp7pelc  于 2021-06-21  发布在  Mysql
关注(0)|答案(0)|浏览(208)

我有一个包含大量行的mysql表。我有一个查询,计算每一列的sum()。我用极限偏移量来分开。我需要使用javaexecutorservice线程池并行处理这些部分。最后,从每个部分得到所有的和值,并为每个列加上它们。
让select语句像这样。

select sum(principal_amount) as total_principal_amount, sum(interest_amount) as total_interest_amount from X limit 1000 offset 0.

select sum(principal_amount) as total_principal_amount, sum(interest_amount) as total_interest_amount from X limit 1000 offset 1000.

select sum(principal_amount) as total_principal_amount, sum(interest_amount) as total_interest_amount from X limit 1000 offset 2000.

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题