Feature: Key role-dependent query results by authorization context

Open
#21,225 0 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@TCeason is already working on this.

Since Nov 26, 2026.

Assessment

This issue has not been assessed yet.

Description

C-feature

Summary

Follow-up to #21204. Queries that bind user- or role-dependent functions currently skip the result cache. Measure the hit-rate and latency impact on workloads with the result cache enabled before changing that default behavior for these queries.

If the benefit is meaningful, include the server-resolved values the query actually depends on in the result-cache key: the current user or role, or the applicable available/effective roles and mode. Use the values from binding, not client-supplied role lists. Apply this consistently to row access policies, masking policies, views, and direct expressions. Initially, don't try to share entries across different authorization contexts. Keep the existing plan-cache restrictions unchanged.

Verify a repeat query in the same context can hit the cache, while a different context or a role change never reuses a result computed under the old context. Cover both direct expressions and expressions in policies or views.

Dominant language
Rust
Stars
9.5k
Forks
903
Avg merge
2d 13h
Merged PRs (30d)
204

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from databendlabs/databend

All issues in databendlabs/databend

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.