Sergey2022-04-07 00:24:34
Sergey, 2022-04-07 00:24:34

Is it possible to execute a longpool query against a PostgreSQL database?

Let periodically someone's program adds records to one of the tables. I need to extract new records from it. To do this, each entry has an id, and the program itself stores the id of the last read entry, that is, I request entries starting from a certain id. Therefore, if there are no new records, then the query returns nothing. But is it possible to make the query run either until there is data, or until a timeout occurs?
(I can periodically poll if there are new records, but this seems not the best way if you need to poll the database often)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Pavel Belyaev, 2016-10-04

I didn’t notice a difference on the firmware of 2013 after updating from 10.10 to 10.12, it seems to me that 10.9 were less voracious.

Stalker_RED, 2022-04-07

You can make a trigger for the appearance of new records, and the DBMS itself will pull your server. It remains to figure out how to transfer this new data to clients (longpoll or web socket, for example).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question