Re: [HACKERS] Sequence Access Method WIP

2016-04-05 Thread Petr Jelinek
On 04/04/16 15:53, Fabrízio de Royes Mello wrote: On Thu, Mar 31, 2016 at 9:19 AM, Petr Jelinek mailto:p...@2ndquadrant.com>> wrote: > > Hi, > > new version attached that should fix the issue. It was alignment - honestly don't know what I was thinking using fixed alignment when the AMs can

Re: [HACKERS] Sequence Access Method WIP

2016-03-30 Thread Petr Jelinek
Hi, Thanks for review. On 30/03/16 15:22, Jose Luis Tallon wrote: [Partial review] Evaluated: 0002-gapless-seq-2016-03-29-2.patch Needs updating code copyright years ... or is this really from 2013? [ contrib/gapless_seq/gapless_seq.c ] Patch applies cleanly to current master (3063e7a84026ced

Re: [HACKERS] Sequence Access Method WIP

2016-03-30 Thread Jose Luis Tallon
The following review has been posted through the commitfest application: make installcheck-world: not tested Implements feature: not tested Spec compliant: not tested Documentation:not tested [Partial review] Evaluated: 0002-gapless-seq-2016-03-29-2.patch Needs updatin

Re: [HACKERS] Sequence Access Method WIP

2016-03-29 Thread Fabrízio de Royes Mello
On Tue, Mar 29, 2016 at 5:58 PM, Petr Jelinek wrote: > > On 29/03/16 22:08, Fabrízio de Royes Mello wrote: >> >> >> >> On Tue, Mar 29, 2016 at 4:59 PM, Petr Jelinek > > wrote: >> > >> > On 29/03/16 19:46, Fabrízio de Royes Mello wrotez >> >> >> >> >> >> > >> >>

Re: [HACKERS] Sequence Access Method WIP

2016-03-29 Thread Petr Jelinek
On 29/03/16 22:08, Fabrízio de Royes Mello wrote: On Tue, Mar 29, 2016 at 4:59 PM, Petr Jelinek mailto:p...@2ndquadrant.com>> wrote: > > On 29/03/16 19:46, Fabrízio de Royes Mello wrotez >> >> >> > >> > Hmm I am unable to reproduce this. What OS? Any special configure >> flags you use?

Re: [HACKERS] Sequence Access Method WIP

2016-03-29 Thread Fabrízio de Royes Mello
On Tue, Mar 29, 2016 at 4:59 PM, Petr Jelinek wrote: > > On 29/03/16 19:46, Fabrízio de Royes Mello wrotez >> >> >> > >> > Hmm I am unable to reproduce this. What OS? Any special configure >> flags you use? >> > >> >> In my environment the error remains with your last patches. >> >> I didn't us

Re: [HACKERS] Sequence Access Method WIP

2016-03-29 Thread Petr Jelinek
On 29/03/16 19:46, Fabrízio de Royes Mello wrotez > > Hmm I am unable to reproduce this. What OS? Any special configure flags you use? > In my environment the error remains with your last patches. I didn't use any special. ./configure --prefix=/home/fabrizio/pgsql --enable-cassert --enable

Re: [HACKERS] Sequence Access Method WIP

2016-03-29 Thread Fabrízio de Royes Mello
On Tue, Mar 29, 2016 at 2:26 PM, Petr Jelinek wrote: > > On 29/03/16 18:50, Fabrízio de Royes Mello wrote: >> >> >> >> On Tue, Mar 29, 2016 at 12:25 PM, David Steele > > wrote: >> > >> > Hi Petr, >> > >> > On 3/28/16 3:11 PM, Fabrízio de Royes Mello wrote: >> > >>

Re: [HACKERS] Sequence Access Method WIP

2016-03-29 Thread David Steele
Hi Petr, On 3/28/16 3:11 PM, Fabrízio de Royes Mello wrote: fabrizio@bagual:~/pgsql $ bin/pg_dump > /tmp/fabrizio.sql pg_dump: [archiver (db)] query failed: ERROR: column "sequence_name" does not exist LINE 1: SELECT sequence_name, start_value, increment_by, CASE WHEN i... ^ pg

Re: [HACKERS] Sequence Access Method WIP

2016-03-28 Thread Fabrízio de Royes Mello
On Thu, Mar 24, 2016 at 6:12 PM, Petr Jelinek wrote: > > Hi, > > I rebased this on top of the recently committed CREATE ACCESS METHOD. > Hi, I got the above error trying to apply to the current master: $ git apply /home/fabrizio/Downloads/0001-seqam-2016-03-24.patch error: patch failed: src/bac

Re: [HACKERS] Sequence Access Method WIP

2016-03-20 Thread Petr Jelinek
On 19/03/16 23:02, Alvaro Herrera wrote: Petr Jelinek wrote: And finally the 0003-gapless-seq is example contrib module that implements dependably and transitionally safe gapless sequence access method. It's obviously slow as it has to do locking and basically serialize all the changes to seque

Re: [HACKERS] Sequence Access Method WIP

2016-03-19 Thread David Steele
On 3/4/16 11:09 PM, Petr Jelinek wrote: > But first here is updated patch for sequence access methods. I went with > the previously discussed custom type as this gives us proper control > over the width of the state and making sure that it's not gonna be > toastable, etc and we need this as sequen

Re: [HACKERS] Sequence Access Method WIP

2016-03-19 Thread Alvaro Herrera
Petr Jelinek wrote: > And finally the 0003-gapless-seq is example contrib module that implements > dependably and transitionally safe gapless sequence access method. It's > obviously slow as it has to do locking and basically serialize all the > changes to sequence so only one transaction may use

Re: [HACKERS] Sequence Access Method WIP

2016-02-16 Thread Alexander Korotkov
On Sat, Jan 30, 2016 at 3:37 PM, Petr Jelinek wrote: > On 29 January 2016 at 23:59, Robert Haas wrote: > > On Fri, Jan 29, 2016 at 5:24 PM, Tom Lane wrote: > >> Alexander Korotkov writes: > >>> On Fri, Jan 29, 2016 at 6:36 PM, Alvaro Herrera < > alvhe...@2ndquadrant.com> > >>> wrote: > I'

Re: [HACKERS] Sequence Access Method WIP

2016-01-30 Thread Petr Jelinek
On 30 January 2016 at 13:48, Robert Haas wrote: > On Sat, Jan 30, 2016 at 7:37 AM, Petr Jelinek wrote: >> Just as a note, CREATE SEQUENCE ACCESS METHOD already causes grammar >> conflict now, that's why my proposal was different, I didn't want to >> add more keywords. I think Alvaro's proposal is

Re: [HACKERS] Sequence Access Method WIP

2016-01-30 Thread Robert Haas
On Sat, Jan 30, 2016 at 7:37 AM, Petr Jelinek wrote: > Just as a note, CREATE SEQUENCE ACCESS METHOD already causes grammar > conflict now, that's why my proposal was different, I didn't want to > add more keywords. I think Alvaro's proposal is fine as well. I missed your proposal, I guess, so pl

Re: [HACKERS] Sequence Access Method WIP

2016-01-30 Thread Petr Jelinek
On 29 January 2016 at 23:59, Robert Haas wrote: > On Fri, Jan 29, 2016 at 5:24 PM, Tom Lane wrote: >> Alexander Korotkov writes: >>> On Fri, Jan 29, 2016 at 6:36 PM, Alvaro Herrera >>> wrote: I'm thinking we'd do CREATE ACCESS METHOD foobar TYPE INDEX or something like that. >> >>> I

Re: [HACKERS] Sequence Access Method WIP

2016-01-29 Thread Robert Haas
On Fri, Jan 29, 2016 at 5:24 PM, Tom Lane wrote: > Alexander Korotkov writes: >> On Fri, Jan 29, 2016 at 6:36 PM, Alvaro Herrera >> wrote: >>> I'm thinking we'd do CREATE ACCESS METHOD foobar TYPE INDEX or something >>> like that. > >> I would prefer "CREATE {INDEX | SEQUENCE | ... } ACCESS METH

Re: [HACKERS] Sequence Access Method WIP

2016-01-29 Thread Tom Lane
Alexander Korotkov writes: > On Fri, Jan 29, 2016 at 6:36 PM, Alvaro Herrera > wrote: >> I'm thinking we'd do CREATE ACCESS METHOD foobar TYPE INDEX or something >> like that. > I would prefer "CREATE {INDEX | SEQUENCE | ... } ACCESS METHOD name HANDLER > handler;", but I don't insist. I think

Re: [HACKERS] Sequence Access Method WIP

2016-01-29 Thread Alexander Korotkov
On Fri, Jan 29, 2016 at 6:36 PM, Alvaro Herrera wrote: > Petr Jelinek wrote: > > On 29 January 2016 at 14:48, Tom Lane wrote: > > > Alvaro Herrera writes: > > > > Uh, what? Surely we would provide a bespoke command for each possible > > > sort of handler. As an example, CREATE INDEX ACCESS ME

Re: [HACKERS] Sequence Access Method WIP

2016-01-29 Thread Tom Lane
Alvaro Herrera writes: >> On 29 January 2016 at 14:48, Tom Lane wrote: > Uh, what? Surely we would provide a bespoke command for each possible > sort of handler. As an example, CREATE INDEX ACCESS METHOD ought to check > that the provided function has the right signature, and then it would put

Re: [HACKERS] Sequence Access Method WIP

2016-01-29 Thread Alvaro Herrera
Petr Jelinek wrote: > On 29 January 2016 at 14:48, Tom Lane wrote: > > Alvaro Herrera writes: > > Uh, what? Surely we would provide a bespoke command for each possible > > sort of handler. As an example, CREATE INDEX ACCESS METHOD ought to check > > that the provided function has the right sig

Re: [HACKERS] Sequence Access Method WIP

2016-01-29 Thread Petr Jelinek
On 29 January 2016 at 14:48, Tom Lane wrote: > Alvaro Herrera writes: >> I would guess that the DDL boilterplate should come from Alexander >> Korotkov's patch, right? I think a first easy step may be to combine >> parts both patches so that we get the "amkind" column from this patch >> and the

Re: [HACKERS] Sequence Access Method WIP

2016-01-29 Thread Tom Lane
Alvaro Herrera writes: > I would guess that the DDL boilterplate should come from Alexander > Korotkov's patch, right? I think a first easy step may be to combine > parts both patches so that we get the "amkind" column from this patch > and the DDL support from Alexander's patch (means that his p

Re: [HACKERS] Sequence Access Method WIP

2016-01-29 Thread Alvaro Herrera
Petr Jelinek wrote: > On 18 January 2016 at 09:19, Craig Ringer wrote: > > Needs rework after the commit of https://commitfest.postgresql.org/8/336/ > > Here is version that applies to current master. There is some work to > do (mostly cleanup) and the DDL is missing, but that's because I want >

Re: [HACKERS] Sequence Access Method WIP

2016-01-18 Thread Craig Ringer
Needs rework after the commit of https://commitfest.postgresql.org/8/336/ -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Sequence Access Method WIP

2016-01-18 Thread Craig Ringer
On 1 January 2016 at 07:51, Petr Jelinek wrote: > > Other than that, this is based on the new am api by Alexander Korotkov > [1]. It extends it by adding another column called amkind to the pg_am > which can have either value "i" for index or "S" for sequence (same as > relkind in pg_class for th

Re: [HACKERS] Sequence Access Method WIP

2015-09-16 Thread Petr Jelinek
On 2015-09-16 13:21, Thom Brown wrote: On 28 July 2015 at 19:51, Petr Jelinek mailto:p...@2ndquadrant.com>> wrote: On 2015-07-28 20:11, Heikki Linnakangas wrote: Petr, is this enough feedback on this patch for this commitfest, or are there some other issues you want

Re: [HACKERS] Sequence Access Method WIP

2015-09-16 Thread Thom Brown
On 28 July 2015 at 19:51, Petr Jelinek wrote: > On 2015-07-28 20:11, Heikki Linnakangas wrote: > >> >> Petr, is this enough feedback on this patch for this commitfest, or are >> there some other issues you want to discuss before I mark this as >> returned? >> >> > You can mark it as returned, I d

Re: [HACKERS] Sequence Access Method WIP

2015-07-28 Thread Petr Jelinek
On 2015-07-28 20:11, Heikki Linnakangas wrote: Petr, is this enough feedback on this patch for this commitfest, or are there some other issues you want to discuss before I mark this as returned? You can mark it as returned, I didn't have much time to actually do much useful work on this in t

Re: [HACKERS] Sequence Access Method WIP

2015-07-28 Thread Heikki Linnakangas
So, we have this patch in the commitfest again. Let's see where we are, and try to find a consensus on what needs to be done before this can be committed. On 06/17/2015 06:51 PM, Petr Jelinek wrote: On 2015-06-15 11:32, Vik Fearing wrote: I've been looking at these patches a bit and here are

Re: [HACKERS] Sequence Access Method WIP

2015-06-17 Thread Petr Jelinek
On 2015-06-15 11:32, Vik Fearing wrote: I've been looking at these patches a bit and here are some comments: Thanks for looking at this. Patch 1: seqam I would like to see an example in the docs for CREATE SEQUENCE. That's perhaps not possible (or desirable) with only the "local" seqam? N

Re: [HACKERS] Sequence Access Method WIP

2015-06-15 Thread Vik Fearing
I've been looking at these patches a bit and here are some comments: Patch 1: seqam I would like to see an example in the docs for CREATE SEQUENCE. That's perhaps not possible (or desirable) with only the "local" seqam? Not sure. In the docs for pg_class, there is no mention that relam refers

Re: [HACKERS] Sequence Access Method WIP

2015-05-13 Thread Petr Jelinek
On 13/05/15 14:15, Heikki Linnakangas wrote: I don't see what calamity will occur if we commit this. If you don't want a sequence AM, don't ever use this. I'd like the API to be good for its purpose. Also, I did mention that the the current patch makes the situation slightly worse for people wh

Re: [HACKERS] Sequence Access Method WIP

2015-05-13 Thread Heikki Linnakangas
On 05/13/2015 02:12 PM, Simon Riggs wrote: This has had around 2 years of thought at this point. I don't agree it needs more thought. Noted. There is one clear use case for this and it is of benefit to many distributed architectures. Right. What's your point? I don't see what calamity wil

Re: [HACKERS] Sequence Access Method WIP

2015-05-13 Thread Petr Jelinek
On 13/05/15 12:56, Heikki Linnakangas wrote: On 05/13/2015 07:10 AM, Alvaro Herrera wrote: Heikki, do you have time to go through this at this point? I'm afraid I won't :-(. I did intend to, but looking at the calendar, I won't have the time to review this thoroughly enough to commit. Sorry.

Re: [HACKERS] Sequence Access Method WIP

2015-05-13 Thread Simon Riggs
On 13 May 2015 at 11:56, Heikki Linnakangas wrote: > On 05/13/2015 07:10 AM, Alvaro Herrera wrote: > >> Heikki, do you have time to go through this at this point? >> > > I'm afraid I won't :-(. I did intend to, but looking at the calendar, I > won't have the time to review this thoroughly enough

Re: [HACKERS] Sequence Access Method WIP

2015-05-13 Thread Heikki Linnakangas
On 05/13/2015 07:10 AM, Alvaro Herrera wrote: Heikki, do you have time to go through this at this point? I'm afraid I won't :-(. I did intend to, but looking at the calendar, I won't have the time to review this thoroughly enough to commit. Sorry. I haven't looked at the CREATE/DROP ACCESS M

Re: [HACKERS] Sequence Access Method WIP

2015-04-22 Thread Petr Jelinek
On 20/04/15 17:50, Heikki Linnakangas wrote: On 03/15/2015 09:07 PM, Petr Jelinek wrote: Slightly updated version of the patch. Mainly rebased against current master (there were several conflicts) and fixed some typos, no real functional change. I also attached initial version of the API sgml

Re: [HACKERS] Sequence Access Method WIP

2015-04-20 Thread Alvaro Herrera
Heikki Linnakangas wrote: > * The transformations of the arrays in get_state() and set_state() functions > are a bit complicated. The seqam_get_state() function returns two C arrays, > and pg_sequence_get_state() turns them into a text[] array. Why not > construct the text[] array directly in the

Re: [HACKERS] Sequence Access Method WIP

2015-04-20 Thread Petr Jelinek
On 20/04/15 12:05, Andres Freund wrote: On 2015-04-20 12:49:39 +0300, Heikki Linnakangas wrote: With the patch, pg_class.relam column references to the pg_seqam table for sequences, but pg_indexam for indexes. I believe it's the first instance where we reuse a "foreign key" column like that. It'

Re: [HACKERS] Sequence Access Method WIP

2015-04-20 Thread Andres Freund
On 2015-04-20 12:49:39 +0300, Heikki Linnakangas wrote: > With the patch, pg_class.relam column references to the pg_seqam table for > sequences, but pg_indexam for indexes. I believe it's the first instance > where we reuse a "foreign key" column like that. It's not a real foreign > key, of course

Re: [HACKERS] Sequence Access Method WIP

2015-04-20 Thread Heikki Linnakangas
On 03/15/2015 09:07 PM, Petr Jelinek wrote: Slightly updated version of the patch. Mainly rebased against current master (there were several conflicts) and fixed some typos, no real functional change. I also attached initial version of the API sgml doc. Thanks! With the patch, pg_class.relam

Re: [HACKERS] Sequence Access Method WIP

2015-02-17 Thread Petr Jelinek
On 18/02/15 02:59, Petr Jelinek wrote: On 17/02/15 23:11, Robert Haas wrote: On Sun, Feb 15, 2015 at 1:40 PM, Petr Jelinek wrote: sending new version that is updated along the lines of what we discussed at FOSDEM, which means: - back to single bytea amdata column (no custom columns) Well,

Re: [HACKERS] Sequence Access Method WIP

2015-02-17 Thread Petr Jelinek
On 17/02/15 23:11, Robert Haas wrote: On Sun, Feb 15, 2015 at 1:40 PM, Petr Jelinek wrote: sending new version that is updated along the lines of what we discussed at FOSDEM, which means: - back to single bytea amdata column (no custom columns) Well, the main argument is still future possi

Re: [HACKERS] Sequence Access Method WIP

2015-02-17 Thread Robert Haas
On Sun, Feb 15, 2015 at 1:40 PM, Petr Jelinek wrote: > sending new version that is updated along the lines of what we discussed at > FOSDEM, which means: > > - back to single bytea amdata column (no custom columns) Why? -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise Pos

Re: [HACKERS] Sequence Access Method WIP

2015-01-28 Thread Petr Jelinek
On 28/01/15 18:09, Heikki Linnakangas wrote: On 01/23/2015 02:34 AM, Petr Jelinek wrote: On 22/01/15 17:02, Petr Jelinek wrote: The new version (the one that is not submitted yet) of gapless sequence is way more ugly and probably not best example either but does guarantee gaplessness (it store

Re: [HACKERS] Sequence Access Method WIP

2015-01-28 Thread Heikki Linnakangas
On 01/23/2015 02:34 AM, Petr Jelinek wrote: On 22/01/15 17:02, Petr Jelinek wrote: The new version (the one that is not submitted yet) of gapless sequence is way more ugly and probably not best example either but does guarantee gaplessness (it stores the last value in it's own value table). So

Re: [HACKERS] Sequence Access Method WIP

2015-01-22 Thread Petr Jelinek
On 22/01/15 16:50, Heikki Linnakangas wrote: On 01/12/2015 11:33 PM, Petr Jelinek wrote: Second patch adds DDL support. I originally wanted to make it CREATE/DROP SEQUENCE ACCESS METHOD... but that would mean making ACCESS a reserver keyword so I went for CREATE ACCESS METHOD FOR SEQUENCES which

Re: [HACKERS] Sequence Access Method WIP

2015-01-22 Thread Robert Haas
On Thu, Jan 22, 2015 at 10:50 AM, Heikki Linnakangas wrote: > On 01/12/2015 11:33 PM, Petr Jelinek wrote: >> Second patch adds DDL support. I originally wanted to make it >> CREATE/DROP SEQUENCE ACCESS METHOD... but that would mean making ACCESS >> a reserver keyword so I went for CREATE ACCESS ME

Re: [HACKERS] Sequence Access Method WIP

2015-01-22 Thread Heikki Linnakangas
On 01/12/2015 11:33 PM, Petr Jelinek wrote: Second patch adds DDL support. I originally wanted to make it CREATE/DROP SEQUENCE ACCESS METHOD... but that would mean making ACCESS a reserver keyword so I went for CREATE ACCESS METHOD FOR SEQUENCES which does not need to change anything (besides add

Re: [HACKERS] Sequence Access Method WIP

2015-01-13 Thread Petr Jelinek
On 13/01/15 13:24, Tomas Vondra wrote: On 12.1.2015 22:33, Petr Jelinek wrote: On 15/12/14 11:36, Petr Jelinek wrote: On 10/12/14 03:33, Petr Jelinek wrote: On 24/11/14 12:16, Heikki Linnakangas wrote: About the rough edges: - The AlterSequence is not prettiest code around as we now have to c

Re: [HACKERS] Sequence Access Method WIP

2015-01-13 Thread Tomas Vondra
On 12.1.2015 22:33, Petr Jelinek wrote: > On 15/12/14 11:36, Petr Jelinek wrote: >> On 10/12/14 03:33, Petr Jelinek wrote: >>> On 24/11/14 12:16, Heikki Linnakangas wrote: >>> >>> About the rough edges: >>> - The AlterSequence is not prettiest code around as we now have to >>> create new relation w

Re: [HACKERS] Sequence Access Method WIP

2014-12-15 Thread Petr Jelinek
On 10/12/14 03:33, Petr Jelinek wrote: On 24/11/14 12:16, Heikki Linnakangas wrote: About the rough edges: - The AlterSequence is not prettiest code around as we now have to create new relation when sequence AM is changed and I don't know how to do that nicely - I am not sure if I did the lockin

Re: [HACKERS] Sequence Access Method WIP

2014-12-04 Thread Andres Freund
> >>May I possibly suggest a file-per-schema model instead? This approach would > >>certainly solve the excessive i-node consumption problem that --I guess-- > >>Andres is trying to address here. > >I don't think that really has any advantages. > > Just spreading the I/O load, nothing more, it see

Re: [HACKERS] Sequence Access Method WIP

2014-12-04 Thread Jim Nasby
On 12/3/14, 8:50 AM, José Luis Tallón wrote: May I possibly suggest a file-per-schema model instead? This approach would certainly solve the excessive i-node consumption problem that --I guess-- Andres is trying to address here. I don't think that really has any advantages. Just spreading th

Re: [HACKERS] Sequence Access Method WIP

2014-12-03 Thread José Luis Tallón
On 12/03/2014 11:24 AM, Andres Freund wrote: On 2014-12-03 10:59:50 +0100, José Luis Tallón wrote: snip] I don't think the WAL logging would need to change much in comparison to the current solution. We'd just add the page number to the WAL record. The biggest advantage would be to require few

Re: [HACKERS] Sequence Access Method WIP

2014-12-03 Thread Petr Jelinek
On 02/12/14 20:21, Andres Freund wrote: On 2014-11-24 13:16:24 +0200, Heikki Linnakangas wrote: To be clear: I don't think this API is very good for its stated purpose, for implementing global sequences for use in a cluster. For the reasons I've mentioned before. I'd like to see two changes to

Re: [HACKERS] Sequence Access Method WIP

2014-12-03 Thread Andres Freund
On 2014-12-03 10:59:50 +0100, José Luis Tallón wrote: > On 12/02/2014 08:21 PM, Andres Freund wrote: > >[snip] > >>2. Instead of the single amdata field, make it possible for the > >>implementation to define any number of fields with any datatype in the > >>tuple. That would make debugging, monitor

Re: [HACKERS] Sequence Access Method WIP

2014-12-03 Thread José Luis Tallón
On 12/02/2014 08:21 PM, Andres Freund wrote: [snip] 2. Instead of the single amdata field, make it possible for the implementation to define any number of fields with any datatype in the tuple. That would make debugging, monitoring etc. easier. My main problem with that approach is that it pret

Re: [HACKERS] Sequence Access Method WIP

2014-12-02 Thread Andres Freund
On 2014-11-24 13:16:24 +0200, Heikki Linnakangas wrote: > To be clear: I don't think this API is very good for its stated purpose, for > implementing global sequences for use in a cluster. For the reasons I've > mentioned before. I'd like to see two changes to this proposal: > > 1. Make the AM im

Re: [HACKERS] Sequence Access Method WIP

2014-11-24 Thread Heikki Linnakangas
On 11/08/2014 04:21 PM, Simon Riggs wrote: On 5 November 2014 17:32, Heikki Linnakangas wrote: Why does sequence_alloc need the current value? If it's a "remote" seqam, the current value is kept in the remote server, and the last value that was given to this PostgreSQL server is irrelevant. T

Re: [HACKERS] Sequence Access Method WIP

2014-11-09 Thread Petr Jelinek
On 09/11/14 20:47, Heikki Linnakangas wrote: On 11/08/2014 01:57 AM, Petr Jelinek wrote: My main problem is actually not with having tuple per-seqAM, but more with the fact that Heikki does not want to have last_value as compulsory column/parameter. How is the new AM then supposed to know where

Re: [HACKERS] Sequence Access Method WIP

2014-11-09 Thread Heikki Linnakangas
On 11/08/2014 01:57 AM, Petr Jelinek wrote: My main problem is actually not with having tuple per-seqAM, but more with the fact that Heikki does not want to have last_value as compulsory column/parameter. How is the new AM then supposed to know where to pick up and if it even can pick up? Call

Re: [HACKERS] Sequence Access Method WIP

2014-11-08 Thread Robert Haas
On Sat, Nov 8, 2014 at 6:17 AM, Petr Jelinek wrote: > Honestly, I am still not convinced that the centralized sequence server with > no local caching is something we should be optimizing for as that one will > suffer from performance problems anyway. And it can ignore the last_value > input from p

Re: [HACKERS] Sequence Access Method WIP

2014-11-08 Thread Simon Riggs
On 5 November 2014 17:32, Heikki Linnakangas wrote: > Why does sequence_alloc need the current value? If it's a "remote" seqam, > the current value is kept in the remote server, and the last value that was > given to this PostgreSQL server is irrelevant. > > That irks me with this API. The method

Re: [HACKERS] Sequence Access Method WIP

2014-11-08 Thread Petr Jelinek
On 08/11/14 03:10, Robert Haas wrote: On Fri, Nov 7, 2014 at 7:26 PM, Petr Jelinek wrote: My main problem is actually not with having tuple per-seqAM, but more with the fact that Heikki does not want to have last_value as compulsory column/parameter. How is the new AM then supposed to know wher

Re: [HACKERS] Sequence Access Method WIP

2014-11-08 Thread Craig Ringer
On 11/08/2014 12:35 AM, Petr Jelinek wrote: >> >> Do you think it'd be simple to provide a blocking, transactional >> sequence allocator via this API? i.e. gapless sequences, much the same >> as typically implemented with SELECT ... FOR UPDATE on a counter table. >> >> It might be more digestible s

Re: [HACKERS] Sequence Access Method WIP

2014-11-07 Thread Robert Haas
On Fri, Nov 7, 2014 at 7:26 PM, Petr Jelinek wrote: >> My main problem is actually not with having tuple per-seqAM, but more >> with the fact that Heikki does not want to have last_value as compulsory >> column/parameter. How is the new AM then supposed to know where to pick >> up and if it even c

Re: [HACKERS] Sequence Access Method WIP

2014-11-07 Thread Petr Jelinek
On 08/11/14 00:57, Petr Jelinek wrote: On 08/11/14 00:45, Robert Haas wrote: On Nov 5, 2014, at 5:43 PM, Petr Jelinek wrote: I don't see how to make that work with ALTER SEQUENCE USING to be honest and I do care quite a lot about that use-case (I think the ability to convert the "local" sequen

Re: [HACKERS] Sequence Access Method WIP

2014-11-07 Thread Petr Jelinek
On 08/11/14 00:45, Robert Haas wrote: On Nov 5, 2014, at 5:43 PM, Petr Jelinek wrote: I don't see how to make that work with ALTER SEQUENCE USING to be honest and I do care quite a lot about that use-case (I think the ability to convert the "local" sequences to 3rd party ones and back is very

Re: [HACKERS] Sequence Access Method WIP

2014-11-07 Thread Robert Haas
On Nov 5, 2014, at 5:43 PM, Petr Jelinek wrote: > I don't see how to make that work with ALTER SEQUENCE USING to be honest and > I do care quite a lot about that use-case (I think the ability to convert the > "local" sequences to 3rd party ones and back is very important). What specific problem

Re: [HACKERS] Sequence Access Method WIP

2014-11-07 Thread Petr Jelinek
On 06/11/14 11:22, Craig Ringer wrote: On 11/05/2014 05:01 AM, Petr Jelinek wrote: I guess I could port BDR sequences to this if it would help (once we have bit more solid agreement that the proposed API at least theoretically seems ok so that I don't have to rewrite it 10 times if at all possib

Re: [HACKERS] Sequence Access Method WIP

2014-11-07 Thread Alvaro Herrera
Craig Ringer wrote: > On 11/05/2014 05:01 AM, Petr Jelinek wrote: > > I guess I could port BDR sequences to this if it would help (once we > > have bit more solid agreement that the proposed API at least > > theoretically seems ok so that I don't have to rewrite it 10 times if at > > all possible).

Re: [HACKERS] Sequence Access Method WIP

2014-11-06 Thread Craig Ringer
On 11/05/2014 05:01 AM, Petr Jelinek wrote: > I guess I could port BDR sequences to this if it would help (once we > have bit more solid agreement that the proposed API at least > theoretically seems ok so that I don't have to rewrite it 10 times if at > all possible). Because the BDR sequences re

Re: [HACKERS] Sequence Access Method WIP

2014-11-05 Thread Petr Jelinek
On 05/11/14 18:32, Heikki Linnakangas wrote: On 11/05/2014 05:07 PM, Petr Jelinek wrote: On 05/11/14 13:45, Heikki Linnakangas wrote: In fact, if the seqam manages the current value outside the database (e.g. a "remote" seqam that gets the value from another server), nextval() never needs to wr

Re: [HACKERS] Sequence Access Method WIP

2014-11-05 Thread Heikki Linnakangas
On 11/05/2014 05:07 PM, Petr Jelinek wrote: On 05/11/14 13:45, Heikki Linnakangas wrote: In fact, if the seqam manages the current value outside the database (e.g. a "remote" seqam that gets the value from another server), nextval() never needs to write a WAL record. Sure it does, you need to

Re: [HACKERS] Sequence Access Method WIP

2014-11-05 Thread Petr Jelinek
On 05/11/14 13:45, Heikki Linnakangas wrote: On 11/04/2014 11:01 PM, Petr Jelinek wrote: On 04/11/14 13:11, Heikki Linnakangas wrote: On 10/13/2014 01:01 PM, Petr Jelinek wrote: Only the alloc and reloptions methods are required (and implemented by the local AM). The caching, xlog writing, up

Re: [HACKERS] Sequence Access Method WIP

2014-11-05 Thread Heikki Linnakangas
On 11/04/2014 11:01 PM, Petr Jelinek wrote: On 04/11/14 13:11, Heikki Linnakangas wrote: On 10/13/2014 01:01 PM, Petr Jelinek wrote: Only the alloc and reloptions methods are required (and implemented by the local AM). The caching, xlog writing, updating the page, etc is handled by backend, th

Re: [HACKERS] Sequence Access Method WIP

2014-11-04 Thread Petr Jelinek
On 04/11/14 13:11, Heikki Linnakangas wrote: On 10/13/2014 01:01 PM, Petr Jelinek wrote: Hi, I rewrote the patch with different API along the lines of what was discussed. Thanks, that's better. It would be good to see an alternative seqam to implement this API, to see how it really works. Th

Re: [HACKERS] Sequence Access Method WIP

2014-11-04 Thread Heikki Linnakangas
On 10/13/2014 01:01 PM, Petr Jelinek wrote: Hi, I rewrote the patch with different API along the lines of what was discussed. Thanks, that's better. It would be good to see an alternative seqam to implement this API, to see how it really works. The "local" one is too dummy to expose any pos

Re: [HACKERS] Sequence Access Method WIP

2014-10-13 Thread Petr Jelinek
Hi, I rewrote the patch with different API along the lines of what was discussed. The API now consists of following functions: sequence_alloc - allocating range of new values The function receives the sequence relation, current value, number of requested values amdata and relevant sequence op

Re: [HACKERS] Sequence Access Method WIP

2014-09-16 Thread Petr Jelinek
On 16/09/14 14:17, Andres Freund wrote: On 2014-09-15 01:38:52 +0200, Petr Jelinek wrote: There is also more needed than this, you need: - int64 value - first value allocated (value to be returned) - int64 nvalues - number of values allocated - int64 last - last cached value (used for cached/la

Re: [HACKERS] Sequence Access Method WIP

2014-09-16 Thread Andres Freund
On 2014-09-15 01:38:52 +0200, Petr Jelinek wrote: > - int64 minv, maxv, incby, bool is_cycled - these are basically options > giving info about how the new numbers are allocated (I guess some > implementations are not going to support all of those) > - bool is_called - the current built-in sequence

Re: [HACKERS] Sequence Access Method WIP

2014-09-14 Thread Petr Jelinek
On 18/11/13 11:50, Heikki Linnakangas wrote: I don't think the sequence AM should be in control of 'cached'. The caching is done outside the AM. And log_cnt probably should be passed to the _alloc function directly as an argument, ie. the server code asks the AM to allocate N new values in one c

Re: [HACKERS] Sequence Access Method WIP

2013-11-26 Thread Heikki Linnakangas
On 11/25/13 12:00, Simon Riggs wrote: On 25 November 2013 04:01, Heikki Linnakangas wrote: The proposed changes to alloc() would still suffer from all the problems that I complained about. Adding a new API alongside doesn't help with that. You made two proposals. I suggested implementing bot

Re: [HACKERS] Sequence Access Method WIP

2013-11-26 Thread Heikki Linnakangas
On 11/24/13 19:15, Simon Riggs wrote: On 18 November 2013 07:36, Heikki Linnakangas wrote: On 14.11.2013 22:10, Simon Riggs wrote: Includes test extension which allows sequences without gaps - "gapless". I realize this is just for demonstration purposes, but it's worth noting that it doesn'

Re: [HACKERS] Sequence Access Method WIP

2013-11-25 Thread Simon Riggs
On 25 November 2013 04:01, Heikki Linnakangas wrote: > The proposed changes to alloc() would still suffer from all the problems > that I complained about. Adding a new API alongside doesn't help with that. You made two proposals. I suggested implementing both. What would you have me do? -- S

Re: [HACKERS] Sequence Access Method WIP

2013-11-25 Thread Heikki Linnakangas
On 24.11.2013 19:23, Simon Riggs wrote: On 18 November 2013 07:06, Heikki Linnakangas wrote: On 18.11.2013 13:48, Simon Riggs wrote: On 18 November 2013 07:50, Heikki Linnakangas wrote: It doesn't go far enough, it's still too *low*-level. The sequence AM implementation shouldn't need to h

Re: [HACKERS] Sequence Access Method WIP

2013-11-24 Thread Simon Riggs
On 18 November 2013 07:06, Heikki Linnakangas wrote: > On 18.11.2013 13:48, Simon Riggs wrote: >> >> On 18 November 2013 07:50, Heikki Linnakangas >> wrote: >> >>> It doesn't go far enough, it's still too *low*-level. The sequence AM >>> implementation shouldn't need to have direct access to the

Re: [HACKERS] Sequence Access Method WIP

2013-11-24 Thread Simon Riggs
On 18 November 2013 07:36, Heikki Linnakangas wrote: > On 14.11.2013 22:10, Simon Riggs wrote: >> >> Includes test extension which allows sequences without gaps - "gapless". > > > I realize this is just for demonstration purposes, but it's worth noting > that it doesn't actually guarantee that whe

Re: [HACKERS] Sequence Access Method WIP

2013-11-18 Thread Heikki Linnakangas
On 14.11.2013 22:10, Simon Riggs wrote: Includes test extension which allows sequences without gaps - "gapless". I realize this is just for demonstration purposes, but it's worth noting that it doesn't actually guarantee that when you use the sequence to populate a column in the table, the co

Re: [HACKERS] Sequence Access Method WIP

2013-11-18 Thread Heikki Linnakangas
On 18.11.2013 13:48, Simon Riggs wrote: On 18 November 2013 07:50, Heikki Linnakangas wrote: It doesn't go far enough, it's still too *low*-level. The sequence AM implementation shouldn't need to have direct access to the buffer page at all. I don't think the sequence AM should be in contro

Re: [HACKERS] Sequence Access Method WIP

2013-11-18 Thread Simon Riggs
On 18 November 2013 07:50, Heikki Linnakangas wrote: > It doesn't go far enough, it's still too *low*-level. The sequence AM > implementation shouldn't need to have direct access to the buffer page at > all. > I don't think the sequence AM should be in control of 'cached'. The caching > is done

Re: [HACKERS] Sequence Access Method WIP

2013-11-18 Thread Andres Freund
On 2013-11-18 12:50:21 +0200, Heikki Linnakangas wrote: > On 18.11.2013 11:48, Andres Freund wrote: > I don't think the sequence AM should be in control of 'cached'. The caching > is done outside the AM. And log_cnt probably should be passed to the _alloc > function directly as an argument, ie. the

Re: [HACKERS] Sequence Access Method WIP

2013-11-18 Thread Heikki Linnakangas
On 18.11.2013 11:48, Andres Freund wrote: On 2013-11-18 10:54:42 +0200, Heikki Linnakangas wrote: On 15.11.2013 20:21, Andres Freund wrote: Well, it exposes log_sequence_tuple() - together with the added "am private" column of pg_squence that allows to do quite a bit of different things. I thin

Re: [HACKERS] Sequence Access Method WIP

2013-11-18 Thread Andres Freund
On 2013-11-18 10:54:42 +0200, Heikki Linnakangas wrote: > On 15.11.2013 20:21, Andres Freund wrote: > >Well, it exposes log_sequence_tuple() - together with the added "am > >private" column of pg_squence that allows to do quite a bit of different > >things. I think unless we really implement plugga

Re: [HACKERS] Sequence Access Method WIP

2013-11-18 Thread Heikki Linnakangas
On 15.11.2013 20:21, Andres Freund wrote: On 2013-11-15 20:08:30 +0200, Heikki Linnakangas wrote: It's pretty hard to review the this without seeing the "other" implementation you're envisioning to use this API. But I'll try: We've written a distributed sequence implementation against it, so i

Re: [HACKERS] Sequence Access Method WIP

2013-11-18 Thread Heikki Linnakangas
On 15.11.2013 21:00, Simon Riggs wrote: On 15 November 2013 15:48, Peter Eisentraut wrote: Also, you set this to "returned with feedback" in the CF app. Please verify whether that was intentional. Not sure that was me, if so, corrected. It was me, sorry. I figured this needs such a large r

Re: [HACKERS] Sequence Access Method WIP

2013-11-15 Thread Simon Riggs
On 15 November 2013 15:48, Peter Eisentraut wrote: > On 11/14/13, 3:10 PM, Simon Riggs wrote: >> On 16 January 2013 00:40, Simon Riggs wrote: >> >>> SeqAm allows you to specify a plugin that alters the behaviour for >>> sequence allocation and resetting, aimed specifically at clustering >>> syste

  1   2   >