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

[WIP] *: sql based TTL prototype #70241

Closed
wants to merge 5 commits into from

Conversation

otan
Copy link
Contributor

@otan otan commented Sep 15, 2021

Refs: #20239

demo@127.0.0.1:26257/defaultdb> create table t (pk int primary key, s string) ttl '30 seconds';
CREATE TABLE


Time: 5ms total (execution 5ms / network 0ms)

demo@127.0.0.1:26257/defaultdb> insert into t (pk, s, crdb_internal_ttl_expiration) values (1, 'a', now()), (2, 'b', now() + '2 minutes'), (3, 'c', default);
INSERT 3


Time: 5ms total (execution 5ms / network 0ms)

demo@127.0.0.1:26257/defaultdb> select * from t;
  pk | s
-----+----
   1 | a
   2 | b
   3 | c
(3 rows)


Time: 1ms total (execution 1ms / network 0ms)

demo@127.0.0.1:26257/defaultdb> show schedules; select now(); show jobs;
          id         |        label         | schedule_status |           next_run           |  state  | recurrence | jobsrunning | owner |            created            |                           command
---------------------+----------------------+-----------------+------------------------------+---------+------------+-------------+-------+-------------------------------+---------------------------------------------------------------
  693394338706554881 | sql-stats-compaction | ACTIVE          | 2021-09-15 04:00:00+00       | pending | @hourly    |           0 | node  | 2021-09-15 03:45:59.021481+00 | {}
  693394391318134785 | TTL 52               | ACTIVE          | 2021-09-15 03:46:25.08418+00 | NULL    | * * * * *  |           0 | demo  | 2021-09-15 03:46:15.082784+00 | {"tableId": 52, "ttlColumn": "crdb_internal_ttl_expiration"}
(2 rows)

Note: timings for multiple statements on a single line are not supported. See https://go.crdb.dev/issue-v/48180/v21.2.

               now
---------------------------------
  2021-09-15 03:46:37.682025+00
(1 row)

demo@127.0.0.1:26257/defaultdb> select now(); select *, crdb_internal_ttl_expiration from t;
               now
---------------------------------
  2021-09-15 03:48:17.298784+00
(1 row)


demo@127.0.0.1:26257/defaultdb> select now(); select *, crdb_internal_ttl_expiration from t;
               now
---------------------------------
  2021-09-15 03:48:27.322659+00
(1 row)

Note: timings for multiple statements on a single line are not supported. See https://go.crdb.dev/issue-v/48180/v21.2.

  pk | s | crdb_internal_ttl_expiration
-----+---+-------------------------------
   1 | a | 2021-09-15 03:48:00.99088+00
   2 | b | 2021-09-15 03:50:00.99088+00
   3 | c | 2021-09-15 03:48:30.99088+00
(3 rows)

Note: timings for multiple statements on a single line are not supported. See https://go.crdb.dev/issue-v/48180/v21.2.

demo@127.0.0.1:26257/defaultdb> select now(); select *, crdb_internal_ttl_expiration from t;
               now
---------------------------------
  2021-09-15 03:49:01.705966+00
(1 row)

Note: timings for multiple statements on a single line are not supported. See https://go.crdb.dev/issue-v/48180/v21.2.

  pk | s | crdb_internal_ttl_expiration
-----+---+-------------------------------
   2 | b | 2021-09-15 03:50:00.99088+00
   3 | c | 2021-09-15 03:48:30.99088+00
(2 rows)

Note: timings for multiple statements on a single line are not supported. See https://go.crdb.dev/issue-v/48180/v21.2.

@otan otan added the do-not-merge bors won't merge a PR with this label. label Sep 15, 2021
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@otan otan force-pushed the ttl_stuff branch 5 times, most recently from 00f2550 to 3d4e8c9 Compare October 5, 2021 23:06
@otan otan added the X-noremind Bots won't notify about PRs with X-noremind label Nov 22, 2021
Release note: None
Release note: None

shorten ttl timestamp

sql: use a limit

Release note: None

add a logger workload

Release note: none

add random select component

Release note: None

generate an impossible workload

Release note: none

reverse PK scan

Release note: None

forward scan with time limit

Release note: None

add workload style metrics to demo

Release note: None

control workload QPS

Release note: None

pretty metrics

even more metrics
@otan otan closed this Mar 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge bors won't merge a PR with this label. X-noremind Bots won't notify about PRs with X-noremind
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants