Merged
Conversation
bluestreak01
reviewed
Jan 7, 2026
core/src/test/java/io/questdb/test/cairo/view/ViewCycleTest.java
Outdated
Show resolved
Hide resolved
bluestreak01
reviewed
Jan 7, 2026
bluestreak01
reviewed
Jan 7, 2026
bluestreak01
reviewed
Jan 7, 2026
core/src/test/java/io/questdb/test/cutlass/http/line/MockHttpProcessor.java
Outdated
Show resolved
Hide resolved
bluestreak01
reviewed
Jan 7, 2026
core/src/test/java/io/questdb/test/sql/RandomSelectGenerator.java
Outdated
Show resolved
Hide resolved
bluestreak01
reviewed
Jan 7, 2026
core/src/test/java/io/questdb/test/cairo/view/AbstractViewTest.java
Outdated
Show resolved
Hide resolved
Contributor
Author
[PR Coverage check]😍 pass : 2092 / 2344 (89.25%) file detail
|
bluestreak01
approved these changes
Jan 7, 2026
emrberk
added a commit
to questdb/ui
that referenced
this pull request
Jan 7, 2026
* feat: views support depends on questdb/questdb#5720 disclosure: most of the code was generated by Claude Code * include views in auto-refresh * linter errors * backwards compatibility improvement, remove redundant prop * tests * submodule to branch * fix: resolve type errors after merge with main - Update createModelToolsClient to accept optional matView property - Update TableIcon usage to use 'kind' prop instead of 'isMaterializedView' 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix: remove accidentally committed packages/browser-tests/questdb 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * chore: update questdb submodule to ia_views branch 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * avoid calling views() on older servers * update submodule * handle ai assistant with views, wait for editor availability after adding tab --------- Co-authored-by: emrberk <[email protected]> Co-authored-by: bluestreak <[email protected]> Co-authored-by: Claude Opus 4.5 <[email protected]> Co-authored-by: glasstiger <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Support for Database Views
This PR introduces support for database views.
Views are virtual tables defined by a
SELECTstatement. They do not store data themselves; instead, their defining query is executed as a sub-query whenever the view is referenced in a SQL statement.How Views Work in the Engine
In SQL queries views behave like regular tables or materialized views, and can be used anywhere a table is allowed.
During query compilation, if a view is referenced, its defining SQL is compiled and inserted into the execution model as a nested query, allowing the optimizer to consider the entire plan holistically.
Metadata and State Management
Automatic Recompilation
Views are automatically recompiled when operations occur on its dependencies. The view's dependencies are the tables, materialized views or other views referenced in its defining query.
The operations that trigger recompilation include:
CREATE/DROPtable, materialized view, or viewRENAME TABLEDROP/RENAMEcolumnRecompilation always updates the view's state depending on the outcome of the operation.
For example:
Any query that fails will publish a recompilation event for all involved table-like objects too, allowing the view compiler job to refresh the state of all views dependent on the table-like objects involved in the failed query. This also helps to keep the state of the views up-to-date.
Manual View Compilation
The
COMPILE VIEWcommand can be used to manually test if a view is valid.This command will force recompilation of the view, and its state will be updated.
Discoverability
Views can be listed using the
views()command, which also displays their current state.required by https://github.com/questdb/questdb-enterprise/pull/633
TODOs
CREATE VIEW <viewName> AS (query)@glasstigerDROP VIEW <viewName>@glasstigerviews()statement @glasstigerSHOW CREATE VIEW <viewName>@glasstigertables(), introduce table type:T,V,MV@glasstigerlastUpdatedTimestampfield to view state andviews()@glasstigerDECLARE@glasstigerRENAME TABLE viewName@glasstigerCOMPILE VIEW <viewName>to test view state @glasstigerBump WAL and replication format version?ALTER VIEW <viewName> AS (query)@glasstigerALTER VIEW@glasstigerWalWriternot to create empty column files for views, get rid of_metafile too @glasstigerSequencernot to create_metafile for views @glasstigerSELECTpermission check refactoring to allow row level security via views @glasstigerDECLAREoverride for views @glasstigerDECLARE's syntax to allowconstvariables which cannot be overridden with view parameters @jerrinottoday()@jerrinotCREATE OR REPLACE VIEW@glasstigerRemoveALTER VIEWsyntaxexecutionContext.isValidationOnly()handled on all view related SQL commands @glasstigerTableReferenceOutOfDateExceptionif view definition has changed between query compilation and execution. This will make sure factories taken from query cache are recompiled.Issues from review (Javier):
views()should fail whencairo.view.enabledis disabled (currently runs even when CREATE VIEW fails)Views should not be queryable/listed as regular tables when views are disabledselect * from view_with_limit_20 limit 10ignores thelimit 10) @glasstigerORDER BY timestamp, but equivalent CTE works @glasstigertimestamp(timestamp)) appears to be ignoredCOMPILE VIEW view1 AS ...should fail, the syntax should allow onlyCOMPILE VIEW view1@glasstiger