CDR Postgresql error

Hello Everyone,
CDR is getting error in database

2024-06-28 12:51:30.575 UTC [403056] cdr@cdr DETAIL:  Cannot enlarge string buffer containing 1073738191 bytes by 3819 more bytes.
2024-06-28 12:51:30.575 UTC [403056] cdr@cdr CONTEXT:  SQL statement "select                                json_agg(ev_data::json), count(*) from pgq.get_batch_events(v_batch_id)"
	PL/pgSQL function switch.async_cdr_statistics() line 15 at SQL statement
2024-06-28 12:51:30.575 UTC [403056] cdr@cdr STATEMENT:  SELECT processed_records FROM switch.async_cdr_statistics()
2024-06-28 12:53:53.935 UTC [403127] cdr@cdr ERROR:  out of memory

Your pgqd was stopped for long time. Simplest option is drop events in queue, see example there The account balance is not being deducted from any of the accounts - #21 by dmitry.s

Thank you for reply, I see in database

cdr=# select * from pgq.get_consumer_info();
      queue_name      |    consumer_name     |           lag           |        last_seen        | last_tick | current_batch | next_tick | pending_events
----------------------+----------------------+-------------------------+-------------------------+-----------+---------------+-----------+----------------
 async_cdr_statistics | async_cdr_statistics | 29 days 12:58:14.347374 | 29 days 12:58:14.347374 |         1 |               |           |        2376557
(1 row)

I tried unregister, and restart service, but still present.
And you are correct pgqd was down quite some time, because of incorrect configuration.

I ran register function and I see right now

cdr=# select pgq.register_consumer('cdr_billing','cdr_billing');
 register_consumer
-------------------
                 1
(1 row)

cdr=#
cdr=# select * from pgq.get_consumer_info();
      queue_name      |    consumer_name     |           lag           |        last_seen        | last_tick | current_batch | next_tick | pending_events
----------------------+----------------------+-------------------------+-------------------------+-----------+---------------+-----------+----------------
 async_cdr_statistics | async_cdr_statistics | 29 days 13:03:04.063443 | 29 days 13:03:04.063443 |         1 |               |           |        2376607
 cdr_billing          | cdr_billing          | 00:00:09.833432         | 00:00:03.612742         |   8478746 |               |           |              1
(2 rows)

cdr=#

I unregistered stats too and all started to work properly, thank for you help.

cdr=# select pgq.unregister_consumer('async_cdr_statistics','async_cdr_statistics');