cockroachdb / cockroach

CockroachDB - the open source, cloud-native distributed SQL database.
https://www.cockroachlabs.com
Other
29.52k stars 3.7k forks source link

jobs: support recurring materialized view refresh #79781

Open nvanbenschoten opened 2 years ago

nvanbenschoten commented 2 years ago

It would be useful to be able to schedule a materialized view refresh every X seconds. The scheduled jobs framework is general enough to support this, but we need a front-end.

This may be a solution for a reasonably sized class of queries where full recomputation time is less than the maximum staleness requirement and so incremental maintenance of materialized views is not needed.

Example syntax:

CREATE SCHEDULE FOR REFRESH MATERIALIZED VIEW matview RECURRING '@hourly'

Epic: CRDB-13625

Jira issue: CRDB-15918

ajwerner commented 2 years ago

Relates to https://github.com/cockroachdb/cockroach/pull/61109.

ajwerner commented 2 years ago

@devadvocado this is something for you to think about. I'm throwing it to the backlog.

alex-berger commented 1 year ago

I think this is an obvious feature. Having materialized views, but having to write a cron job to refresh them every X minutes/hours sounds like a half baked feature.

Vishnum98 commented 1 month ago

Has there been any work towards this?