Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can we implement the watch by trigger for PostgresDB? #20

Open
LuMerkle opened this issue Dec 26, 2019 · 2 comments
Open

can we implement the watch by trigger for PostgresDB? #20

LuMerkle opened this issue Dec 26, 2019 · 2 comments

Comments

@LuMerkle
Copy link

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.

@LuMerkle
Copy link
Author

Actually I mean trigger + pg_notify + listen on the go side (https://github.com/go-pg/pg)

@ibuildthecloud
Copy link
Contributor

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.

solmyrcan pushed a commit to solmyrcan/kine that referenced this issue Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants