Re: optimizing a join against a windowed function

2024-08-30 Thread Torsten Förtsch
Try perhaps something along these lines: ``` SELECT t.id, i.insight_id FROM taxpayers AS t JOIN LATERAL ( SELECT x.id AS insight_id FROM insights AS x WHERE x.taxpayer_id = t.id AND x.year IS NOT NULL ORDER BY year DESC

Re: default privileges are npt working

2024-08-30 Thread Christoph Moench-Tegeder
## Atul Kumar (akumar14...@gmail.com): > Then I granted default "select" privileges to reader *user *to read data of > all tables created by writer *user* using below command: > > alter default privileges in schema grant select on tables > to . "ALTER DEFAULT PRIVILEGES allows you to set the pr

Re: default privileges are npt working

2024-08-30 Thread David G. Johnston
On Friday, August 30, 2024, Atul Kumar wrote: > > > I have a postgres instance running on version 15 in centos7. > > I have created a custom database and revoked all public privileges from > that database. > Would be better to provide the actual psql script of what you’ve done instead of writing

Re: optimizing a join against a windowed function

2024-08-30 Thread David Rowley
On Fri, 30 Aug 2024 at 23:36, James Brown wrote: > I have two tables: one named taxpayers which has a goodish number of columns > an an integer PK id, and one named insights, which has a taxpayer_id foreign > key to taxpayers, a year, and (again) a lot of other columns. There's an > index on in

Re: Analytic Function Bug

2024-08-30 Thread David Rowley
On Fri, 30 Aug 2024 at 23:45, Rumpi Gravenstein wrote: > Here's the output of the script you requested. > These results look correct to me. Not the same as the ones you originally reported. David

Re: PgBackRest full backup first time : Verification

2024-08-30 Thread Greg Sabino Mullane
> > database size: 146.9GB, database backup size: 146.9GB > repo1: backup size: 20.6GB It looks to me as though everything is working as expected. You took a full backup of your system, which was around 147GB - most of which is in a tablespace. It got compressed down to 20GB. You then took two in

Re: Analytic Function Bug

2024-08-30 Thread Rumpi Gravenstein
Wait...I see my issue. Duh! The where clause is applied after the CTE is evaluated On Fri, Aug 30, 2024 at 7:37 AM Rumpi Gravenstein wrote: > > that the lag() functions are seeing some rows that don't show up in > the final output. > > > I'm under the impression that the predicate filter is

Postgres Logical Replication - how to see what subscriber is doing with received data?

2024-08-30 Thread Michael Jaskiewicz
I've got two Postgres 13 databases on AWS RDS. * One is a master, the other a slave using logical replication. * Replication has fallen behind by about 350Gb. * The slave was maxed out in terms of CPU for the past four days because of some jobs that were ongoing so I'm not sure what l

Re: Analytic Function Bug

2024-08-30 Thread Rumpi Gravenstein
that the lag() functions are seeing some rows that don't show up in the final output. I'm under the impression that the predicate filter is applied before the analytic is evaluated. Are you suggesting that I have this wrong -- the analytic is evaluated and then the filter is applied? On Thu, A

optimizing a join against a windowed function

2024-08-30 Thread James Brown
Hello: I'm attempting to figure out whether an optimizer behavior I'm seeing is a PostgreSQL bug or expected behavior. The scenario: I have two tables: one named taxpayers which has a goodish number of columns an an integer PK id, and one named insights, which has a taxpayer_id foreign key to tax

Re: default privileges are npt working

2024-08-30 Thread Muhammad Usman Khan
Hi. I think the ALTER DEFAULT PRIVILEGES command affects only tables that are created after the command is executed. Tables created by the writer user before you executed the ALTER DEFAULT PRIVILEGES command would not automatically have select privileges granted to the reader user. You can try by

default privileges are npt working

2024-08-30 Thread Atul Kumar
Hi, I have a postgres instance running on version 15 in centos7. I have created a custom database and revoked all public privileges from that database. Then I have created a custom schema in that custom database. Now I have created one writer *user* and one reader *user *by postgres superuser a