Re: Problems pushing down WHERE-clause to underlying view

2019-02-15 Thread Tom Lane
=?UTF-8?Q?Nicklas_Av=c3=a9n?= writes: > I also, in the first query, changed the where clause to filter on > machine_key in table contractor _access. Just to illustrate the problem > better. > Both queries filter on the same table which is joined the same way. But > in the second example the wh

Re: WSL (windows subsystem on linux) users will need to turn fsync off as of 11.2

2019-02-15 Thread Ron
On 2/15/19 4:04 PM, Bruce Klein wrote: [snip] I'm glad Microsoft is trying though If Steve "Linux is a cancer" Ballmer were dead, he's be spinning in his grave... -- Angular momentum makes the world go 'round.

Re: Problems pushing down WHERE-clause to underlying view

2019-02-15 Thread Adrian Klaver
On 2/15/19 12:43 PM, Nicklas Avén wrote: > I have not had chance to fully go through all of below. Some questions/suggestions: > > 1) Thanks for the formatted queries. If I could make a suggestion, when aliasing could you include AS. It would make finding what l.* refers to easier for tho

Re: WSL (windows subsystem on linux) users will need to turn fsync off as of 11.2

2019-02-15 Thread Bruce Klein
> I guess the OP is reporting about a .deb that was built on a real Linux system Yes, I (OP) installed via: % wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - % sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -sc)-pgdg main

Re: Subquery to select max(date) value

2019-02-15 Thread Rich Shepard
On Fri, 15 Feb 2019, Andrew Gierth wrote: Rich> I've not before run 'explain' on a query. Would that be Rich> appropriate here? Yes. Andrew, I'll learn how to use it. The problem here is that you have no join conditions at all, so the result set of this query is massive. And you've duplica

Re: Subquery to select max(date) value

2019-02-15 Thread Andrew Gierth
> "Rich" == Rich Shepard writes: Rich> Using LIMIT 1 produces only the first returned row. This Rich> statement (using max() for next_contact) produces no error Rich> message, but also no results so I killed the process after 30 Rich> seconds. Without a syntax error for guidance I don't k

Re: Subquery to select max(date) value

2019-02-15 Thread Rich Shepard
On Fri, 15 Feb 2019, Andrew Gierth wrote: LATERAL (SELECT ...) is syntactically like (SELECT ...) in that it comes _after_ a "," in the from-clause or after a [LEFT] JOIN keyword. Andrew, Yes, the missing ',' made a big difference. You'd want a condition here that references the "people"

Re: WSL (windows subsystem on linux) users will need to turn fsync off as of 11.2

2019-02-15 Thread Thomas Munro
On Sat, Feb 16, 2019 at 6:50 AM Andres Freund wrote: > On February 15, 2019 9:44:50 AM PST, Tom Lane wrote: > >Andres Freund writes: > >> On February 15, 2019 9:13:10 AM PST, Tom Lane > >wrote: > >>> I'm of the opinion that we shouldn't be panicking for > >sync_file_range > >>> failure, period.

Re: Channel binding not supported using scram-sha-256 passwords

2019-02-15 Thread Hugh Ranalli
On Fri, 15 Feb 2019 at 16:14, Bruce Momjian wrote: > The PG 11 release notes are clear that channel binding is not supported > in a usable way yet: > I did see that. However, I'm not *trying* to use it. I set up accounts with scram-sha-256 passwords, and when trying to connect I get this message

Re: Channel binding not supported using scram-sha-256 passwords

2019-02-15 Thread Bruce Momjian
On Fri, Feb 15, 2019 at 03:41:37PM -0500, Hugh Ranalli wrote: > > I've been trying to implement scram-sha-256 passwords on PostgreSQL 11.1. > However, connection attempts whether through Python (psycopg2) or psql fail > with the message: "channel binding not supported by this build." I've tried >

Re: Subquery to select max(date) value

2019-02-15 Thread Rich Shepard
On Fri, 15 Feb 2019, Andrew Gierth wrote: LATERAL (SELECT ...) is syntactically like (SELECT ...) in that it comes _after_ a "," in the from-clause or after a [LEFT] JOIN keyword. Don't think of LATERAL as being a type of join, think of it as qualifying the (SELECT ...) that follows. Andrew,

Re: Subquery to select max(date) value

2019-02-15 Thread Andrew Gierth
> "Rich" == Rich Shepard writes: Rich> I found a couple of web pages describing the lateral join yet Rich> have not correctly applied them. The manual's page did not help Rich> me get the correct syntax, either. Think I'm close, however: Rich> select p.person_id, p.lname, p.fname, p.dire

Re: Trigger function always logs postgres as user name

2019-02-15 Thread Alexander Reichstadt
HI, The answer to the question is that you need to use session_user instead of user or current_user. Cheers, Alex > On 9 Feb 2019, at 10:08, Alexander Reichstadt wrote: > > Hi, > > I setup trigger functions for logging, and while they do work and get > triggered, the current_user always in

Re: Problems pushing down WHERE-clause to underlying view

2019-02-15 Thread Nicklas Avén
> I have not had chance to fully go through all of below. Some questions/suggestions: > > 1) Thanks for the formatted queries. If I could make a suggestion, when aliasing could you include AS. It would make finding what l.* refers to easier for those of us with old eyes:) > Yes, of course,

Channel binding not supported using scram-sha-256 passwords

2019-02-15 Thread Hugh Ranalli
I've been trying to implement scram-sha-256 passwords on PostgreSQL 11.1. However, connection attempts whether through Python (psycopg2) or psql fail with the message: "channel binding not supported by this build." I've tried clearing scram_channel_binding in my global psqlrc ("\set scram_channel_b

Re: Subquery to select max(date) value

2019-02-15 Thread Rich Shepard
On Wed, 13 Feb 2019, Andrew Gierth wrote: You want LATERAL. Andrew, et al,: I found a couple of web pages describing the lateral join yet have not correctly applied them. The manual's page did not help me get the correct syntax, either. Think I'm close, however: select p.person_id, p.lname,

Re: Promoted slave tries to archive previously archived WAL file

2019-02-15 Thread Andre Piwoni
Ok. I think I uncovered a bug. My slave nodes were created using pg_basebackup with --wal-method=stream. If I understand right this option streams WAL files generated during backup and this WAL file was 00010002 but its contents were different from what was on the primary and in WA

Re: Size estimation of postgres core files

2019-02-15 Thread Jeremy Finzel
> > It doesn't write out all of RAM, only the amount in use by the > particular backend that crashed (plus all the shared segments attached > by that backend, including the main shared_buffers, unless you disable > that as previously mentioned). > > And yes, it can take a long time to generate a la

Re: Problems pushing down WHERE-clause to underlying view

2019-02-15 Thread Adrian Klaver
On 2/15/19 9:27 AM, Nicklas Avén wrote: On 2/15/19 5:06 PM, Adrian Klaver wrote: > On 2/15/19 7:28 AM, Nicklas Avén wrote: >> Hi >> >> The problem is that it always calculates all those 22000 rows even if the user id I use only gives 250 rows. >> >> So, the query uses 4 seconds instead o

Re: Size estimation of postgres core files

2019-02-15 Thread Andrew Gierth
> "Jeremy" == Jeremy Finzel writes: Jeremy> Yes Linux. This is very helpful, thanks. A follow-up question - Jeremy> will it take postgres a really long time to crash (and Jeremy> hopefully recover) if I have say 1T of RAM because it has to Jeremy> write that all out to a core file first?

Promoted slave tries to archive previously archived WAL file

2019-02-15 Thread Andre Piwoni
I have master and slave running with the following contents of their pg_wal directories and archivedir: ls -l /mnt/pgsql/archive/ -rw-rw-rw-. 1 root root 16777216 Feb 15 09:39 00010001 -rw-rw-rw-. 1 root root 16777216 Feb 15 09:39 00010002 -rw-rw-rw-. 1 root root

Re: Size estimation of postgres core files

2019-02-15 Thread Jeremy Finzel
> > In Linux, yes. Not sure about other OSes. > > You can turn off the dumping of shared memory with some unusably > unfriendly bitwise arithmetic using the "coredump_filter" file in /proc > for the process. (It's inherited by children, so you can just set it > once for postmaster at server start

Re: PostgreSql Version Compatibility With Apache ActiveMQ

2019-02-15 Thread Adrian Klaver
On 2/15/19 8:33 AM, Rameshbabu Paulsamy (UST, IND) wrote: Thanks Adrian for the response. I had posted it there already. As I didn't get any response, Tried to check in here. Only other suggestion I have is to try it. Spin up a 10.x or 11.x instance of Postgres and run ActiveMQ against it and

Re: WSL (windows subsystem on linux) users will need to turn fsync off as of 11.2

2019-02-15 Thread Andres Freund
On February 15, 2019 9:44:50 AM PST, Tom Lane wrote: >Andres Freund writes: >> On February 15, 2019 9:13:10 AM PST, Tom Lane >wrote: >>> I'm of the opinion that we shouldn't be panicking for >sync_file_range >>> failure, period. > >> With some flags it's strictly required, it does"eat"errors

Re: WSL (windows subsystem on linux) users will need to turn fsync off as of 11.2

2019-02-15 Thread Tom Lane
Andres Freund writes: > On February 15, 2019 9:13:10 AM PST, Tom Lane wrote: >> I'm of the opinion that we shouldn't be panicking for sync_file_range >> failure, period. > With some flags it's strictly required, it does"eat"errors depending on the > flags. So I'm not sure I understand? Really

Re: WSL (windows subsystem on linux) users will need to turn fsync off as of 11.2

2019-02-15 Thread Andres Freund
On February 15, 2019 9:13:10 AM PST, Tom Lane wrote: >Andres Freund writes: >> I suspect that's because WSL has an empty implementation of >> sync_file_range(), i.e. it unconditionally returns ENOSYS. But as >> configure detects it, we still emit calls for it. I guess we ought >to >> except E

Re: Problems pushing down WHERE-clause to underlying view

2019-02-15 Thread Nicklas Avén
On 2/15/19 5:06 PM, Adrian Klaver wrote: > On 2/15/19 7:28 AM, Nicklas Avén wrote: >> Hi >> >> The problem is that it always calculates all those 22000 rows even if the user id I use only gives 250 rows. >> >> So, the query uses 4 seconds instead of under 100 ms. > > https://www.postgresql.org

Re: loading plpython error

2019-02-15 Thread Alan Nilsson
Indeed, that was it. Thank you Tom! alan > On Feb 14, 2019, at 4:42 PM, Tom Lane wrote: > > Alan Nilsson writes: >> Platform: Linux x86-64, CentOS 6, Postgres 11.1. >> We have installed from the YUM repo. The server runs fine but we are trying >> to add python support. > >> yum install p

Re: WSL (windows subsystem on linux) users will need to turn fsync off as of 11.2

2019-02-15 Thread Tom Lane
Andres Freund writes: > I suspect that's because WSL has an empty implementation of > sync_file_range(), i.e. it unconditionally returns ENOSYS. But as > configure detects it, we still emit calls for it. I guess we ought to > except ENOSYS for the cases where we do panic-on-fsync-failure? I'm of

Re: WSL (windows subsystem on linux) users will need to turn fsync off as of 11.2

2019-02-15 Thread Andres Freund
Hi, On 2019-02-14 19:48:05 -0500, Tom Lane wrote: > Bruce Klein writes: > > If you are running Postgres inside Microsoft WSL (at least on Ubuntu, maybe > > on others too), and just picked up a software update to version 11.2, you > > will need to go into your /etc/postgresql.conf file and set fsy

RE: PostgreSql Version Compatibility With Apache ActiveMQ

2019-02-15 Thread Rameshbabu Paulsamy (UST, IND)
Thanks Adrian for the response. I had posted it there already. As I didn't get any response, Tried to check in here. Please help ! Thanks Ramesh -Original Message- From: Adrian Klaver [mailto:adrian.kla...@aklaver.com] Sent: Friday, 15 February, 2019 9:15 PM To: Rameshbabu Paulsamy (U

Re: Size estimation of postgres core files

2019-02-15 Thread Alvaro Herrera
On 2019-Feb-15, Jeremy Finzel wrote: > I am trying to determine the upper size limit of a core file generated for > any given cluster. Is it feasible that it could actually be the entire > size of the system memory + shared buffers (i.e. really huge)? In Linux, yes. Not sure about other OSes.

Size estimation of postgres core files

2019-02-15 Thread Jeremy Finzel
I am trying to determine the upper size limit of a core file generated for any given cluster. Is it feasible that it could actually be the entire size of the system memory + shared buffers (i.e. really huge)? I've done a little bit of testing of this myself, but want to be sure I am clear on this

Re: How to setup only one connection for the whole event loop?

2019-02-15 Thread Adrian Klaver
On 2/14/19 8:06 AM, Dominic Gua�a wrote: Dear all, I am new to postgresql and I am creating a c program that can receive request from different users. I want to maximize the performance of postgresql so I intend to just create 1 connection that would service all queries of different users. Ho

Re: Problems pushing down WHERE-clause to underlying view

2019-02-15 Thread Adrian Klaver
On 2/15/19 7:28 AM, Nicklas Avén wrote: Hi We have a system with 2 layers of views. It is about forestry. The first layer contains the logic like grouping volumes in logs together to stems or harvesting areas and joining species names to codes and things like that. The second layer just jo

Re: PostgreSql Version Compatibility With Apache ActiveMQ

2019-02-15 Thread Adrian Klaver
On 2/15/19 5:55 AM, Rameshbabu Paulsamy (UST, IND) wrote: Hi, I am using Apache ActiveMQ version 5.15.2 and we are connected to Postgresql version 9.6 My DB team is planning to upgrade to 10.5 or 11.1 version. Could you please let me know if this Postgre versions are compatible with  Active

Problems pushing down WHERE-clause to underlying view

2019-02-15 Thread Nicklas Avén
Hi We have a system with 2 layers of views. It is about forestry. The first layer contains the logic like grouping volumes in logs together to stems or harvesting areas and joining species names to codes and things like that. The second layer just joins this underlying views to a table with

Re: Shared hosting with FDW on AWS RDS

2019-02-15 Thread Bruno Lavoie
On 2019-02-14 10:21 p.m., Bruce Momjian wrote: On Sun, Feb 10, 2019 at 03:19:48PM -0800, Paul Jungwirth wrote: On 2/10/19 2:57 PM, auxsvr wrote: We'd like to configure an RDS server for shared hosting. The idea is that every customer will be using a different database and FDW will be configu

PostgreSql Version Compatibility With Apache ActiveMQ

2019-02-15 Thread Rameshbabu Paulsamy (UST, IND)
Hi, I am using Apache ActiveMQ version 5.15.2 and we are connected to Postgresql version 9.6 My DB team is planning to upgrade to 10.5 or 11.1 version. Could you please let me know if this Postgre versions are compatible with ActiveMQ 5.15.2 Thanks in Advance. Regards Ramesh

How to setup only one connection for the whole event loop?

2019-02-15 Thread Dominic Gua�a
Dear all, I am new to postgresql and I am creating a c program that can receive request from different users. I want to maximize the performance of postgresql so I intend to just create 1 connection that would service all queries of different users. How do I do this? Do I create a new connect