![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, Thank you for your responses, so far. I have since found out the query used would return no records. select /*+ INDEX (MESSAGE_DETAILS EXP_MSG_STATUS_IDX) */ count(1) from message_details where expected_message_status = 4; I then asked the developer to pick something that does exist and the result was the same the query ignored the Hint (in the Explain Plan). SELECT STATEMENT Optimizer Mode=CHOOSE 1 1497 SORT AGGREGATE 1 1 TABLE ACCESS FULL AUSDEV.MESSAGE_DETAILS 321 K 314 K 1497 The table has 386831 - expected_message_status code 3 records and 172 expected_message_status code 5 messages. Cheers Craig. |
|
Id | Operation | Name | Rows | Bytes | Cost | ------------------------------------------------------------------------- 0 | SELECT STATEMENT | | 1 | 3 | 2 | 1 | SORT AGGREGATE | | 1 | 3 | | * 2 | TABLE ACCESS FULL | MESSAGE_DETAILS | 1 | 3 | 2 | ------------------------------------------------------------------------- |
#3
| |||
| |||
|
| Maybe your table has the status defined as a string and you are storing numbers in strings. And this is causing a conversion at runtime. |
#4
| |||
| |||
|
|
Thomas Kyte wrote: Maybe your table has the status defined as a string and you are storing numbers in strings. And this is causing a conversion at runtime. BINGO !!!! The lookup status is a VARCHAR2, apparently the developers are following a standard that a third party used. Changed the query from SELECT /*+ INDEX (MESSAGE_DETAILS EXP_MSG_STATUS_IDX) */ * FROM MESSAGE_DETAILS WHERE expected_message_status = 11; SELECT /*+ INDEX (MESSAGE_DETAILS EXP_MSG_STATUS_IDX) */ * FROM MESSAGE_DETAILS WHERE expected_message_status = TO_CHAR('11'); Thank you very much Thomas. Craig. |
#5
| |||
| |||
|
|
select * from message_details where expected_Message_status = '11' is what you are looking for though, no hint, no redundant to_char() |
![]() |
| Thread Tools | |
| Display Modes | |
| |