Re: Slow alter sequence with PG10.1

2018-01-22 Thread Michael Krüger
Hello all, I think a good alternative was found and seems to be working fine. I really do appreciate all the help and feedback. Many thanks. Regards, Michael Adrian Klaver schrieb am Di., 23. Jan. 2018 um 02:12 Uhr: > On 01/22/2018 02:47 PM, Michael Krüger wrote: > > Hello all, > > > > after c

Re: Slow alter sequence with PG10.1

2018-01-22 Thread Adrian Klaver
On 01/22/2018 02:47 PM, Michael Krüger wrote: Hello all, after changing the function to this: CREATE OR REPLACE FUNCTION multi_nextval( use_seqname text, use_increment integer)     RETURNS bigint     LANGUAGE 'plpgsql'     COST 100     VOLATILE AS $BODY$ DECLARE     reply int8;     lock_i

Re: Slow alter sequence with PG10.1

2018-01-22 Thread Kenneth Marshall
On Mon, Jan 22, 2018 at 04:40:54PM -0700, David G. Johnston wrote: > > > I guess - the reason I'm a bit disappointed from the new behavior is that > > we have used Postgresql for more than 10 years and it has never let us > > down. We have been able to improve our product with every new release of

Re: Slow alter sequence with PG10.1

2018-01-22 Thread David G. Johnston
On Mon, Jan 22, 2018 at 3:47 PM, Michael Krüger wrote: > > Is there any drawback to use setval compared to the ALTER SEQUENCE which I > have used before? If not, then this could be the work around to go with as > it has a similar performance to the original function. > ​Not that I can think of.

Re: Slow alter sequence with PG10.1

2018-01-22 Thread Peter Eisentraut
On 1/22/18 17:11, Michael Krüger wrote: > I do not fully understand the reasoning of making sequences > transactional in the first place. It was sequence DDL that was made transactional. Sequence use is still nontransactional. -- Peter Eisentraut http://www.2ndQuadrant.com/ Postgre

Re: Slow alter sequence with PG10.1

2018-01-22 Thread Michael Krüger
Hello all, after changing the function to this: CREATE OR REPLACE FUNCTION multi_nextval( use_seqname text, use_increment integer) RETURNS bigint LANGUAGE 'plpgsql' COST 100 VOLATILE AS $BODY$ DECLARE reply int8; lock_id int4; seq_idx int8; BEGIN SELECT oid::int4 I

Re: Changing locale/charset

2018-01-22 Thread Peter Eisentraut
On 1/22/18 16:18, Martin Moore wrote: > I created a 10.1 cluster on Debian using UTF8. > I’d like to convert it to LATIN1, but am having various issues. So, it’s > probably easiest to start again (I have a dump of the DB). > > To ensure I get it right, what is the correct way to create a cluste

Re: Slow alter sequence with PG10.1

2018-01-22 Thread Michael Krüger
Hi Adrian and all, I do not fully understand the reasoning of making sequences transactional in the first place. As far as I know its also not done on Oracle or SQL Server, but maybe I'm even wrong on that. What I question is a change in behavior of existing functionality with such big impact, wit

Re: Slow alter sequence with PG10.1

2018-01-22 Thread Adrian Klaver
On 01/22/2018 07:24 AM, Michael Krüger wrote: Dear community, I'm using PG10.1 on CentOS Linux release 7.4.1708 (Core) after upgrading it from PG9.6.6. My application heavily uses sequences and requires different increments of sequence numbers, e.g. a range of 100, 1000 or 5000 numbers, so it

Changing locale/charset

2018-01-22 Thread Martin Moore
I created a 10.1 cluster on Debian using UTF8. I’d like to convert it to LATIN1, but am having various issues. So, it’s probably easiest to start again (I have a dump of the DB). To ensure I get it right, what is the correct way to create a cluster with LATIN1 encoding, how to remove the exist

Hardware advice

2018-01-22 Thread Alban Hertroys
Hi all, At work we are in the process of setting up a data-warehouse using PG 10. I'm looking for a suitable server, but I hardly know anything about server-grade hardware. Hence, we're looking for some advice, preferably with some opportunity to discuss our situation and possibly things we di

Re: Using random() in update produces same random value for all

2018-01-22 Thread Tom Lane
Jeff Janes writes: > On Mon, Jan 22, 2018 at 9:16 AM, Tom Lane wrote: >> The point here is that that's an uncorrelated subselect --- ie, it >> contains no outer references --- so it need not be, and is not, >> re-evaluated at every outer row. > That seems rather circular. Why shouldn't a volati

Re: Using random() in update produces same random value for all

2018-01-22 Thread Jeff Janes
On Mon, Jan 22, 2018 at 9:16 AM, Tom Lane wrote: > Olleg Samoylov writes: > > Looked like random() is "volatile", but in subselect it works like > "stable". > > The point here is that that's an uncorrelated subselect --- ie, it > contains no outer references --- so it need not be, and is not, >

Re: Slow alter sequence with PG10.1

