Subject | No index used for join on 'starting with' |
---|---|
Author | Rick Debay |
Post date | 2012-04-06T21:17:57Z |
This query uses natural for both tables, when I expected it to use an
index for the join.
select *
from table1 t1
join table2 t2 on t2.indexed_char14 starting with t.indexed_char10
where t.unindex_varchar containing 'foo'
This uses an index, so the optimizer knows about it.
select *
from table2 t2
where t2.indexed_char14 starting with 'bar'
How can I get the optimizer to use the index for the join?
Disclaimer: This message (including attachments) is confidential and may be privileged. If you have received it by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change. RxStrategies, Inc. shall not be liable for the improper or incomplete transmission of the information contained in this communication or for any delay in its receipt or damage to your system. RxStrategies, Inc. does not guarantee that the integrity of this communication has been maintained nor that this communication is free from viruses, interceptions or interference.
index for the join.
select *
from table1 t1
join table2 t2 on t2.indexed_char14 starting with t.indexed_char10
where t.unindex_varchar containing 'foo'
This uses an index, so the optimizer knows about it.
select *
from table2 t2
where t2.indexed_char14 starting with 'bar'
How can I get the optimizer to use the index for the join?
Disclaimer: This message (including attachments) is confidential and may be privileged. If you have received it by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change. RxStrategies, Inc. shall not be liable for the improper or incomplete transmission of the information contained in this communication or for any delay in its receipt or damage to your system. RxStrategies, Inc. does not guarantee that the integrity of this communication has been maintained nor that this communication is free from viruses, interceptions or interference.