Closed aaa930811 closed 1 year ago
时间列加索引了吗
跨月查询肯定是会慢些的
你这个DEMO分页还是很快的
比如你有1亿数据分了100个表,你查2个表肯定 查询一个表中有1亿数据的快
你这种2万数据分表没什么意义
时间列加索引了吗
看上面的model,加过了的
你这种2万数据分表没什么意义
这只是一个测试,实际我的单表有3700W数据,性能下降更明显了
比如你有1亿数据分了100个表,你查2个表肯定 查询一个表中有1亿数据的快
但是我实际发现比查单表慢诶
比如你有1亿数据分了100个表,你查2个表肯定 查询一个表中有1亿数据的快
但是我实际发现比查单表慢诶
如果要查询的数据恰好只在其中的一个分表中那么确实是比单表查询快很多,但是实际情况几乎肯定会跨多个分表查询的
那就要合适分表,比如按年
还有mysql不要查询count
where写到splitable前面
那就要合适分表,比如按年
那比如我要查询2022-12-01到2023-01-31的数据,那还是跨表了呀
目前是没办法的,跨2个表性能还可以的。只能接受就行
Mysql跨表性能是差些,不过只要不跨太多还是可以的。 在非跨库查询、更新、删除、插入性能都有质的提升
根据时间列分表之后,如果查询时间段的数据分散在2个及以上的表中的时候查询性能比单表查询慢很多,想问问是我查询方法不对吗? ···
[MemoryDiagnoser, RankColumn] public class SqlSugarTestBenchmarker { private static string connstr = "Server=localhost;Port=3306;Database=SqlSugarTestDB;Uid=sa;Password=123456;Convert Zero Datetime=True;SslMode=none;AllowLoadLocalInfile=true;";
···