greptimeteam/docs/greptimedb-flow
Claude Code and agent skill by greptimeteam/docs
- community
Checking that the SKILL.md file is still in the repository.
Guide for creating GreptimeDB flow tasks — continuous aggregation that updates a sink table on the fly as data is ingested. Use when the user asks to build a materialized view, continuous aggregation, downsampling job, or rollup. Triggers on phrases like "create flow", "continuous aggregation", "连续聚合", "物化视图", "materialized view", "downsampling", "time window aggregation". Note that Flow's original streaming mode is deprecated; batching mode is active for aggregation workloads.
Install
npx vskill@latest install greptimeteam/docs/greptimedb-flowSKILL.md
GreptimeDB Flow Guide
Create GreptimeDB flow definition to do time window based aggregation on the fly while data ingested into GreptimeDB. This is how GreptimeDB's continuous aggregation engine works.
Flow is also known as:
- Continuous aggregation
- Materialized View
- Downsampling or rollup tasks
The workflow
To create GreptimeDB flow task, we should follow these phases:
Phase 1. Learn and understand GreptimeDB Flow
First, we read GreptimeDB flow definitions and how it works from the documentation.
There are doc pages available, use WebFetch to load and understand them:
- Overview and quick example:
https://docs.greptime.com/user-guide/flow-computation/overview/
- Examples for continuous aggregation:
https://docs.greptime.com/user-guide/flow-computation/continuous-aggregation/
- SQL DDL for flow, sink table and related concepts:
https://docs.greptime.com/user-guide/flow-computation/manage-flow/
Phase 2. Create flow tasks
We should try to understand:
- time window the user wants to use
- aggregation fields and group-by rules
Create the flow and sink table DDL.
Strongly recommend providing an explicit `CREATE TABLE` for the sink table alongside CREATE FLOW. Flow will auto-create the sink table if it does not exist, but manual creation keeps full control over:
- Column order and type — must line up with the SELECT in the flow query.
- Time index —
TIME INDEXis typically the column produced by the time
window function (e.g. date_bin(...) AS time_window).
- `update_at` column — an auto-created batching SQL sink gets an
update_at column for the update time; a TQL sink follows the query output and gets none. A pre-created SQL sink either matches the query output width or adds one extra trailing timestamp column (such as update_at) for the update time.
- Primary key / tags — use
PRIMARY KEYto declare tag columns; together
with the time index they form the unique key the Flow engine uses to insert or update rows.
Minimal example:
Use CREATE OR REPLACE FLOW to update an existing flow (only the flow definition is replaced; source and sink tables are untouched). Use CREATE FLOW IF NOT EXISTS for idempotent creation. The two clauses cannot be combined — pick one based on intent.
Phase 3. Limit recomputation window with EXPIRE AFTER
For any stateful aggregation (GROUP BY, windowed aggregates), decide how far back in time the flow engine should still update results when new data arrives.
EXPIRE AFTER is a boundary: rows whose time index is older than the given interval are considered out of scope — the time windows they fall into are no longer updated even if late data arrives. It is a performance knob that keeps the flow running without putting too much pressure on the frontend, not an in-memory state limiter.
Important caveats:
- It does not delete data from the source or the sink table. Use the
table TTL option if you also want physical data expiration.
- Without
EXPIRE AFTER, every historical row remains eligible for
recomputation whenever new data arrives; for high-volume source tables this creates significant load on the frontend.
- Set it to a window comfortably larger than the largest time window used in
the query, plus any tolerable lateness.
Phase 4. Verify the tasks
If greptimedb-mcp-server is available, we can use its execute_sql tools to execute the DDL. Try to generate some sample data, insert into source table, then verify the sink table via SQL SELECT statements. We can use MySQL style SELECT statements on GreptimeDB for most cases. execute_sql is read-only unless the server was started with --allow-write true (or GREPTIMEDB_ALLOW_WRITE=true); otherwise give the DDL and INSERT statements to the user, or run them through a MySQL/PostgreSQL client.
Reference
- Aggregation functions of Flow:
https://docs.greptime.com/user-guide/flow-computation/expressions/
- A full list of aggregation functions:
https://docs.greptime.com/reference/sql/functions/df-functions/#aggregate-functions
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/greptimedb-flow/SKILL.md
Popularity
- Repository stars
- 44
- Repository forks
- 52
- 7-day trend score
- 19
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 19 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/greptimeteam/docs/greptimedb-flow)