DarvenDuan opened a new pull request, #22246:
URL: https://github.com/apache/doris/pull/22246

   ## Proposed changes
   
   Issue Number: close #xxx
   
   Before this improvement, Doris generate only one scan_key_range when the 
number of elements in the IN clause exceeds doris_max_scan_key_num and the 
column in the IN clause hits prefix index. It's NOT reasonable because data 
can't be filtered well by prefix index and single scan_key_range limits the 
scan concurrency.
   
   After this improvement, we generate doris_max_scan_key_num scan_key_ranges 
according to the values in the IN clause.
   
   Example:
   
   - `select * from tbl where id in  (1, 3, 14, 58, 60);`, `id` is prefix index.
   -  doris_max_scan_key_num = 3
   
   before : we get single scan_key_range: [1, 60]
   now: we get three scan_key_range: [1, 3], [14, 14], [58, 60]
   
   In my test case, it can speed up query very obviously : 
   
   - elements in the IN clause: 100
   - doris_max_scan_key_num = 48
   
   before:
   query cost time: **7s891ms**
   
   only one scanKey
   
![image](https://github.com/apache/doris/assets/50550370/57edc229-4ee0-4bd9-a98b-829811c8c7f9)
   
![image](https://github.com/apache/doris/assets/50550370/805e2ffb-e217-4023-932e-df2db31e48ab)
   
   after:
   query cost time : **122ms**
   
   48 scanKeys
   
![image](https://github.com/apache/doris/assets/50550370/991f8e89-c2c3-4a48-a39e-367d401f8a42)
   
![image](https://github.com/apache/doris/assets/50550370/1e042187-9dce-4c15-b663-90adb4effaa0)
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at 
[d...@doris.apache.org](mailto:d...@doris.apache.org) by explaining why you 
chose the solution you did and what alternatives you considered, etc...
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to