Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6153327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:04:35+00:00 2026-05-23T20:04:35+00:00

Why does IR1 need a full scan? table=INTR alias=IR1 access=FULL SCAN IR2 did not

  • 0

Why does IR1 need a full scan?

table=INTR
alias=IR1
access=FULL SCAN

IR2 did not need a full scan:

table=INTR
alias=IR2
access=INDEX PRED

It is the exact same join:

EXPLAIN PLAN FOR SELECT *
FROM DTMS.INTR_SUB s
JOIN DTMS.INTR ir1 ON s.CLASS_1 = ir1.CLASS
JOIN DTMS.NDC_INDEX n1 ON ir1.KDC1 = n1.KDC1 
JOIN DTMS.INTR ir2 ON s.CLASS_2 = ir2.CLASS
JOIN DTMS.NDC_INDEX n2 ON ir2.KDC1 = n2.KDC1 
WHERE n1.NDC = 378204701 AND n2.NDC = 378204701

Here are my indexes:

 s INDEX 1 CLASS_1
 s INDEX 2 CLASS_2
 ir PRIMARY KEY(KDC1,CLASS)
 ir INDEX (CLASS)

If I disable the index on s.CLASS_1 (by adding 0),
HSQL decides that it can use the same index for IR1
and IR2.

 alias=S
 access=FULL SCAN

 table=INTR
 alias=IR2
 access=INDEX PRED

 table=INTR
 alias=IR1
 access=INDEX PRED

 EXPLAIN PLAN FOR SELECT *
 FROM DTMS.INTR_SUB s
 JOIN DTMS.INTR ir1 ON s.CLASS_1+0 = ir1.CLASS
 JOIN DTMS.NDC_INDEX n1 ON ir1.KDC1 = n1.KDC1 
 JOIN DTMS.INTR ir2 ON s.CLASS_2 = ir2.CLASS
 JOIN DTMS.NDC_INDEX n2 ON ir2.KDC1 = n2.KDC1 
 WHERE n1.NDC = 378204701 AND n2.NDC = 378204701

This is the schema. In the Database Manager, I had to copy/paste
the three create tables separately to make the tables:

 CREATE SCHEMA DTMS AUTHORIZATION SA;

 SET SCHEMA DTMS;

 CREATE CACHED TABLE DTMS.INTR(KDC1 NUMERIC(5) NOT NULL,CLASS NUMERIC(5) NOT NULL,PRIMARY KEY(KDC1,CLASS));

 CREATE CACHED TABLE DTMS.NDC_INDEX(NDC NUMERIC(11) PRIMARY KEY,KDC1 NUMERIC(5) NOT NULL,KDC2 NUMERIC(2) NOT NULL,KDC3 NUMERIC(3) NOT NULL,ACTIVITY_CODE NUMERIC(1) NOT NULL,ROUTE_ABRV CHARACTER(2) NOT NULL);

 CREATE CACHED TABLE DTMS.INTR_SUB(CLASS_1 NUMERIC(5) NOT NULL,DURATION_1 NUMERIC(3) NOT NULL,SCHEDULE_1 NUMERIC(3) NOT NULL,ACTIVITY_CODE_1 NUMERIC(1) NOT NULL,CLASS_2 NUMERIC(5) NOT NULL,DURATION_2 NUMERIC(3) NOT NULL,SCHEDULE_2 NUMERIC(3) NOT NULL,ACTIVITY_CODE_2 NUMERIC(1) NOT NULL,ONSET_CODE NUMERIC(1) NOT NULL,SEVERITY_CODE NUMERIC(1) NOT NULL,DOC_CODE NUMERIC(1) NOT NULL,MGMT_CODE NUMERIC(1) NOT NULL,FILE_POS NUMERIC(15) NOT NULL);

 CREATE INDEX INTR_SUB_CLASS_1 ON DTMS.INTR_SUB(CLASS_1);
 CREATE INDEX INTR_SUB_CLASS_2 ON DTMS.INTR_SUB(CLASS_2);
 CREATE INDEX INTR_CLASS ON DTMS.INTR(CLASS);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:04:36+00:00Added an answer on May 23, 2026 at 8:04 pm

    This issue has been fixed in 2.2.5 which reports the following.

      ][range variable 2                                 
      join type=INNER                                    
      table=INTR                                         
      alias=IR1                                          
      access=INDEX PRED                                  
    
      ][range variable 4                                 
      join type=INNER                                    
      table=INTR                                         
      alias=IR2                                          
      access=INDEX PRED        
    

    Regarding the use of DatabaseManager, you can define a whole schema, together with its tables and indexes as a single SQL statement. A semicolon is used only at the end. This statement is executed fully by DatabaseManager because it is a single CREATE SCHEMA statement in SQL:

    CREATE SCHEMA DTMS AUTHORIZATION SA
     CREATE CACHED TABLE DTMS.INTR(KDC1 NUMERIC(5) NOT NULL,CLASS NUMERIC(5) NOT NULL,PRIMARY KEY(KDC1,CLASS))
     CREATE CACHED TABLE DTMS.NDC_INDEX(NDC NUMERIC(11) PRIMARY KEY,KDC1 NUMERIC(5) NOT NULL,KDC2 NUMERIC(2) NOT NULL,KDC3 NUMERIC(3) NOT NULL,ACTIVITY_CODE NUMERIC(1) NOT NULL,ROUTE_ABRV CHARACTER(2) NOT NULL)
     CREATE CACHED TABLE DTMS.INTR_SUB(CLASS_1 NUMERIC(5) NOT NULL,DURATION_1 NUMERIC(3) NOT NULL,SCHEDULE_1 NUMERIC(3) NOT NULL,ACTIVITY_CODE_1 NUMERIC(1) NOT NULL,CLASS_2 NUMERIC(5) NOT NULL,DURATION_2 NUMERIC(3) NOT NULL,SCHEDULE_2 NUMERIC(3) NOT NULL,ACTIVITY_CODE_2 NUMERIC(1) NOT NULL,ONSET_CODE NUMERIC(1) NOT NULL,SEVERITY_CODE NUMERIC(1) NOT NULL,DOC_CODE NUMERIC(1) NOT NULL,MGMT_CODE NUMERIC(1) NOT NULL,FILE_POS NUMERIC(15) NOT NULL)
     CREATE INDEX INTR_SUB_CLASS_1 ON DTMS.INTR_SUB(CLASS_1)
     CREATE INDEX INTR_SUB_CLASS_2 ON DTMS.INTR_SUB(CLASS_2)
     CREATE INDEX INTR_CLASS ON DTMS.INTR(CLASS);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know how I can directly access a function from a PHP class
Does $this->db->insert_batch(); insert with 1 table connection or does it insert each row separately
The curl Command is working on one server and does not work on other.
Does any one know why this is not working? http://jsfiddle.net/jonevar/2Z2NQ/5/ Here is the whole
Does Google force employees who have offers from Facebook to leave immediately?
Does anyone remember the XMP tag? What was it used for and why was
Does the Java language have delegate features, similar to how C# has support for
Does anybody know any good resources for learning how to program CIL with in-depth
Does anyone know how to get IntelliSense to work reliably when working in C/C++
Does anyone have any recommendations of tools that can be of assistance with moving

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.