[ 
https://issues.apache.org/jira/browse/PHOENIX-7170?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kadir Ozdemir updated PHOENIX-7170:
-----------------------------------
    Description: 
Deleting rows using delete markers require running delete queries to insert 
them, one for each row to be deleted. Often applications need to run periodic 
jobs to issue delete queries to insert delete markers. Deleting rows using TTL 
is more performance optimized compared to adding delete markers in Phoenix 
since TTL works without inserting delete markers. Phoenix currently supports 
table and view (level) TTL. It is desirable to have a conditional TTL feature 
to extend the TTL future to expire a subset of rows of a table or updatable 
view using a different TTL value than the rest of the rows. 

A condition TTL can be set using a CASE statement in CREATE and ALTER 
statements by adding TTL=<the case statement>. For example,
TTL = CASE WHEN ID IS BETWEEN 1 AND 100 THEN <10 days> WHEN ID IS BETWEEN 101 
AND 200 <7 days> ELSE <5 days> END

The compaction scanner (CompactionScanner) in Phoenix can evaluate the case 
statement on a row and decide if the row should be removed. Similarly, on the 
read path TTLRegionScanner can mask the rows using the case statement. The TTL 
case statement can be stored in SYSCAT in header rows.

  was:
Deleting rows using delete markers require running delete queries to insert 
them, one for each row to be deleted. Often applications need to run periodic 
jobs to issue delete queries to insert delete markers. Deleting rows using TTL 
is more performance optimized compared to adding delete markers in Phoenix 
since TTL works without inserting delete markers. Phoenix currently supports 
table and view (level) TTL. It is desirable to have a row level TTL feature to 
extend the TTL future to delete a subset of rows of a table or updatable view.

A row-level-TTL can be set using a CASE statement in CREATE and ALTER 
statements by adding TTL=<the case statement>. For example,
TTL = CASE WHEN ID IS BETWEEN 1 AND 100 THEN <10 days> WHEN ID IS BETWEEN 101 
AND 200 <7 days> ELSE <5 days> END
The compaction scanner (CompactionScanner) in Phoenix can evaluate the case 
statement on a row and decide if the row should be deleted. Similarly, on the 
read path TTLRegionScanner can mask the deleted rows using the case statement. 
The TTL case statement can be stored in SYSCAT in header rows.


> Conditional TTL
> ---------------
>
>                 Key: PHOENIX-7170
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-7170
>             Project: Phoenix
>          Issue Type: New Feature
>            Reporter: Kadir Ozdemir
>            Priority: Major
>
> Deleting rows using delete markers require running delete queries to insert 
> them, one for each row to be deleted. Often applications need to run periodic 
> jobs to issue delete queries to insert delete markers. Deleting rows using 
> TTL is more performance optimized compared to adding delete markers in 
> Phoenix since TTL works without inserting delete markers. Phoenix currently 
> supports table and view (level) TTL. It is desirable to have a conditional 
> TTL feature to extend the TTL future to expire a subset of rows of a table or 
> updatable view using a different TTL value than the rest of the rows. 
> A condition TTL can be set using a CASE statement in CREATE and ALTER 
> statements by adding TTL=<the case statement>. For example,
> TTL = CASE WHEN ID IS BETWEEN 1 AND 100 THEN <10 days> WHEN ID IS BETWEEN 101 
> AND 200 <7 days> ELSE <5 days> END
> The compaction scanner (CompactionScanner) in Phoenix can evaluate the case 
> statement on a row and decide if the row should be removed. Similarly, on the 
> read path TTLRegionScanner can mask the rows using the case statement. The 
> TTL case statement can be stored in SYSCAT in header rows.



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

Reply via email to