Skip to content

feat: add create materialized view table menu action#557

Open
emrberk wants to merge 6 commits intomainfrom
feat/create-mat-view-menu
Open

feat: add create materialized view table menu action#557
emrberk wants to merge 6 commits intomainfrom
feat/create-mat-view-menu

Conversation

@emrberk
Copy link
Copy Markdown
Collaborator

@emrberk emrberk commented Apr 21, 2026

Generate a starter CREATE MATERIALIZED VIEW from a table or an existing materialized view, and insert it into the editor for the user to tweak.

From a table:

  • Menu item disabled for non-WAL tables and tables without a designated timestamp
  • View name <table>_<sample>, replacing existing period suffix (e.g. my_table_5mmy_table_1h)
  • REFRESH IMMEDIATE; SAMPLE BY / PARTITION BY / TTL inferred per QuestDB's default inference
  • Column aggregates: sum/last by name pattern; types without a last() overload (BINARY, LONG128, INTERVAL, arrays) dropped

From a materialized view (downsample):

  • SAMPLE BY stepped one ladder rung up; WITH BASE re-rooted at the source mat view
  • Aggregate args rewritten to layer-1 aliases; count()sum; count(DISTINCT …) dropped; non-decomposable aggregates fall back to last()
  • WHERE / GROUP BY / LATEST ON stripped (source mat view already applied them)
  • REFRESH, PERIOD, OWNED BY preserved; TTL stepped one rung up

Generation errors surface through the toast instead of being swallowed.

Screenshot 2026-04-21 at 23 56 20

@emrberk emrberk requested a review from ideoma April 21, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant