Re: Any risk or overhead considerations for frequently executing queries against catalog tables?

2025-01-25 Thread Pavel Stehule
so 25. 1. 2025 v 21:01 odesílatel Frits Hoogland napsal: > I am looking at whether sampling key database catalog information per > second would have any drawback whatsoever. > I think you're saying that you think isn't the case, except maybe for > pg_database, and I figure that is because of the

Re: Any risk or overhead considerations for frequently executing queries against catalog tables?

2025-01-25 Thread frits . hoogland
Thank you, I will look, very interesting!One thing I found is that because certain statistics are provided after a query has run, measuring them in a fine grained way shows a peak for something that in reality is taking place over a period of time.  If anyone has a url of where this can be found, I

Re: Read-only connectios optimizatios

2025-01-25 Thread peter plachta
You can still block vacuum from running if you have long running (or very aggressive) read transactions. I don’t think they are very helpful or performant from a Postgres engine perspective. They can be helpful in application development because they will fail if devs attempt any mutations insid

Re: Any risk or overhead considerations for frequently executing queries against catalog tables?

2025-01-25 Thread peter plachta
DataDog — which implements such metrics for Postgres - has ran into multiple issues doing this type of thing. You may be able to search their bugs / repo to see what they were. I just can’t remember them off hand, it’s been a while.Sent from my iPhoneOn Jan 25, 2025, at 12:01 PM, Frits Hoogland wr

Re: Any risk or overhead considerations for frequently executing queries against catalog tables?

2025-01-25 Thread Frits Hoogland
I am looking at whether sampling key database catalog information per second would have any drawback whatsoever. I think you're saying that you think isn't the case, except maybe for pg_database, and I figure that is because of the frozen and multi xact fields per database. If the database clie

Re: Any risk or overhead considerations for frequently executing queries against catalog tables?

2025-01-25 Thread Pavel Stehule
Hi so 25. 1. 2025 v 18:00 odesílatel Frits Hoogland napsal: > Thank you Pavel, that is really useful. I can imagine other people > thinking about getting fine grained data from postgres might wonder the > same as I do about this. > And really from a computer's perspective I would say that once a

Re: Read-only connectios optimizatios

2025-01-25 Thread Laurenz Albe
On Sat, 2025-01-25 at 14:55 +, Edson Richter wrote: > -Connections are established using the jdbc "readonly" attribute. > > Does PostgreSQL perform any optimization on queries in this scenario to avoid > establishing locks? Or are these queries treated like any other? The only difference that

Re: Any risk or overhead considerations for frequently executing queries against catalog tables?

2025-01-25 Thread Frits Hoogland
Thank you Pavel, that is really useful. I can imagine other people thinking about getting fine grained data from postgres might wonder the same as I do about this. And really from a computer's perspective I would say that once a second isn't really a high frequency? If I time the amount of time

Read-only connectios optimizatios

2025-01-25 Thread Edson Richter
Scenario: -PostgreSQL 13 latest version; -I have some reporting users, with "SELECT,REFERENCES" permissions on all tables in the public schema. -Connections are established using the jdbc "readonly" attribute. Does PostgreSQL perform any optimization on queries in this scenario to avoid establis

Re: Any risk or overhead considerations for frequently executing queries against catalog tables?

2025-01-25 Thread Pavel Stehule
Hi so 25. 1. 2025 v 12:23 odesílatel Frits Hoogland napsal: > For monitoring database behaviour and trying to build an history of > activity, if I would create an application that creates a single connection > and execute something like: > select * from pg_stat_activity; > select * from pg_stat_

Any risk or overhead considerations for frequently executing queries against catalog tables?

2025-01-25 Thread Frits Hoogland
For monitoring database behaviour and trying to build an history of activity, if I would create an application that creates a single connection and execute something like: select * from pg_stat_activity; select * from pg_stat_database; select * from pg_stat_bgwriter; select * from pg_stat_wal; se