摘要:
公司生产上面有一张表,里面数据有:3486764条,每次想去查询最新的几条数据时总是很慢,以下为使用的语句:select * from txn_fin_txn_log t order by t.id desc;因为有order by语句会很慢,查询出来将近1分钟才能出来,有时候更长经过脑海里想了之后,记得以前有位大师(具体记不清是哪位大师)有过一个案例,他对大数据查询时,先将其中最大的主键id查询出来,再做进一步处理,以下为我写的的sql:select * from txn_fin_txn_log t where t.id > ( select max(s.id) - 1000000 f 阅读全文
摘要:
1.A catch statement should never catch throwable since it includes errors. 在catch里永远不要抛出throwable。 Explain:Catching Throwable errors is not recommended since its scope is very broad. It includes runtime issues such asOutOfMemoryError that should be exposed and managed separately.在catch里抛出Throwable里. 阅读全文