How to await for rows ingested to WAL table to become visible in QuestDB?

Running SELECT count(*) FROM my_table is certainly a viable approach. Another approach would be to run the following query over the wal_tables table function:

SELECT 1
FROM wal_tables()
WHERE name = 'my_table' and writerTxn = sequencerTxn;

Here, writerTxn is the last committed transaction available for read-only queries and sequencerTxn is the last transaction committed to WAL. So, if these numbers match for a table, the above query will return a row which means that all rows became visible for queries.

1 Like