You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Alex Batyrshin (Jira)" <ji...@apache.org> on 2020/12/23 23:17:00 UTC

[jira] [Created] (PHOENIX-6278) [POC] Ability to salt only first N columns from composite primary key

Alex Batyrshin created PHOENIX-6278:
---------------------------------------

             Summary: [POC] Ability to salt only first N columns from composite primary key
                 Key: PHOENIX-6278
                 URL: https://issues.apache.org/jira/browse/PHOENIX-6278
             Project: Phoenix
          Issue Type: Improvement
            Reporter: Alex Batyrshin
             Fix For: 4.x
         Attachments: PHOENIX-6278.4.x.001.patch

This is just a proof of concept. So quite dirty hack for ScanRanges presented.

Feature adds new table options *SALT_COLS* that define how many first columns (i.e. key prefix) from composite key to salt.

Should be useful for event logs tables with salt buckets when performing query by first columns from key.

Example
{code:java}
CREATE TABLE user_event (
    user VARCHAR NOT NULL,
    type INTEGER NOT NULL
    CONSTRAINT PK PRIMARY KEY (user, type)
);

SELECT * FROM user_event WHERE user = ?;{code}

My tests on 4.4bn rows table with SALT_BUCKETS=30 shows up to 10x performance boost.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)