You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "chenglei (Jira)" <ji...@apache.org> on 2022/10/02 06:30:00 UTC

[jira] [Comment Edited] (PHOENIX-6797) Optimize rowkey prefix selects for salted tables

    [ https://issues.apache.org/jira/browse/PHOENIX-6797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17612033#comment-17612033 ] 

chenglei edited comment on PHOENIX-6797 at 10/2/22 6:29 AM:
------------------------------------------------------------

[~stoty], for this case your described, how would you get the conclusion that the Phoenix would do single range scan over [0,'whatever'] - [30,'whatever']?
I test your case on master, the compiled {{ScanPlan}} would generate {{ScanPlan.scans}} in {{BaseResultIterators.getParallelScans()}}, which is 
[0,'whatever'] - [0,'whateves'] 
,[1,'whatever'] - [1,'whateves'] 
..
,[30,'whatever'] - [30,'whateves']
and I think it is work as you expected.


was (Author: comnetwork):
[~stoty], for this case your described, how would you get the conclusion that the Phoenix would do range scan over [0,'whatever'] - [30,'whatever']?
I test your case on master, the compiled {{ScanPlan}} would generate {{ScanPlan.scans}} in {{BaseResultIterators.getParallelScans()}}, which is 
[0,'whatever'] - [0,'whateves'] 
,[1,'whatever'] - [1,'whateves'] 
..
,[30,'whatever'] - [30,'whateves']
and I think it is work as you expected.

> Optimize rowkey prefix selects for salted tables
> ------------------------------------------------
>
>                 Key: PHOENIX-6797
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6797
>             Project: Phoenix
>          Issue Type: Bug
>          Components: core
>            Reporter: Istvan Toth
>            Priority: Major
>
> For a salted table with a composite PK, queries using a PK prefix are turned into basically full scans.
> We should scan only the salt key + PK prefix range for each key.
> i.e we have the salted table
> {noformat}
> CREATE TABLE T (ID1 VARCHAR(64) not null, ID2 VARCHAR(15) not null, ID3 VARCHAR(24), V1 DATE,
> CONSTRAINT pk PRIMARY KEY (ID1, ID2, ID3)) SALT_BUCKETS = 31;{noformat}
> and we do a select based on ID1:
> {noformat}
> select * from T where id1='whatever';{noformat}
> Phoenix will do a range scan over the following, which is basically a full scan.
> {noformat}
> [0,'whatever'] - [30,'whatever']{noformat}
> However, we only really need to scan the far smaller
> {noformat}
> [0,'whatever'] - [0,'whateves'] 
> ,[1,'whatever'] - [1,'whateves'] 
> ..
> ,[30,'whatever'] - [30,'whateves']{noformat}
> ranges.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)