Learn the differences between using CREATE SOURCE and CREATE TABLE with a connector to ingest data in RisingWave.
CREATE SOURCE
and CREATE TABLE ... WITH (connector=...)
. While their syntax is similar, they serve fundamentally different purposes related to data storage and availability.
For a high-level comparison of all core RisingWave objects, see the Source, Table, MV, and Sink guide.
CREATE SOURCE
: A connection without storageCREATE SOURCE
command establishes a direct, non-persistent connection to an external data source.
CREATE SOURCE
is not stored in RisingWave. The persistence of the data depends entirely on the external source’s retention policies.CREATE TABLE
: A connection with persistent storageCREATE TABLE
command, when used with a WITH
clause specifying a connector, connects to an external source and continuously ingests its data into RisingWave’s internal storage.
Feature | CREATE SOURCE | CREATE TABLE ... WITH (connector=...) |
---|---|---|
Data Storage | ❌ No (Data remains in the external source) | ✅ Yes (Data is durably stored in RisingWave) |
Primary Use Case | Ad-hoc queries, pure streaming pipelines | CDC, data retention, performance-sensitive queries |
Required for CDC? | ❌ No (Cannot handle updates/deletes) | ✅ Yes (Mandatory for CDC sources) |
Query Performance | Dependent on the external source and network | Generally faster due to local data access |
Indexes | ❌ Not supported | ✅ Supported |
Primary Keys | Semantic meaning only, no enforcement | ✅ Supported and enforced |