afedotov,

    As you say ,you removed JPA related annotations.
    How to removed?


    I try as your suggestion, I found if I build a new entity class and use 
cache.query() ,it will take the index, but still not take the index with JDBC 
thin mode.
    
    What did I miss?


    Thanks.







At 2017-12-04 22:27:40, "afedotov" <[email protected]> wrote:
>Hi,
>
>Not sure, what's wrong with your code.
>Either IX_T_BD_StatusFid or IX_T_BD_CUSTOMER should have been taken.
>
>I removed JPA related annotations and checked your code, it gave me the
>following plan:
>[[SELECT
>    __Z0.FID AS __C0_0,
>    __Z0.FNUMBER AS __C0_1
>FROM "customerCache".CUSTOMERIGNITEINFO __Z0
>    /* "customerCache".IX_T_BD_STATUSFID: FUSEDSTATUS = 3 */
>WHERE __Z0.FUSEDSTATUS = 3], [SELECT
>    __C0_0 AS FID,
>    __C0_1 AS FNUMBER
>FROM PUBLIC.__T0
>    /* "customerCache"."merge_scan" */]]
>
>As you can see IX_T_BD_STATUSFID index was used.
>
>I used the following code to check the case. Could you check it on your
>side?
>
>public class GroupIndexes1Main {
>
>    public static class CustomerIgniteInfo implements Serializable {
>        private static final long serialVersionUID = -8065741098718964203L;
>
>        @QuerySqlField(index = true, orderedGroups={@QuerySqlField.Group(
>            name = "IX_T_BD_StatusFid", order = 1)})
>        private String FID;
>
>        @QuerySqlField( orderedGroups={@QuerySqlField.Group(
>            name = "IX_T_BD_StatusFid", order = 2)})
>        private String FNUMBER;
>
>        @QuerySqlField(orderedGroups={@QuerySqlField.Group(
>            name = "IX_T_BD_CUSTOMER", order = 1),@QuerySqlField.Group(
>            name = "IX_T_BD_StatusFid", order = 0)})
>        private Integer FUSEDSTATUS;
>
>        public CustomerIgniteInfo() {
>        }
>
>        public CustomerIgniteInfo(String FID, String FNUMBER, Integer
>FUSEDSTATUS) {
>            this.FID = FID;
>            this.FNUMBER = FNUMBER;
>            this.FUSEDSTATUS = FUSEDSTATUS;
>        }
>
>        public String getFID() {
>            return FID;
>        }
>        public void setFID(String id) {
>            this.FID = id;
>        }
>
>        public String getFNUMBER() {
>            return FNUMBER;
>        }
>
>        public void setFNUMBER(String fNUMBER) {
>            FNUMBER = fNUMBER;
>        }
>
>        public Integer getFUSEDSTATUS() {
>            return FUSEDSTATUS;
>        }
>
>        public void setFUSEDSTATUS(Integer fUSEDSTATUS) {
>            FUSEDSTATUS = fUSEDSTATUS;
>        }
>    }
>
>
>    public static void main(String[] args) {
>        Ignite ignite = Ignition.start();
>
>        IgniteCache<Long, CustomerIgniteInfo> cache =
>ignite.getOrCreateCache(
>            new CacheConfiguration<Long,
>CustomerIgniteInfo>("customerCache")
>                .setIndexedTypes(Long.class, CustomerIgniteInfo.class)
>        );
>
>        LongStream.range(0, 10).forEach(l -> {
>            cache.put(l, new CustomerIgniteInfo("FID" + l, "FNUMBER" + l,
>(int)l));
>        });
>
>        List<List&lt;?>> qryResults = cache.query(
>            new SqlFieldsQuery("EXPLAIN SELECT FID,FNUMBER FROM
>\"customerCache\".CustomerIgniteInfo WHERE FUSEDSTATUS = 3")
>        ).getAll();
>        System.out.println(qryResults);
>    }
>}
>
>
>
>--
>Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Reply via email to