I have a MySql table updated frequently. I want to take a snapshot for each id which are updated in the past 20 seconds and write the value into a redis. I use the binlog as streaming input and transform the datastream into a Flink table. I run the following sql.
SELECT id, ts, val
FROM my_tbl
WHERE (id, ts) IN
(
SELECT id, MAX(ts)
FROM my_tbl
GROUP BY TUMBLE(proctime, INTERVAL '20' SECOND), id
)
As I know tables join would make excessive state size, I set the StreamQueryConfig as follow
qConfig.withIdleStateRetentionTime(Time.seconds(600), Time.seconds(1200));
I run the task for one day and get the out of memory error. How can I solve this problem?