2018-01-22 Thread Laurenz Albe
Michael Krüger wrote: > I'm using PG10.1 on CentOS Linux release 7.4.1708 (Core) after upgrading it > from PG9.6.6. > My application heavily uses sequences and requires different increments of > sequence numbers, > e.g. a range of 100, 1000 or 5000 numbers, so it is not possible to set a > fixed

Re: Slow alter sequence with PG10.1

2018-01-22 Thread Ivan E. Panchenko
I also confirm this problem: Running Michael's script on 10.1 takes 314 seconds instead of 2.3 seconds on 9.6.5. Moreover adding some timing shows that on 10.1 the iteration execution time grows linearly with each iteration. (!!) If we remove ALTER SEQUENCE, the difference is only 2.5 times

Re: Slow alter sequence with PG10.1

2018-01-22 Thread David G. Johnston
On Mon, Jan 22, 2018 at 8:24 AM, Michael Krüger wrote: > Dear community, > > I'm using PG10.1 on CentOS Linux release 7.4.1708 (Core) after upgrading > it from PG9.6.6. My application heavily uses sequences and requires > different increments of sequence numbers, e.g. a range of 100, 1000 or 5000

Re: Slow alter sequence with PG10.1

2018-01-22 Thread Rakesh Kumar
why are you not using CACHE clause which is precisely for the purpose : cache The optional clause CACHE cache specifies how many sequence numbers are to be preallocated and stored in memory for faster access. The minimum value is 1 (only one value can be generated at a time, i.e., no cache), and

Re: Using random() in update produces same random value for all

2018-01-22 Thread Tom Lane
Olleg Samoylov writes: > Looked like random() is "volatile", but in subselect it works like "stable". The point here is that that's an uncorrelated subselect --- ie, it contains no outer references --- so it need not be, and is not, re-evaluated at every outer row. regard

Re: Using random() in update produces same random value for all

2018-01-22 Thread Olleg Samoylov
Yep, interesting.  Checked with PostgreSQL 10.1. => select *,random() from generate_series(1,10);  generate_series |  random -+---    1 | 0.308531506918371    2 | 0.126279713585973    3 | 0.984668150078505    4

Slow alter sequence with PG10.1

2018-01-22 Thread Michael Krüger
Dear community, I'm using PG10.1 on CentOS Linux release 7.4.1708 (Core) after upgrading it from PG9.6.6. My application heavily uses sequences and requires different increments of sequence numbers, e.g. a range of 100, 1000 or 5000 numbers, so it is not possible to set a fixed increment on a sequ

Re: License question regarding distribution of binaries

2018-01-22 Thread John McKown
On Sun, Jan 21, 2018 at 7:40 AM, Rafał Zabrowarny < rafal.zabrowa...@skyrise.tech> wrote: > Hi, > > > > My name is Rafał and I would like prepare lib to setup and run Pg within > integration tests. > > To do it I would like to prepare on Windows nuget package containing > necessary Pg’s binaries.

Re: Notify client when a table was full

2018-01-22 Thread Vincenzo Romano
2018-01-22 14:58 GMT+01:00 John McKown : > On Mon, Jan 22, 2018 at 2:07 AM, Steve Atkins wrote: >> >> >> > On Jan 21, 2018, at 6:44 PM, Vincenzo Romano >> > wrote: >> > >> > 2018-01-21 19:31 GMT+01:00 Francisco Olarte : >> >> On Sun, Jan 21, 2018 at 1:27 PM, Michael Paquier >> >> wrote: >> >>> O

Re: Notify client when a table was full

2018-01-22 Thread John McKown
On Mon, Jan 22, 2018 at 2:07 AM, Steve Atkins wrote: > > > On Jan 21, 2018, at 6:44 PM, Vincenzo Romano < > vincenzo.rom...@notorand.it> wrote: > > > > 2018-01-21 19:31 GMT+01:00 Francisco Olarte : > >> On Sun, Jan 21, 2018 at 1:27 PM, Michael Paquier > >> wrote: > >>> On Fri, Jan 19, 2018 at 03

Re: pgaudit?

2018-01-22 Thread Bjørn T Johansen
On Fri, 19 Jan 2018 12:53:19 -0800 Adrian Klaver wrote: > On 01/19/2018 03:33 AM, Bjørn T Johansen wrote: > > I found this, for RHEL 7: > > > > https://yum.postgresql.org/9.6/redhat/rhel-7-x86_64/repoview/pgaudit_96.html > > > > But I can not find the same package for PostgreSQL 10, is this an

Re: Notify client when a table was full

2018-01-22 Thread Steve Atkins
> On Jan 21, 2018, at 6:44 PM, Vincenzo Romano > wrote: > > 2018-01-21 19:31 GMT+01:00 Francisco Olarte : >> On Sun, Jan 21, 2018 at 1:27 PM, Michael Paquier >> wrote: >>> On Fri, Jan 19, 2018 at 03:40:01PM +, Raymond O'Donnell wrote: >> ... How do you define "full"? > > The only pos