where
子句和order by
子句不同,Oracle没有识别索引
INNER JOIN ORG_ACCOUNTING_PERIODS p
ON p.ORG_ROADMARK = c.ORG_ROADMARK
AND p.ACCOUNTING_PERIOD = c.SERVICE_PERIOD
where ( c.ORG_ROADMARK =:roadMark )
and c.ORG_ROADMARK = c.move_road
ORDER BY EVENT_DATETIME;
答案 0 :(得分:0)
当按顺序使用索引和顺序时,应该是where子句的子集,因为索引直接应用于where子句。
所以添加--->
INNER JOIN ORG_ACCOUNTING_PERIODS p ON p.ORG_ROADMARK = c.ORG_ROADMARK AND p.ACCOUNTING_PERIOD = c.SERVICE_PERIOD
where ( c.ORG_ROADMARK =:roadMark )
and c.ORG_ROADMARK = c.move_road
and c.EVENT_DATETIME between :eventFrom AND :eventTo
ORDER BY EVENT_DATETIME ;
create index --> `CREATE INDEX "CARHIRE_EVENTS_IX" ON "CARHIRE_EVENTS" ("EVENT_DATETIME", "MOVE_ROAD", "ORG_ROADMARK") ;`