Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I have created an index, but explain sql does not use the index #411

Open
tom055 opened this issue Mar 20, 2023 · 1 comment
Open

I have created an index, but explain sql does not use the index #411

tom055 opened this issue Mar 20, 2023 · 1 comment

Comments

@tom055
Copy link

tom055 commented Mar 20, 2023

griddb 5.1.0

gs[public]> explain analyze select * from properties_test where deviceId='101' and property='0' limit 0,10;
The query had been executed. (60,662 ms)
gs[public]> getplantxt
Id Type     Input Rows Lead time Actual time Node               And more..                         
---------------------------------------------------------------------------------------------------
 0 SCAN     -     -        60597       48739 192.168.1.62:10001 table: {properties_test} LIMIT: 10
 1   RESULT 0     10           0           0 192.168.1.62:20001                                   
gs[public]> showcontainer properties_test
Database    : public
Name        : properties_test
Type        : COLLECTION
Partition ID: 13
DataAffinity: -

Columns:
No  Name                  Type            CSTR  RowKey
------------------------------------------------------------------------------
 0  Type                  STRING                
 1  DeviceId              STRING                
 2  Property              STRING                
 3  Id                    STRING                
 4  NumberValue           DOUBLE                
 5  Value                 STRING                
 6  CreateTime            TIMESTAMP             
 7  Timestamp             TIMESTAMP             

Indexes:
Name        : 
Type        : TREE
Columns:
No  Name                  
--------------------------
 0  Property

Name        : 
Type        : TREE
Columns:
No  Name                  
--------------------------
 0  DeviceId

Name        : 
Type        : TREE
Columns:
No  Name                  
--------------------------
 0  Timestamp

Name        : 
Type        : TREE
Columns:
No  Name                  
--------------------------
 0  DeviceId
 1  Property

@knonomura
Copy link
Member

Sorry for late reply.

Thank you for your report.

The output of "getplantxt" doesn't include the detailed information.

gs[public]> getplantxt
Id Type Input Rows Lead time Actual time Node And more..

0 SCAN - - 60597 48739 192.168.1.62:10001 table: {properties_test} LIMIT: 10
1 RESULT 0 10 0 0 192.168.1.62:20001

Could you use "gettaskplan" for Plan Id = 0 (Type = SCAN) ?
It will include the following information.

gs[public]> gettaskplan 0

        ...
        "index" : [ {
          "actualTime" : 0,
          "columnList" : [ "DeviceId", "Property" ],
          "conditionList" : [ {
            "column" : "DeviceId",
            "condition" : "EQ"
          }, {
            "column" : "Property",
            "condition" : "EQ"
          } ],
          ...
          "type" : "SCAN_CONTAINER_INDEX"
          ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants