Click to copy
How to Use Push Queries in ksqlDB
In ksqlDB, a push query is a SELECT
statement that listens to any newly produced data.
You can identify push queries by spotting the EMIT CHANGES
modifier or when SELECT
statements are used to create other streams.
The following query returns the name of all newly created products as they are being produced.
SELECT name
FROM product_created
EMIT CHANGES;
The push query above won’t stop running until you explicitly stop it with CTRL+C
. This is the expected behavior on push queries. They will keep running, processing any new records as they are produced.
Push queries are useful when you need to create new streams from queries or when you need to materialize a table.
The alternative to a push query is a pull query.