Feedback
Did this article resolve your question/issue?

   

Article

Incorrect index used when executing a SELECT with HINT INDEX functionality in Openaccess 8.1.

Information

 
TitleIncorrect index used when executing a SELECT with HINT INDEX functionality in Openaccess 8.1.
URL NameIncorrect-index-used-when-executing-a-SELECT-with-HINT-INDEX-functionality-in-Openaccess-8-1
Article Number000178340
EnvironmentProduct: Openaccess SDK
Version: 8.1 build 0049
OS: Windows
Database: All supported databases
Application: All supported applications
Question/Problem Description
When executing a SELECT statement with HINT INDEX functionality in Openaccess 8.1, the incorrect index is used.
Steps to Reproduce
Clarifying Information
Index information of involved table :

ISQL> SELECT * FROM OA_STATISTICS WHERE TABLE_NAME='PORTFOLIOGROUP';

TABLE_QUALIFIER TABLE_OWNER TABLE_NAME NON_UNIQUE INDEX_QUALIFIER INDEX_NAME OA_TYPE SEQ_IN_INDEX COLUMN_NAME OA_COLLATION
OA_CARDINALITY OA_PAGES FILTER_CONDITIONS

SCHEMA OAUSER PORTFOLIOGROUP 0 NULL 0 1 1 FundCode A NULL NULL
SCHEMA OAUSER PORTFOLIOGROUP 0 NULL 0 1 2 PortfolioCode A NULL NULL
SCHEMA OAUSER PORTFOLIOGROUP 0 NULL 0 1 3 Code A NULL NULL
SCHEMA OAUSER PORTFOLIOGROUP 0 NULL 1 1 1 FundCode A NULL NULL
SCHEMA OAUSER PORTFOLIOGROUP 0 NULL 1 1 2 Code A NULL NULL
SCHEMA OAUSER PORTFOLIOGROUP 0 NULL 1 1 3 PortfolioCode A NULL NULL
SCHEMA OAUSER PORTFOLIOGROUP 0 NULL 2 1 1 GroupHoldsTrans A NULL NULL
SCHEMA OAUSER PORTFOLIOGROUP 0 NULL 2 1 2 FundCode A NULL NULL
SCHEMA OAUSER PORTFOLIOGROUP 0 NULL 2 1 3 PortfolioCode A NULL NULL
SCHEMA OAUSER PORTFOLIOGROUP 0 NULL 2 1 4 Code A NULL NULL


Query using hint index(2):
SELECT * FROM PORTFOLIOGROUP WHERE fundcode='01' and PortfolioCode='CSF' AND Code='01' HINT INDEX(PORTFOLIOGROUP."2")

Clarification:
First column on index(2) is GroupHoldsTrans (SEQ_IN_INDEX is 1) and not available in the given WHERE condition.
This results in falling back to the default behavior which is index(0) being used.

 
Error Message
Defect Number
Enhancement Number
Cause
The column in the WHERE condition is not available in the hinted INDEX.
Resolution
This is expected behavior.
 
Workaround
Notes
If there is *no* INDEX available which has a column from the WHERE clause defined as the first column (SEQ_IN_INDEX is 1), no INDEX is being used.

E.g. :

Following Select doesn't use an INDEX in above sample :
select * FROM PORTFOLIOGROUP WHERE PortfolioCode='CSF' and Code='01' 
Last Modified Date11/15/2016 8:42 AM
Files
Disclaimer The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.