MCPcopy Index your code
hub / github.com/MaterializeInc/materialize

github.com/MaterializeInc/materialize @v26.31.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v26.31.2 ↗ · + Follow
37,881 symbols 155,131 edges 3,359 files 9,433 documented · 25%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Build status Doc reference Chat on Slack

Materialize is a real-time data integration platform that creates and continually updates consistent views of transactional data from across your organization. Its SQL interface democratizes the ability to serve and access live data. Materialize can be deployed anywhere your infrastructure runs.

Use Materialize to do things like deliver fresh context for AI/RAG pipelines, power operational dashboards, and create more dynamic customer experiences without building time-consuming custom data pipelines.

The three most common patterns for adopting Materialize are the following:

  • Query Offload (CQRS) - Scale complex read queries more efficiently than a read replica, and without the headaches of cache invalidation.
  • Integration Hub (ODS) - Extract, load, and incrementally transform data from multiple sources. Create live views of your data that can be queried directly or pushed downstream.
  • Operational Data Mesh (ODM) - Use SQL to create and deliver real-time, strongly consistent data products to streamline coordination across services and domains.

Get started

Ready to try out Materialize? You can sign up for a free cloud trial or download our community edition, which is free forever for deployments using less than 24 GiB of memory and 48 GiB of disk!

Have questions? We'd love to hear from you: * Join our Slack * Send us mail

About

Materialize focuses on providing correct and consistent answers with minimal latency, and does not ask you to accept either approximate answers or eventual consistency. This guarantee holds even when joining data from multiple upstream systems. Whenever Materialize answers a query, that answer is the correct result on some specific (and recent) version of your data. Materialize does all of this by recasting your SQL queries as dataflows, which can react efficiently to changes in your data as they happen.

Our fully managed service is cloud-native, featuring high availability through multi-active replication, horizontal scalability by seamlessly scaling dataflows across multiple machines, and near-infinite storage by leveraging cloud object storage (e.g., Amazon S3). You can self-manage Materialize using our Enterprise or Community editions.

We support a large fraction of PostgreSQL features and are actively expanding support for more built-in PostgreSQL functions. Please file an issue if you have an idea for an improvement!

Get data in

Materialize can read data directly from a PostgreSQL or MySQL replication stream, from Kafka (and other Kafka API-compatible systems like Redpanda), or from SaaS applications via webhooks.

Transform, manipulate, and read your data

Once you've got the data in, define views and perform reads via the PostgreSQL protocol. Use your favorite SQL client, including the psql you probably already have on your system. Customers using Materialize in production tend to use dbt Core.

Materialize supports a comprehensive variety of SQL features, all using the PostgreSQL dialect and protocol:

  • Joins, joins, joins! Materialize supports multi-column join conditions, multi-way joins, self-joins, cross-joins, inner joins, outer joins, etc.
  • Delta-joins avoid intermediate state blowup compared to systems that can only plan nested binary joins - tested on joins of up to 64 relations.
  • Support for subqueries. Materialize's SQL optimizer performs subquery decorrelation out-of-the-box, avoiding the need to manually rewrite subqueries into joins.
  • Materialize can incrementally maintain views in the presence of arbitrary inserts, updates, and deletes. No asterisks.
  • All the aggregations: min, max, count, sum, stddev, etc.
  • HAVING
  • ORDER BY
  • LIMIT
  • DISTINCT
  • JSON support in the PostgreSQL dialect including operators and functions like ->, ->>, @>, ?, jsonb_array_element, jsonb_each. Materialize automatically plans lateral joins for efficient jsonb_each support.
  • Nest views on views on views!
  • Multiple views that have overlapping subplans can share underlying indices for space and compute efficiency, so just declaratively define what you want, and we'll worry about how to efficiently maintain them.

We’ve also extended our SQL support to enable recursion that supports incrementally updating tree and graph structures.

Just show us what it can do!

Here's an example join query that works fine in Materialize, TPC-H query 15:

CREATE SOURCE tpch
  FROM LOAD GENERATOR TPCH (SCALE FACTOR 1)
  FOR ALL TABLES;

-- Views define commonly reused subqueries.
CREATE VIEW revenue (supplier_no, total_revenue) AS
    SELECT
        l_suppkey,
        SUM(l_extendedprice * (1 - l_discount))
    FROM
        lineitem
    WHERE
        l_shipdate >= DATE '1996-01-01'
        AND l_shipdate < DATE '1996-01-01' + INTERVAL '3' month
    GROUP BY
        l_suppkey;

-- The MATERIALIZED keyword is the trigger to begin
-- eagerly, consistently, and incrementally maintaining
-- results that are stored directly in durable storage.
CREATE MATERIALIZED VIEW tpch_q15 AS
  SELECT
    s_suppkey,
    s_name,
    s_address,
    s_phone,
    total_revenue
FROM
    supplier,
    revenue
WHERE
    s_suppkey = supplier_no
    AND total_revenue = (
        SELECT
            max(total_revenue)
        FROM
            revenue
    )
