cockroachdb / cockroachdb/cockroach
views: use follower reads for materialized views by default or optionally
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
**Is your feature request related to a problem? Please describe.**
I'm seeing my materialized view queries run about 2x better when they're wrapped in a follower read transaction. Considering materialized views work on stale data (assuming less frequent refresh), it can benefit from running MR with FR. Nothing prevents me from doing the following:
```sql
BEGIN PRIORITY HIGH AS OF SYSTEM TIME follower_read_timestamp();
SELECT FROM MR;
COMMIT;
```
but executing implicitly with FR is probably a better DX.
**Describe the solution you'd like**
Executing a materialized view should implicitly read from the follower read replica.
**Describe alternatives you've considered**
surprisingly this works `SELECT * FROM MR AS OF SYSTEM TIME follower_read_timestamp();`.
Jira issue: CRDB-25052
Contributor guide
Assessment
This issue has not been assessed yet.