Search Postgresql Archives

RE: Watching for view changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Mitar <mmitar@xxxxxxxxx>

> On Thu, Dec 20, 2018 at 12:07 PM Rob Sargent <robjsargent@xxxxxxxxx> wrote:
> > Are you hoping to see the difference in the returned values for successive calls to the same query?
>
> i would like to in as close to real-time as possible get notification when results of a query would have changed if I would do the same query again, without me having to do polling or without me having to do diffing.


Hmm, I guess I could see that as long as the DB wasn't too [write] busy, else you'd be flooded with notifications.

Some years ago when I was working on a web app in Perl (which uses the DBI module for all communication to the DB), I subclassed DBI in order to see all calls to the DB. For most statements, I just let all the calls go thru. But for inserts, I wrote to a file the data that was being inserted; for deletes I wrote what was being deleted; and for updates I wrote the before and after values. (For the last 2 I changed the delete/update into a select to get the data.) It made it much easier to see how data changed -- especially when I was new to the app.

You could do something like that, where you have an interceptor that reports on data changes, filtering/searching for just the parts you want as you see fit. Of course, that would be just for your app, it wouldn't catch changes made from psql and other tools.

Maybe it's a useful idea for you ... or maybe not. 😊

If you had to have all statements no matter what tool was used to change data, I'd probably change log_statements to "all", "tail -f" the Pg log, and "do the right thing" (which could be non-trivial).

Kevin
This e-mail transmission, and any documents, files or previous e-mail messages attached to it, may contain confidential information. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, distribution, review, copy or use of any of the information contained in or attached to this message is STRICTLY PROHIBITED. If you have received this transmission in error, please immediately notify us by reply e-mail, and destroy the original transmission and its attachments without reading them or saving them to disk. Thank you.




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux