Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-11522

Ignite index in not working in a specific case

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.7
    • Fix Version/s: None
    • Component/s: general
    • Labels:
    • Environment:

      Red Hat Linux

      Description

      Below query is getting frequently fired:

      SELECT *
      FROM TABLE_A __Z0
      WHERE (__Z0.COL_A IN ('DL', 'A'))
      AND ((__Z0.COL_B IN('100001-W060', '100001-W060'))
      AND ((__Z0.COL_C IN('HD', 'ED'))
      AND ((__Z0.COL_D = '1')
      AND ((__Z0.COL_E = '1')
      AND (__Z0.COL_F = '1')))))

       

      Below Index when created on this table is not working:

      CREATE INDEX CUST_INDEX1
      ON TABLE_A
      (COL_A ASC, COL_B ASC, COL_C ASC, COL_D ASC, COL_E ASC, COL_F ASC);

       

      Below index is working perfectly fine:

      CREATE INDEX CUST_INDEX1
      ON TABLE_A
      (COL_D ASC, COL_A ASC, COL_B ASC, COL_C ASC, COL_E ASC, COL_F ASC);

       

      This is just a change in the ordering. While the first Index is in the same order as the attributes in the where clause and therefore should have worked, second one is just in a random order.

      On further analysis, it appears that Index doesn't apply if the first column of the Index is not an IN clause having multiple values in the Select statement.

      In the second create index statement, COL_D is the first column which is not an IN with multiple values in the select clause and hence this is working fine.

      It means, if the first column COL_A has only one value 'DL' then it works, but if it has two values, 'DL' and 'A', the Index doesn't get applied.

      This isn't the expected behaviour.

      Index should work for both the CREATE INDEX queries, irrespective of number of values in IN clause.

      Additional info: If the select query tries to fetch only those columns which are part of the Index, then both the index above work fine.

      For example:

      Both Index work for below query:

      SELECT __Z0.COL_A 
      FROM TABLE_A __Z0
      WHERE (__Z0.COL_A IN ('DL', 'A'))
      AND ((__Z0.COL_B IN('100001-W060', '100001-W060'))
      AND ((__Z0.COL_C IN('HD', 'ED'))
      AND ((__Z0.COL_D = '1')
      AND ((__Z0.COL_E = '1')
      AND (__Z0.COL_F = '1')))))

      But the first index doesn't work for the below query (COL_Z is not a part of Index):

      SELECT __Z0.COL_Z 
      FROM TABLE_A __Z0
      WHERE (__Z0.COL_A IN ('DL', 'A'))
      AND ((__Z0.COL_B IN('100001-W060', '100001-W060'))
      AND ((__Z0.COL_C IN('HD', 'ED'))
      AND ((__Z0.COL_D = '1')
      AND ((__Z0.COL_E = '1')
      AND (__Z0.COL_F = '1')))))

       

       

       

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mausamiiit Mausam
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: