关于oracle调优
时间:2021-07-01 10:21:17
帮助过:19人阅读
u.*,t.*
(select sum(l.all_pl2) from TABLE_A l where 1 = 1 and l.tx_dt <= ‘20201223‘ and u.investor_id = l.investor_id) as sum_all_pl2 from TABLE_C u inner join (select t2.* from (select t.* rank() over(partition by investor_id order by tx_dt desc) rowno from TABLE_B t where t.tx_dt <= ‘20201223‘) t2 where 1 = 1 and t2.rowno = 1) t3 on u.investor_id = t3.investor_id where 1 = 1order by HEX(CONVERT( a.create_date USING GBK ))
select count(1) from TABLE_A;--结果集1104207select count(1)from TABLE_B;--结果集72571.查看表是否有索引,为关联字段添加索引
create index idx_tablieatxdtinvid on TABLE_A (INVESTOR_ID, TX_DT);create index idx_tablieatxdt on TABLE_A (TX_DT);create index idx_tablieainvid on TABLE_A (INVESTOR_ID);2.表字段的索引主要针对数值型的varchar2或者number有效。3.排序字段最好使用数值的varchar2或者number。尽量不使用非数字排序(yyyy-dd-mm,uuid,中英文等)4.关联字段的类型最好统一,尽量不要用varchar2和number关联(varchar2的数值和number字段关联,减少oracle的隐式转换)5.主键可以使用封装的
@getNextSequence方法获取
来自为知笔记(Wiz)
关于oracle调优
标签:where count 数值 获取 div 数字 mono sequence 场景