Skip to main content
RisingWave allows you to query MySQL tables directly with the mysql_query table-valued function (TVF). It offers a simpler alternative to Change Data Capture (CDC) when working with MySQL data in RisingWave. Unlike CDC, which continuously syncs data changes, this function lets you fetch data directly from MySQL when needed. Therefore, this approach is ideal for static or infrequently updated data, as it’s more resource-efficient than maintaining a constant CDC connection.
Not CDC. This approach fetches rows on demand via a table-valued function. For continuous change replication, use MySQL CDC.
Added in v2.2.0.

Syntax

Define mysql_query as follows:

Data type mapping

The following table shows how MySQL data types are mapped to RisingWave data types:
MySQL TypeRisingWave Type
bit(1)boolean
bit(>1)bytea
bool/booleansmallint
tinyintsmallint
smallintsmallint
mediumintint
intint
bigintbigint
floatfloat32
doublefloat64
decimaldecimal
numericdecimal
yearint
datedate
timetime
datetimetimestamp
timestamptimestamptz
varcharvarchar
charvarchar
jsonjsonb
blobbytea
tinyblobbytea
mediumblobbytea
longblobbytea
arrayunsupported
enumunsupported
setunsupported
geometryunsupported
nullunsupported

Example

  1. In your MySQL database, create a table and populate it with sample data of various data types.
  1. In RisingWave, use mysql_query function to perform the query.