Hi,

I have gone through this link
<https://apacheignite-sql.readme.io/docs/schema-and-indexes#section-group-indexes>,
but still have some doubts.

Please check the following example.

public class TestData
  @QuerySqlField
  private long id;
  @QuerySqlField(orderedGroups = {@QuerySqlField.Group(name = "data_idx1",
*order* = 1)})
  private long field1;
  @QuerySqlField(orderedGroups = {@QuerySqlField.Group(name = "data_idx1",
*order* = 4)})
  private int field2;
  @QuerySqlField(orderedGroups = {@QuerySqlField.Group(name = "data_idx1",
*order* = 2)})
  private int field3;

1) In this code I have created a group index on field1, field2 and field3.
field1 has order=1.
Does it mean that the rows will be sorted on first on *field1*(order=1) and
then *field3*(order=2) and then *field2*(order=4) ?
I am just trying to understand the significance of "ORDER".

2) Keeping the indexes as above, Will ignite be able to use the indexes in
following cases :
Please explain why if the ignite is not able to use the indexes.

I am trying to understand how ignite decides if it can use a index or not?

a) select * from TestData where field1 = ?

b) select * from  TestData where field1 = ? and field2 = ?

c) select * from  TestData where field2 = ?

d) select * from  TestData where field3 = ?

e) select * from  TestData where field2 = ? and field3 = ?

3) Should the columns in where clause be in order in which the group
indexes are defined to make use of indexes?


Prasad

Reply via email to