You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Justin Ji <bi...@foxmail.com> on 2019/01/07 14:47:27 UTC

Ignite does not perform as expected

when I run a SQL query with the two indexes, but ignite does not perform as
expected, it only uses dpId does not use devId, I explain the SQL:

SELECT
    __Z0.ID AS __C0_0,
    __Z0.GMTCREATE AS __C0_1,
    __Z0.GMTMODIFIED AS __C0_2,
    __Z0.DEVID AS __C0_3,
    __Z0.DPID AS __C0_4,
    __Z0.CODE AS __C0_5,
    __Z0.NAME AS __C0_6,
    __Z0.CUSTOMNAME AS __C0_7,
    __Z0.MODE AS __C0_8,
    __Z0.TYPE AS __C0_9,
    __Z0.VALUE AS __C0_10,
    __Z0.RAWVALUE AS __C0_11,
    __Z0.TIME AS __C0_12,
    __Z0.STATUS AS __C0_13,
    __Z0.UUID AS __C0_14
FROM "data_point".T_DATA_POINT __Z0
    /* "data_point".IDX_DPID: DPID = 1 */
WHERE (__Z0.DEVID = '00200008005459000a70')
    AND (__Z0.DPID = 1)

When I only use devId as query condition:
SELECT
    __Z0.ID AS __C0_0,
    __Z0.GMTCREATE AS __C0_1,
    __Z0.GMTMODIFIED AS __C0_2,
    __Z0.DEVID AS __C0_3,
    __Z0.DPID AS __C0_4,
    __Z0.CODE AS __C0_5,
    __Z0.NAME AS __C0_6,
    __Z0.CUSTOMNAME AS __C0_7,
    __Z0.MODE AS __C0_8,
    __Z0.TYPE AS __C0_9,
    __Z0.VALUE AS __C0_10,
    __Z0.RAWVALUE AS __C0_11,
    __Z0.TIME AS __C0_12,
    __Z0.STATUS AS __C0_13,
    __Z0.UUID AS __C0_14
FROM "data_point".T_DATA_POINT __Z0
    /* "data_point".IDX_DEVID: DEVID = '00200008005459000a70' */
WHERE __Z0.DEVID = '00200008005459000a70'

It is very strange, so can anyone tell me how to use devId and dpId as query
index?




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Ignite does not perform as expected

Posted by Justin Ji <bi...@foxmail.com>.
Sorry for my poor English, I mean only use devId as my index, and I have
found the solution in ignite documents. I can force ignite use devId as
index according to *USE INDEX*



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Ignite does not perform as expected

Posted by Evgenii Zhuravlev <e....@gmail.com>.
What do you mean? Only one index can be used for table for a one query. If
you want to filter by 2 fields, you have to create group index.

пн, 7 янв. 2019 г. в 17:38, Justin Ji <bi...@foxmail.com>:

> Thank for your reply.
>
> How can I use devId as my index when only one index can be used for one
> table
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: Ignite does not perform as expected

Posted by Justin Ji <bi...@foxmail.com>.
Thank for your reply.

How can I use devId as my index when only one index can be used for one
table



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Ignite does not perform as expected

Posted by Justin Ji <bi...@foxmail.com>.
Thank for your reply.

How can I use devId as my index when only one index can be used for one
table



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Ignite does not perform as expected

Posted by Evgenii Zhuravlev <e....@gmail.com>.
Ignite can use only one index per table, so, you probably need to create a
group index:
https://apacheignite-sql.readme.io/docs/schema-and-indexes#section-group-indexes

Evgenii

пн, 7 янв. 2019 г. в 06:47, Justin Ji <bi...@foxmail.com>:

> when I run a SQL query with the two indexes, but ignite does not perform as
> expected, it only uses dpId does not use devId, I explain the SQL:
>
> SELECT
>     __Z0.ID AS __C0_0,
>     __Z0.GMTCREATE AS __C0_1,
>     __Z0.GMTMODIFIED AS __C0_2,
>     __Z0.DEVID AS __C0_3,
>     __Z0.DPID AS __C0_4,
>     __Z0.CODE AS __C0_5,
>     __Z0.NAME AS __C0_6,
>     __Z0.CUSTOMNAME AS __C0_7,
>     __Z0.MODE AS __C0_8,
>     __Z0.TYPE AS __C0_9,
>     __Z0.VALUE AS __C0_10,
>     __Z0.RAWVALUE AS __C0_11,
>     __Z0.TIME AS __C0_12,
>     __Z0.STATUS AS __C0_13,
>     __Z0.UUID AS __C0_14
> FROM "data_point".T_DATA_POINT __Z0
>     /* "data_point".IDX_DPID: DPID = 1 */
> WHERE (__Z0.DEVID = '00200008005459000a70')
>     AND (__Z0.DPID = 1)
>
> When I only use devId as query condition:
> SELECT
>     __Z0.ID AS __C0_0,
>     __Z0.GMTCREATE AS __C0_1,
>     __Z0.GMTMODIFIED AS __C0_2,
>     __Z0.DEVID AS __C0_3,
>     __Z0.DPID AS __C0_4,
>     __Z0.CODE AS __C0_5,
>     __Z0.NAME AS __C0_6,
>     __Z0.CUSTOMNAME AS __C0_7,
>     __Z0.MODE AS __C0_8,
>     __Z0.TYPE AS __C0_9,
>     __Z0.VALUE AS __C0_10,
>     __Z0.RAWVALUE AS __C0_11,
>     __Z0.TIME AS __C0_12,
>     __Z0.STATUS AS __C0_13,
>     __Z0.UUID AS __C0_14
> FROM "data_point".T_DATA_POINT __Z0
>     /* "data_point".IDX_DEVID: DEVID = '00200008005459000a70' */
> WHERE __Z0.DEVID = '00200008005459000a70'
>
> It is very strange, so can anyone tell me how to use devId and dpId as
> query
> index?
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>