Description
Describe the problem
Having a big table with billions rows, makes ttl jobs fail with lexical error: placeholder index must be between 1 and 65536"
Having a big table with billion of rows, where thousands of records are being added every second, TTL fails to process the table.
To Reproduce
CREATE TABLE public.accesslog (
login STRING(255) NOT NULL,
ip INET NOT NULL,
"timestamp" TIMESTAMPTZ(6) NOT NULL,
CONSTRAINT "primary" PRIMARY KEY (ip ASC, "timestamp" DESC),
INDEX authpolicy_accesslog_login_idx (login ASC, "timestamp" DESC),
INDEX authpolicy_accesslog_time_idx ("timestamp" ASC)
) WITH (ttl = 'on', ttl_expiration_expression = e'(("timestamp" AT TIME ZONE \'UTC\') + INTERVAL \'30 days\') AT TIME ZONE \'UTC\'', ttl_job_cron = '13 */4 * * *', ttl_select_batch_size = 5000000, ttl_delete_batch_size = 50000)
Fill the table with >1b rows, and add ~2k rows every second, and watch the ttl cleanup log.
Expected behavior
Expects the TTL job to run, where TTL select loads the oldest 5.000.000 rows at each interval, deleting all selected records at batches of 50.000
Environment:
- CockroachDB version: 24.1.0
- Server OS: Ubuntu 22.04.4 LTS
- Client app: n/a internal TTL job
Additional context
Lowering the intervals/batch sizes make the select statement take unproportional resources from the cluster, raising the interval/batch sizes causes this error - hence using TTL to trim a big table seems broken.
Jira issue: CRDB-41739