Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Why don't you try to force the indexes or you can choose to accept the full scan...but can help it along with a PARALLEL HINT. In some cases it's quite good. Full table scans are not necessarily a bad thing. I have seen situations where indexes have performed worse.
Looking for the greatest evil in the world? Look in the mirror.
As far as I can see you have test data in your production database... bad mojo but, not the first time I see something like this.
You can either delete those test rows or filtering them out; since I do not know your environment I would filter them out after the query completes meaning, run your query as if all your data is valid and then filter it.
You can accomplish this by enveloping your query into an outer filter query, something like:
Code:
select pern,
regs,
regt
from
(
SELECT rp.person_nr "pern",
rp.regimen_sequence "regs",
rp.regimen_type_code "regt",
p.email "mail"
FROM REGIMEN_PRES rp,
PERSON p
WHERE regimen_type_code = 'CD'
AND prescription_status_code= 'FNSH'
AND rp.person_nr = p.person_nr
-- and p.email not like '%test%'
...
...
...
)
where email not like '%test%'
ORDER BY pern;
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
I gave only timing and trace output of that statement.
before creating comp.index i took timing with trace for that query(i ran that query twice same time returns,since it may vary due to buffer cache),then after creating index i ran that same query.I saw a big difference in timing.
Bookmarks