ORDER BY
    s_suppkey;

-- Creating an index keeps results always up to date and in memory.
-- In this example, the index will allow for fast point lookups of
-- individual supply keys.
CREATE INDEX tpch_q15_idx ON tpch_q15 (s_suppkey);

Stream inserts, updates, and deletes on the underlying tables (lineitem and supplier), and Materialize keeps the materialized view incrementally updated. You can type SELECT * FROM tpch_q15 and expect to see the current results immediately!

Get data out

Pull based: Use any PostgreSQL-compatible driver in any language/environment to make SELECT queries against your views. Tell them they're talking to a PostgreSQL database, they don't ever need to know otherwise. This is particularly helpful for pointing services and BI tools directly at Materialize.

Push based: Listen to changes directly using SUBSCRIBE or configure Materialize to stream results to a Kafka topic as soon as the views change. You can also copy updates to object storage.

Documentation

Check out our documentation.

License

Materialize is provided as a self-managed product and a fully managed cloud service with credit-based pricing. Included in the price are proprietary cloud-native features like horizontal scalability, high availability, and a web management console.

We're big believers in advancing the frontier of human knowledge. To that end, the source code of the standalone database engine is publicly available, in this repository, and licensed under the BSL 1.1, converting to the open-source Apache 2.0 license after 4 years. As stated in the BSL, use of the standalone database engine on a single node is free forever.

Materialize depends upon many open source Rust crates. We maintain a list of these crates and their licenses, including links to their source repositories.

For developers

Materialize is primarily written in Rust.

Developers can find docs at doc/developer, and Rust API documentation is hosted at https://dev.materialize.com/api/rust/.

Contributions are welcome. Prospective code contributors might find the D-good for external contributors discussion label useful. See CONTRIBUTING.md for additional guidance.

Credits

Materialize is lovingly crafted by a team of developers and one bot. Join us.

Extension points exported contracts — how you extend this code

CollectionPlan (Interface)
A trait for types that describe how to build a collection. [7 implementers]
src/expr/src/relation.rs
Value (Interface)
Defines a value that get stored as part of a System or Session variable. This trait is partially object safe, see [`Var [19 …
src/sql/src/session/vars/value.rs
SimpleColumnarData (Interface)
Simple type of data that can be columnar encoded. [7 implementers]
src/persist-types/src/codec_impls.rs
RustType (Interface)
A trait for representing a Rust type `Self` as a value of type `Proto` for the purpose of serializing this value as (par [289 …
src/proto/src/lib.rs
AsColumnType (Interface)
Types that implement this trait can be stored in an SQL column with the specified SqlColumnType [24 implementers]
src/repr/src/scalar.rs
CheckedRecursion (Interface)
A trait for types which support bounded recursion to prevent stack overflow. The rather odd design of this trait allows [19 …
src/ore/src/stack.rs
FuelSize (Interface)
Heap-size estimate used by source operators to drive `give_fueled` yielding. Stack-only values may report `size_of_val( [8 …
src/storage/src/source/types.rs
AlterCompatible (Interface)
Explicitly states the contract between storage and higher levels of Materialize w/r/t which facets of objects managed by [41 …
src/storage-types/src/lib.rs

Core symbols most depended-on inside this repo

unwrap
called by 5730
src/persist-client/src/internal/machine.rs
expect
called by 3442
src/persist-client/src/internal/datadriven.rs
map
called by 2997
src/expr/src/linear.rs
clone
called by 2321
src/persist-client/src/read.rs
to_string
called by 2174
src/avro/src/schema.rs
nullable
called by 2101
src/sql/src/plan/hir.rs
with_column
called by 1957
src/repr/src/relation.rs
expect
called by 1956
src/pgwire/src/codec.rs

Shape

Method 16,055
Function 11,756
Class 7,692
Enum 1,485
Interface 885
Route 8

Languages

Rust71%
Python21%
TypeScript8%
C++1%
Java1%
C#1%

Modules by API surface

src/sql-parser/src/parser.rs347 symbols
test/orchestratord/mzcompose.py281 symbols
src/sql/src/session/vars.rs247 symbols
console/types/materialize.d.ts246 symbols
src/sql-parser/src/ast/defs/statement.rs229 symbols
src/expr/src/scalar/func.rs224 symbols
src/adapter/src/catalog.rs213 symbols
misc/python/materialize/feature_benchmark/scenarios/benchmark_main.py213 symbols
test/cluster-spec-sheet/mzcompose.py202 symbols
src/adapter/src/coord.rs192 symbols
misc/python/materialize/parallel_workload/action.py190 symbols
src/catalog-protos/src/objects_v88.rs187 symbols

Datastores touched

materializeDatabase · 1 repos
(mysql)Database · 1 repos
materialize_dbDatabase · 1 repos
(mongodb)Database · 1 repos
dbnameDatabase · 1 repos
polarisDatabase · 1 repos
postgresDatabase · 1 repos

For agents

$ claude mcp add materialize \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact