Dropped User Session

2018-11-30 Thread Vishal Kohli
Hello, Is there a view in database to find sessions PID of dropped user in database? Thanks, Vishal

Re: Dropped User Session

2018-11-30 Thread Vishal Kohli
I dropped a connected user in database, cannot find pid in pg_stat_activity. I can query from dropped user session but how to find session in database without going into OS. On Fri, 30 Nov 2018 at 5:08 PM, Vishal Kohli wrote: > Hello, > > Is there a view in database to find sessions PID of dropp

Re: surprising query optimisation

2018-11-30 Thread Chris Withers
On 28/11/2018 22:49, Stephen Frost wrote: * Chris Withers (ch...@withers.org) wrote: We have an app that deals with a lot of queries, and we've been slowly seeing performance issues emerge. We take a lot of free form queries from users and stumbled upon a very surprising optimisation. So, we ha

Re: surprising query optimisation

2018-11-30 Thread Stephen Frost
Greetings, On Fri, Nov 30, 2018 at 07:52 Chris Withers wrote: > On 28/11/2018 22:49, Stephen Frost wrote: > > * Chris Withers (ch...@withers.org) wrote: > >> We have an app that deals with a lot of queries, and we've been slowly > >> seeing performance issues emerge. We take a lot of free form q

Re: surprising query optimisation

2018-11-30 Thread Chris Withers
On 30/11/2018 12:55, Stephen Frost wrote: > I'd suggest you check out the wiki article written about this kind of > question: > > https://wiki.postgresql.org/wiki/Slow_Query_Questions Have you tried a partial index on state!=‘RSV’? The solution I originally posted, that we

Re: surprising query optimisation

2018-11-30 Thread Stephen Frost
Greetings, On Fri, Nov 30, 2018 at 08:00 Chris Withers wrote: > On 30/11/2018 12:55, Stephen Frost wrote: > > > I'd suggest you check out the wiki article written about this > kind of > > > question: > > > > > > https://wiki.postgresql.org/wiki/Slow_Query_Questions > > > > >

Log level of logical decoding

2018-11-30 Thread Francesco Nidito
Hi All, With reference to an old thread (https://www.postgresql.org/message-id/8307.1419439826%40sss.pgh.pa.us), our application polls the database instance periodically to check if there are new transaction in the WAL waiting to be processed. As a consequence of this, our log file is full of

Re: surprising query optimisation

2018-11-30 Thread Stephen Frost
Greetings, * Chris Withers (ch...@withers.org) wrote: > On 28/11/2018 22:49, Stephen Frost wrote: > >* Chris Withers (ch...@withers.org) wrote: > >>We have an app that deals with a lot of queries, and we've been slowly > >>seeing performance issues emerge. We take a lot of free form queries from >

psql is hanging

2018-11-30 Thread John Smith
We have a long script of sql that we run, several thousand lines of sql. If I execute the script from start to finish, somewhere in the middle of it, one sql command will hang and take 2 to 3 hours. During this time, "htop" shows 100% cpu usage with a postgresql process, so it appears to be doing s

Re: psql is hanging

2018-11-30 Thread Adrian Klaver
On 11/30/18 7:53 AM, John Smith wrote: We have a long script of sql that we run, several thousand lines of sql. If I execute the script from start to finish, somewhere in the middle of it, one sql command will hang and take 2 to 3 hours. During this time, "htop" shows 100% cpu usage with a post

Re: psql is hanging

2018-11-30 Thread Chris Mair
We're kind of pulling out our hair here, any ideas? You might try issuing the command analyze; right *before* the command that hangs. The rationale behind this idea is that your script changed data and the "hung" command uses a wrong plan based on outdated statistics. By the time you run

Re: psql is hanging

2018-11-30 Thread Chris Mair
We're kind of pulling out our hair here, any ideas? You might try issuing the command   analyze; right *before* the command that hangs. Clarification: I meant to say: "put it into the script at the location right before the command, that hangs". Bye, Chris.

Re: psql is hanging

2018-11-30 Thread Ron
On 11/30/2018 09:53 AM, John Smith wrote: We have a long script of sql that we run, several thousand lines of sql. If I execute the script from start to finish, somewhere in the middle of it, one sql command will hang and take 2 to 3 hours. During this time, "htop" shows 100% cpu usage with a p

Re: psql is hanging

2018-11-30 Thread Steve Crawford
On Fri, Nov 30, 2018 at 8:05 AM Chris Mair wrote: > > > We're kind of pulling out our hair here, any ideas? > > You might try issuing the command > >analyze; > > right *before* the command that hangs. > > You might consider trying the "auto_explain" module ( https://www.postgresql.org/docs/cu

Re: psql is hanging

2018-11-30 Thread Tom Lane
Ron writes: > We have a seemingly identical problem in v9.6 on our big prod databases.  It > worked perfectly in 8.4 *and works perfectly in 9.6 our small staging > servers*. > A giant sql script that drops the oldest child tables from a large set of > partitioned tables (by dropping all releva

Re: psql is hanging

2018-11-30 Thread Ron
On 11/30/2018 10:38 AM, Tom Lane wrote: Ron writes: We have a seemingly identical problem in v9.6 on our big prod databases.  It worked perfectly in 8.4 *and works perfectly in 9.6 our small staging servers*. A giant sql script that drops the oldest child tables from a large set of partitioned

Re: psql is hanging

2018-11-30 Thread Geoff Winkless
On Fri, 30 Nov 2018 at 15:53, John Smith wrote: > We have a long script of sql that we run, several thousand lines of sql. If I > execute the script > from start to finish, somewhere in the middle of it, one sql command will > hang and take 2 to > 3 hours. During this time, "htop" shows 100% cpu

postgis after pg_upgrade

2018-11-30 Thread Slavcho Trnkovski
Hi, I have postgresql 9.4 with postgis extension installed (latest version, 2.4.5). I upgraded postgresql from 9.4 to 9.6. After upgrading to 9.6 I get the following result from PostGIS_full_version() select PostGIS_full_version(); postgis_full_version

Re: postgis after pg_upgrade

2018-11-30 Thread Paul Ramsey
If you install the new version, and then use ‘ALTER EXTENSION UPDATE’ to update the SQL-side bindings, everything should improve. > On Nov 30, 2018, at 5:11 AM, Slavcho Trnkovski wrote: > > Hi, > > I have postgresql 9.4 with postgis extension installed (latest version, > 2.4.5). I upgraded po

Re: psql is hanging

2018-11-30 Thread John Smith
Thanks Chris and Steve for the analyze suggestion; That will be my next test! On Fri, Nov 30, 2018 at 11:27 AM Steve Crawford < scrawf...@pinpointresearch.com> wrote: > > > On Fri, Nov 30, 2018 at 8:05 AM Chris Mair wrote: > >> >> > We're kind of pulling out our hair here, any ideas? >> >> You m

Vacuum and Materialized view refresh slow

2018-11-30 Thread Vikas Sharma
Hello There, We have postgres 9.6 with 3 slaves replicated in synchronous commit. we recently migrated to to another cloud provider. Though we have the same configuration for VMs and postgres, we are experiencing systemwide slowness with writes to database. I am more concerned about a scheduled

Re: Vacuum and Materialized view refresh slow

2018-11-30 Thread Rene Romero Benavides
Have you benchmarked the new infrastructure's IO and network performance? why did you switch providers? was it because of cost?

Re: Vacuum and Materialized view refresh slow

2018-11-30 Thread Rob Sargent
On 11/30/18 1:53 PM, Rene Romero Benavides wrote: Have you benchmarked the new infrastructure's IO and network performance? why did you switch providers? was it because of cost? And have you proven to yourself that all the indices are in place, stats are up-to-date?  You didn't by any chance mi

Re: Dump table using pg_dump vs pg_restore -f

2018-11-30 Thread Adrian Klaver
On 11/29/18 7:31 AM, Adrian Klaver wrote: Postgres 10.6 I am getting different output using: pg_dump -d production -U postgres  -s -t container -f cont.sql vs pg_restore -s -t container -f container.sql production_112818.out In the docs: https://www.postgresql.org/docs/10/app-pgrestore.

Re: surprising query optimisation

2018-11-30 Thread Gavin Flower
On 01/12/2018 04:33, Stephen Frost wrote: Greetings, * Chris Withers (ch...@withers.org) wrote: On 28/11/2018 22:49, Stephen Frost wrote: * Chris Withers (ch...@withers.org) wrote: We have an app that deals with a lot of queries, and we've been slowly seeing performance issues emerge. We take