【发布时间】:2018-01-31 11:56:58
【问题描述】:
我想为 Oracle 应用程序表创建以下索引。
create index xxhr_api_transactions_idx1 on hr.hr_api_transactions (status, process_name, nvl(selected_person_id, -1)) compress 3
该表总共有 62421 行。状态列中有 10 个不同的值。 process_name 列中有 23 个不同的值。 selected_person_id 列中有 17419 个不同的值。 selected_person_id 列仅存在 43530 个值,其余为空(该人尚不存在的新员工工作流程)。
我的查询是这样的:
select *
from hr.hr_api_transactions psth
where psth.process_name in ('TFG_HR_NEW_HIRE_PLACE_JSP_PRC', 'HR_NEW_HIRE_PLACE_JSP_PRC', 'HR_NEWHIRE_JSP_PRC') -- TFG specific.
--and nvl(psth.selected_person_id, -1) in (:p_person_id, -1) -- 1118634
and psth.status not in ('W', 'S') -- Work in Progress, Saved For Later.
我的问题是我应该使用压缩 3 还是压缩 2?将selected_person_id 列与其总共62421 个中的17419 个不同值压缩(以及18891 个空值呢)是否更好?
【问题讨论】: