Skip to content

TTL processing on big table fails with lexical error #129858

Open
@ugavnholt

Description

@ugavnholt

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.O-communityOriginated from the communityP-3Issues/test failures with no fix SLAT-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)branch-release-23.2Used to mark GA and release blockers, technical advisories, and bugs for 23.2branch-release-24.1Used to mark GA and release blockers, technical advisories, and bugs for 24.1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions