Re: Partitioning a table by integer value (preferably in place)

2021-08-12 Thread Pól Ua Laoínecháin
Hi all - I resolved my issue - and took a 25 minute query down to 5 seconds. > I have a 400GB joining table (one SMALLINT and the other INTEGER - > What I would like to do is to partition by the SMALLINT (1 - 1000) > value - which would give 1,000 tables of 400MB each. I found this site very help

Re: log_statement GUC parameter

2021-08-12 Thread Mladen Gogala
Thank you Tom! It turns out that the Oracle way of doing things (SECURITY DEFINER) was the wrong way here. Thanks a bunch. On 8/12/21 4:37 PM, Tom Lane wrote: ctually, for that specific requirement, there's an easier way: ALTER USER target_user SET log_statement = 'all'; While the tar

Re: log_statement GUC parameter

2021-08-12 Thread Mladen Gogala
Hi Bruce Yes, I can. I have already done so and it works. I wrote a procedure because of my Oracle background, but it doesn't really matter. This was just a suggestion for the session settable parameters. Regards On 8/12/21 4:23 PM, Bruce Momjian wrote: I think you can write a SECURITY DEFI

Re: log_statement GUC parameter

2021-08-12 Thread Bruce Momjian
On Thu, Aug 12, 2021 at 04:37:16PM -0400, Tom Lane wrote: > [ dept. of second thoughts ] > > Adrian Klaver writes: > > On 8/12/21 1:19 PM, Mladen Gogala wrote: > >> The idea is to log all statements by the particular user, not by > >> everybody. > > > Would pg_stat_statements work for you?: > >

Re: log_statement GUC parameter

2021-08-12 Thread Tom Lane
[ dept. of second thoughts ] Adrian Klaver writes: > On 8/12/21 1:19 PM, Mladen Gogala wrote: >> The idea is to log all statements by the particular user, not by >> everybody. > Would pg_stat_statements work for you?: > https://www.postgresql.org/docs/current/pgstatstatements.html Actually, fo

Re: log_statement GUC parameter

2021-08-12 Thread Bruce Momjian
On Thu, Aug 12, 2021 at 04:30:12PM -0400, Tom Lane wrote: > Mladen Gogala writes: > > Unfortunately, only a superuser can set log_statement='all'; Would it be > > possible to execute set session log_statement='all'; as an ordinary > > user? I am trying to execute it from login.sql, a part of log

Re: log_statement GUC parameter

2021-08-12 Thread Tom Lane
Mladen Gogala writes: > Unfortunately, only a superuser can set log_statement='all'; Would it be > possible to execute set session log_statement='all'; as an ordinary > user? I am trying to execute it from login.sql, a part of login_hook > extension which implements on-login triggers in Postgre

Re: log_statement GUC parameter

2021-08-12 Thread Adrian Klaver
On 8/12/21 1:19 PM, Mladen Gogala wrote: Hi! The idea is to log all statements by the particular user, not by everybody. The user in question uses Weblogic 12.2.1.4  and creates a connection pool so I need to find out which statements are the longest running ones and make them perform. Wo

Re: log_statement GUC parameter

2021-08-12 Thread Bruce Momjian
On Thu, Aug 12, 2021 at 04:19:18PM -0400, Mladen Gogala wrote: > Hi! > > Unfortunately, only a superuser can set log_statement='all'; Would it be > possible to execute set session log_statement='all'; as an ordinary user? I > am trying to execute it from login.sql, a part of login_hook extension w

log_statement GUC parameter

2021-08-12 Thread Mladen Gogala
Hi! Unfortunately, only a superuser can set log_statement='all'; Would it be possible to execute set session log_statement='all'; as an ordinary user? I am trying to execute it from login.sql, a part of login_hook extension which implements on-login triggers in PostgreSQL. I will create a pro

Re: Getting pg_stat_database data takes significant time

2021-08-12 Thread Magnus Hagander
On Thu, Aug 12, 2021 at 4:38 PM hubert depesz lubaczewski wrote: > > On Thu, Aug 12, 2021 at 11:32:15AM +0200, Magnus Hagander wrote: > > Which database are you connected to? If you just want to look at the > > global stats, it might help to be connected to a database that is > > *not* the one wit

Re: Getting pg_stat_database data takes significant time

2021-08-12 Thread hubert depesz lubaczewski
On Thu, Aug 12, 2021 at 11:32:15AM +0200, Magnus Hagander wrote: > Which database are you connected to? If you just want to look at the > global stats, it might help to be connected to a database that is > *not* the one with all the tables in -- e.g. connect to "postgres" and > query pg_stat_databa

Re: Getting pg_stat_database data takes significant time

2021-08-12 Thread hubert depesz lubaczewski
On Thu, Aug 12, 2021 at 09:08:27AM -0400, Alvaro Herrera wrote: > On 2021-Aug-11, hubert depesz lubaczewski wrote: > > > On Wed, Aug 11, 2021 at 10:16:13AM -0400, Alvaro Herrera wrote: > > > 1. this depends on reading the stats file; that's done once per > > > transaction. So if you run the query

Re: Getting pg_stat_database data takes significant time

2021-08-12 Thread Alvaro Herrera
On 2021-Aug-11, hubert depesz lubaczewski wrote: > On Wed, Aug 11, 2021 at 10:16:13AM -0400, Alvaro Herrera wrote: > > 1. this depends on reading the stats file; that's done once per > > transaction. So if you run the query twice in a transaction, the second > > time will take less time. You can

Re: move data repository : server does not restart (windows 10)

2021-08-12 Thread Dave Cramer
It would be helpful to see the logs from the failed start. Dave Cramer www.postgres.rocks On Thu, 12 Aug 2021 at 07:59, celati Laurent wrote: > Good morning, > > I want to move the data folder from default path to another drive/path. > I made an attempt thaks to this link ressource : > > > htt

move data repository : server does not restart (windows 10)

2021-08-12 Thread celati Laurent
Good morning, I want to move the data folder from default path to another drive/path. I made an attempt thaks to this link ressource : https://wiki.postgresql.org/wiki/Change_the_default_PGDATA_directory_on_Windows I checked the 4 requirements. But the postgres server does not restart. Could y

Re: Getting pg_stat_database data takes significant time

2021-08-12 Thread Magnus Hagander
On Wed, Aug 11, 2021 at 6:34 PM hubert depesz lubaczewski wrote: > > On Wed, Aug 11, 2021 at 10:16:13AM -0400, Alvaro Herrera wrote: > > 1. this depends on reading the stats file; that's done once per > > transaction. So if you run the query twice in a transaction, the second > > time will take l

Re: 3867653, EMM1 cluster issue on 23rd May--core generated --design feedback

2021-08-12 Thread Simon Riggs
On Mon, 12 Jul 2021 at 16:07, M Tarkeshwar Rao wrote: > > Hi All, > > We are getting following core with following use case: > > Case: We made max_connections as 15 and 10 different processes opening 15 > connections with server. It is running fine. But after few hours it giving > following >

Re: ERROR: invalid memory alloc request size when committing transaction

2021-08-12 Thread Simon Riggs
On Thu, 12 Aug 2021 at 06:42, Michael Harris wrote: > > Thanks Tom, > > > How many is "a large number"? > > 377k approx. I'm going to guess that it is the invalidation messages for all the DDL that is causing the memory allocation error. If you set wal_level = minimal then this might work. The t