kine
kine copied to clipboard
can we implement the watch by trigger for PostgresDB?
Hi, Very glad to see kine now support postgresql! By reading the code, if I am correct, it is still implementing watch by selecting the table. Since postgresDB can support trigger, my question is that is it possible to define a trigger on the kine table, so that any insert/update/delete can trigger an action/event so we don't have to do the query all the time. Are there any disadvantage of this approach? Thank you.
Actually I mean trigger + pg_notify + listen on the go side (https://github.com/go-pg/pg)
The polling is a lot more efficient than you would think. On average there is no delay but in the worst case scenario you get about a 500ms delay in a watch. Right now the bigger problem with postgres is that the queries/schema are not optimize so it doesn't perform well at all compared to MySQL. You quickly get CPU bound in postgres where as the mysql implementation chugs along pretty idle.