(1)oracle查询表上建立的索引:
select *
from ALL_INDEXESwhere TABLE_NAME='T_ADDRESS_FORMMAL';
(2)建立完表之后,需要注意按照相应的查询条件建立索引
select ID
from t_address_formal taf
WHERE taf.PROVINCE = '上海'
and taf.CITY = '上海市'
and taf.COUNTY = '青浦区'
and taf.ADDRESS = '徐泾镇明珠路1018号'
and taf.entertype = '3'
select distinct tc.bd_lng baiduLng, tc.bd_lat baiduLat
from t_address_formal tf, t_cordinate_baidu tc
where tc.id = tf.id
and tc.is_succed = '1'
and tf.PROVINCE = '上海'
and tf.CITY = '上海市'
and tf.COUNTY = '青浦区'
and tf.ADDRESS = '徐泾镇明珠路1018号'
(3)建立索引:
create index idx_address_formal on t_address_formal(province,city,county,address,entertype)
create unique index idx_address_key on t_address_formal(id)
(4)构造大批量的数据,查询性能
(5)查看sql的执行计划,是否走了索引,或者全表扫描,或者根据执行计划优化sql语句.