Re: [HACKERS] proposal: doc: simplify examples of dynamic SQL

2014-10-02 Thread Pavel Stehule
2014-10-03 6:06 GMT+02:00 David G Johnston : > Jim Nasby-5 wrote > > On 10/2/14, 6:51 AM, Pavel Stehule wrote: > >> EXECUTE format('UPDATE tbl SET %I = newvalue WHERE key = %L', > >> colname, keyvalue) > >> or > > -1, because of quoting issues > >> EXECUTE format('UPDATE tbl SE

Re: [HACKERS] proposal: doc: simplify examples of dynamic SQL

2014-10-02 Thread Pavel Stehule
Hi 2014-10-03 5:16 GMT+02:00 Jim Nasby : > On 10/2/14, 6:51 AM, Pavel Stehule wrote: > >> EXECUTE format('UPDATE tbl SET %I = newvalue WHERE key = %L', >> colname, keyvalue) >> or >> > -1, because of quoting issues > No it isn't. I is 100% safe > EXECUTE format('UPDATE tbl

Re: [HACKERS] How to make ResourceOwnerForgetBuffer() O(1), instead of O(N^2) scale

2014-10-02 Thread Kouhei Kaigai
> Kouhei Kaigai writes: > > Idea-1) Put ResourceOwnerForgetBuffer() O(1) logic, instead of O(N^2). > > The source of problem come from data structure in ResourceOwnerData, > > so a straightforward way is to apply O(1) logic based on hashing, > > instead of the linear search. > > I will bet that t

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Claudio Freire
On Fri, Oct 3, 2014 at 12:07 AM, Jim Nasby wrote: > On 10/2/14, 2:43 PM, Josh Berkus wrote: >>> >>> >Questions: >>> > >>> > 1. Do you agree that a systematic way to report what a DDL command (or >>> > script, or transaction) is going to do on your production database >>> > is a feature we

Re: [HACKERS] How to make ResourceOwnerForgetBuffer() O(1), instead of O(N^2) scale

2014-10-02 Thread Tom Lane
Kouhei Kaigai writes: > Idea-1) Put ResourceOwnerForgetBuffer() O(1) logic, instead of O(N^2). > The source of problem come from data structure in ResourceOwnerData, > so a straightforward way is to apply O(1) logic based on hashing, > instead of the linear search. I will bet that this is a dead

[HACKERS] How to make ResourceOwnerForgetBuffer() O(1), instead of O(N^2) scale

2014-10-02 Thread Kouhei Kaigai
Hello, I recently got a trouble on development of my extension that utilizes the shared buffer when it released each buffer page. This extension transfers contents of the shared buffers to GPU device using DMA feature, then kicks a device kernel code. Usually 8KB (= BLCKSZ) is too small as a unit

Re: [HACKERS] proposal: doc: simplify examples of dynamic SQL

2014-10-02 Thread David G Johnston
Jim Nasby-5 wrote > On 10/2/14, 6:51 AM, Pavel Stehule wrote: >> EXECUTE format('UPDATE tbl SET %I = newvalue WHERE key = %L', >> colname, keyvalue) >> or > -1, because of quoting issues >> EXECUTE format('UPDATE tbl SET %I = newvalue WHERE key = $1', >> coln

Re: [HACKERS] CREATE IF NOT EXISTS INDEX

2014-10-02 Thread Fabrízio de Royes Mello
On Fri, Oct 3, 2014 at 12:29 AM, Fabrízio de Royes Mello < fabriziome...@gmail.com> wrote: > > > > On Thu, Oct 2, 2014 at 9:55 PM, Marti Raudsepp wrote: > > > > On Fri, Oct 3, 2014 at 2:15 AM, Marti Raudsepp wrote: > > > + ereport(NOTICE, > > > + (errcode(ERRCODE_DUPLICATE_TABLE),

Re: [HACKERS] CREATE IF NOT EXISTS INDEX

2014-10-02 Thread Fabrízio de Royes Mello
On Thu, Oct 2, 2014 at 9:55 PM, Marti Raudsepp wrote: > > On Fri, Oct 3, 2014 at 2:15 AM, Marti Raudsepp wrote: > > + ereport(NOTICE, > > + (errcode(ERRCODE_DUPLICATE_TABLE), > > + errmsg("relation \"%s\" already exists, skipping", > > +

Re: [HACKERS] CREATE IF NOT EXISTS INDEX

2014-10-02 Thread Fabrízio de Royes Mello
On Thu, Oct 2, 2014 at 8:15 PM, Marti Raudsepp wrote: > > On Wed, Oct 1, 2014 at 2:42 PM, Fabrízio de Royes Mello > wrote: > > So, what's the correct/best grammar? > > CREATE [ IF NOT EXISTS ] [ UNIQUE ] INDEX index_name > > or > > CREATE [ UNIQUE ] INDEX [ IF NOT EXISTS ] index_name > > I've ele

Re: [HACKERS] TAP test breakage on MacOS X

2014-10-02 Thread Tom Lane
I wrote: > Also, noticing that what you're using is evidently Perl 5.12, I'm > wondering whether our TAP test scripts require a fairly new Perl version. > I recall some of my Salesforce colleagues griping that the TAP scripts > didn't work with older Perls. Well, they definitely don't work with Pe

Re: [HACKERS] proposal: doc: simplify examples of dynamic SQL

2014-10-02 Thread Jim Nasby
On 10/2/14, 6:51 AM, Pavel Stehule wrote: EXECUTE format('UPDATE tbl SET %I = newvalue WHERE key = %L', colname, keyvalue) or -1, because of quoting issues EXECUTE format('UPDATE tbl SET %I = newvalue WHERE key = $1', colname) USING keyvalue; Better, b

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Jim Nasby
On 10/2/14, 2:43 PM, Josh Berkus wrote: >Questions: > > 1. Do you agree that a systematic way to report what a DDL command (or > script, or transaction) is going to do on your production database > is a feature we should provide to our growing user base? Yes. +1 > 2. What do you thin

Re: [HACKERS] Patch to add support of "IF NOT EXISTS" to others "CREATE" statements

2014-10-02 Thread Fabrízio de Royes Mello
On Thu, Oct 2, 2014 at 9:38 PM, Marti Raudsepp wrote: > > On Tue, Aug 26, 2014 at 4:20 PM, Heikki Linnakangas > wrote: > > On 04/14/2014 10:31 PM, Fabrízio de Royes Mello wrote: > >> The attached patch contains CINE for sequences. > >> > >> I just strip this code from the patch rejected before. >

Re: [HACKERS] TAP test breakage on MacOS X

2014-10-02 Thread Tom Lane
Robert Haas writes: > make check-world dies ingloriously for me, like this: FWIW, it works fine for me on my Mac laptop, using the Perl 5.16.2 that comes standard with OSX 10.9.5. I did have to install IPC::Run from CPAN though. > # Failed test 'initdb options handling' > # at /opt/local/li

[HACKERS] GiST splitting on empty pages

2014-10-02 Thread Andrew Gierth
This is from Bug #11555, which is still in moderation as I type this (analysis was done via IRC). The GiST insertion code appears to have no length checks at all on the inserted entry. index_form_tuple checks for length <= 8191, with the default blocksize, but obviously a tuple less than 8191 byte

Re: [HACKERS] pg_receivexlog and replication slots

2014-10-02 Thread Michael Paquier
On Thu, Oct 2, 2014 at 12:44 AM, Andres Freund wrote: > I pushed the first part. > Thanks. Attached is a rebased version of patch 2, implementing the actual feature. One thing I noticed with more testing is that if --create is used and that the destination folder does not exist, pg_receivexlog wa

Re: [HACKERS] TAP test breakage on MacOS X

2014-10-02 Thread Robert Haas
On Thu, Oct 2, 2014 at 5:09 PM, Peter Eisentraut wrote: > On 10/2/14 3:19 PM, Robert Haas wrote: >> 1..2 >> ok 1 - initdb with invalid option nonzero exit code >> ok 2 - initdb with invalid option prints error message >> # Looks like your test exited with 256 just after 2. >> not o

Re: [HACKERS] CREATE IF NOT EXISTS INDEX

2014-10-02 Thread Marti Raudsepp
On Fri, Oct 3, 2014 at 2:15 AM, Marti Raudsepp wrote: > + ereport(NOTICE, > + (errcode(ERRCODE_DUPLICATE_TABLE), > + errmsg("relation \"%s\" already exists, skipping", > + indexRelationName))); > > 1. Clearly "relation" should be "in

Re: [HACKERS] Patch to add support of "IF NOT EXISTS" to others "CREATE" statements

2014-10-02 Thread Marti Raudsepp
On Tue, Aug 26, 2014 at 4:20 PM, Heikki Linnakangas wrote: > On 04/14/2014 10:31 PM, Fabrízio de Royes Mello wrote: >> The attached patch contains CINE for sequences. >> >> I just strip this code from the patch rejected before. > > Committed with minor changes Hmm, the CommitFest app lists Marko

Re: [HACKERS] Per table autovacuum vacuum cost limit behaviour strange

2014-10-02 Thread Stephen Frost
* Alvaro Herrera (alvhe...@2ndquadrant.com) wrote: > Alvaro Herrera wrote: > > Basically, if you are on 9.3.5 or earlier any per-table options for > > autovacuum cost delay will misbehave (meaning: any such table will be > > processed with settings flattened according to balancing of the standard >

Re: [HACKERS] Fixed xloginsert_locks for 9.4

2014-10-02 Thread Peter Geoghegan
On Thu, Oct 2, 2014 at 5:08 PM, Greg Smith wrote: > When 9.4 is already giving a more than 100% gain on this targeted test case, > I can't see that chasing after maybe an extra 10% is worth having yet > another GUC around. Especially when it will probably take multiple tuning > steps before you'r

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Stephen Frost
* Claudio Freire (klaussfre...@gmail.com) wrote: > On Thu, Oct 2, 2014 at 6:19 PM, Stephen Frost wrote: > >> And that needs locks, especially if you modify the underlying filesystem > >> layout. > > > > And we wouldn't be doing that, certainly. It's a dry-run. > > ... > > > (...) We might also

[HACKERS] Fixed xloginsert_locks for 9.4

2014-10-02 Thread Greg Smith
I did a fair dive into double-checking the decision to just leave xloginsert_locks fixed at 8 for 9.4. My conclusion: good call, move along. Further improvements beyond what the 8-way split gives sure are possible. But my guess from chasing them a little is that additional places will pop u

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Joe Conway
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/02/2014 06:43 PM, Jan Wieck wrote: > The real question is at what level of information, returned to the > user, does this feature become user friendly? > > It is one thing to provide information of the kind of > > TAKE ACCECSS EXCLUSIVE LOCK ON

Re: [HACKERS] NEXT VALUE FOR

2014-10-02 Thread Tom Lane
Thomas Munro writes: > On 2 October 2014 14:48, Tom Lane wrote: >> Have you checked the archives about this? My recollection is that one >> reason it's not in there (aside from having to reserve "NEXT") is that >> the standard-mandated semantics are not the same as nextval(). > Right, I found t

Re: [HACKERS] CREATE IF NOT EXISTS INDEX

2014-10-02 Thread Marti Raudsepp
On Wed, Oct 1, 2014 at 2:42 PM, Fabrízio de Royes Mello wrote: > So, what's the correct/best grammar? > CREATE [ IF NOT EXISTS ] [ UNIQUE ] INDEX index_name > or > CREATE [ UNIQUE ] INDEX [ IF NOT EXISTS ] index_name I've elected myself as the reviewer for this patch. Here are some preliminary co

Re: [HACKERS] NEXT VALUE FOR

2014-10-02 Thread Thomas Munro
On 3 October 2014 00:01, Thomas Munro wrote: > On 2 October 2014 14:48, Tom Lane wrote: >> Thomas Munro writes: >>> SQL:2003 introduced the function NEXT VALUE FOR . Google >>> tells me that at least DB2, SQL Server and a few niche databases >>> understand it so far. As far as I can tell there

Re: [HACKERS] Promise index tuples for UPSERT

2014-10-02 Thread Peter Geoghegan
On Wed, Oct 1, 2014 at 12:59 PM, Peter Geoghegan wrote: > On Wed, Oct 1, 2014 at 12:54 PM, Heikki Linnakangas > wrote: >> XactLockTableWait() waits until the end of transaction, that's not you want >> here. If the backend that inserted the promise tuple decides to not proceed >> with the insertio

Re: [HACKERS] NEXT VALUE FOR

2014-10-02 Thread Thomas Munro
On 2 October 2014 14:48, Tom Lane wrote: > Thomas Munro writes: >> SQL:2003 introduced the function NEXT VALUE FOR . Google >> tells me that at least DB2, SQL Server and a few niche databases >> understand it so far. As far as I can tell there is no standardised >> equivalent of currval and setv

Re: [HACKERS] Proposal for updating src/timezone

2014-10-02 Thread Tom Lane
John Cochran writes: > As it is, I've finished checking the differences between the postgres and > IANA code for zic.c after editing both to eliminate non-functional style > differences such as indentation, function prototypes, comparing strchr > results against NULL or 0, etc. It looks like the o

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Jan Wieck
On 10/02/2014 01:15 PM, Joe Conway wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/02/2014 11:30 AM, Dimitri Fontaine wrote: Questions: 1. Do you agree that a systematic way to report what a DDL command (or script, or transaction) is going to do on your production database is a feat

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Dimitri Fontaine
Alvaro Herrera writes: >> - will the table have to be rewritten? the indexes? > > Please give my DDL deparsing patch a look. There is a portion there > about deparsing ALTER TABLE specifically; what it does is save a list of > subcommands, and for each of them we either report the OID of the ob

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Alvaro Herrera
Peter Geoghegan wrote: > Why is NOWAIT only supported for SET TABLESPACE? I guess it's just a > particularly bad case. NOWAIT might be the wrong thing for DDL > generally. I didn't realize we supported NOWAIT for SET TABLESPACE. My hunch is that if we have that, it should really be supported for

Re: [HACKERS] Per table autovacuum vacuum cost limit behaviour strange

2014-10-02 Thread Alvaro Herrera
Alvaro Herrera wrote: > Basically, if you are on 9.3.5 or earlier any per-table options for > autovacuum cost delay will misbehave (meaning: any such table will be > processed with settings flattened according to balancing of the standard > options, _not_ the configured ones). If you are on 9.3.6

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Alvaro Herrera
Dimitri Fontaine wrote: > The main practical example I can offer here is the ALTER TABLE command. > Recent releases are including very nice optimisations to it, so much so > that it's becoming increasingly hard to answer some very basic > questions: > > - what kind of locks will be taken? (excl

[HACKERS] [PATCH] Simplify EXISTS subqueries containing LIMIT

2014-10-02 Thread Marti Raudsepp
Hi list, Attached patch allows semijoin/antijoin/hashed SubPlan optimization when an EXISTS subquery contains a LIMIT clause with a positive constant. It seems to be a fairly common meme to put LIMIT 1 into EXISTS() subqueries, and it even makes sense when you're not aware that the database alread

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Claudio Freire
On Thu, Oct 2, 2014 at 6:19 PM, Stephen Frost wrote: > * Claudio Freire (klaussfre...@gmail.com) wrote: >> On Thu, Oct 2, 2014 at 6:03 PM, Stephen Frost wrote: >> >> That sounds extremely complex. You'd have to implement the fake >> >> columns, foreign keys, indexes, etc on most execution nodes,

Re: [HACKERS] Assertion failure in syncrep.c

2014-10-02 Thread Simon Riggs
On 18 September 2014 07:32, Pavan Deolasee wrote: > 564 /* > 565 * Set state to complete; see SyncRepWaitForLSN() for discussion > of > 566 * the various states. > 567 */ > 568 thisproc->syncRepState = SYNC_REP_WAIT_COMPLETE; > 569 > 570 /* > 571

Re: [HACKERS] INSERT ... ON CONFLICT {UPDATE | IGNORE}

2014-10-02 Thread Bruce Momjian
On Thu, Oct 2, 2014 at 02:08:30PM -0700, Peter Geoghegan wrote: > On Thu, Oct 2, 2014 at 1:10 PM, Bruce Momjian wrote: > > I think if we use the MERGE command for this feature we would need to > > use a non-standard keyword to specify that we want OLTP/UPSERT > > functionality. That would allow

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Stephen Frost
* Andres Freund (and...@2ndquadrant.com) wrote: > On 2014-10-02 17:03:59 -0400, Stephen Frost wrote: > > > That sounds extremely complex. You'd have to implement the fake > > > columns, foreign keys, indexes, etc on most execution nodes, the > > > planner, and even system views. > > > > Eh? We ha

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Stephen Frost
* Claudio Freire (klaussfre...@gmail.com) wrote: > On Thu, Oct 2, 2014 at 6:03 PM, Stephen Frost wrote: > >> That sounds extremely complex. You'd have to implement the fake > >> columns, foreign keys, indexes, etc on most execution nodes, the > >> planner, and even system views. > > > > Eh? We ha

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Andres Freund
On 2014-10-02 13:49:36 -0300, Claudio Freire wrote: > EXPLAIN ALTER TABLE ? I don't think that'll work - there's already EXPLAIN for some CREATE. At least CREATE TABLE ... AS, CREATE VIEW ... AS and SELECT INTO. Greetings, Andres Freund -- Andres Freund http://www.2ndQuadr

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Andres Freund
On 2014-10-02 17:03:59 -0400, Stephen Frost wrote: > * Claudio Freire (klaussfre...@gmail.com) wrote: > > On Thu, Oct 2, 2014 at 4:40 PM, Stephen Frost wrote: > > > The downside of the 'explain' approach is that the script then has to be > > > modified to put 'explain' in front of everything and t

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Stephen Frost
* Peter Geoghegan (p...@heroku.com) wrote: > On Thu, Oct 2, 2014 at 12:40 PM, Stephen Frost wrote: > > The downside of the 'explain' approach is that the script then has to be > > modified to put 'explain' in front of everything and then you have to go > > through each statement and consider it.

Re: [HACKERS] TAP test breakage on MacOS X

2014-10-02 Thread Andres Freund
On 2014-10-02 17:09:43 -0400, Peter Eisentraut wrote: > On 10/2/14 3:19 PM, Robert Haas wrote: > > 1..2 > > ok 1 - initdb with invalid option nonzero exit code > > ok 2 - initdb with invalid option prints error message > > # Looks like your test exited with 256 just after 2. > > not

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Peter Geoghegan
On Thu, Oct 2, 2014 at 2:04 PM, Claudio Freire wrote: > I've done that manually (throw the DDL, and cancel if it takes more > than a couple of seconds) on modest but relatively busy servers with > quite some success. Fair enough, but that isn't the same as NOWAIT. It's something we'd have a hard

Re: [HACKERS] TAP test breakage on MacOS X

2014-10-02 Thread Peter Eisentraut
On 10/2/14 3:19 PM, Robert Haas wrote: > 1..2 > ok 1 - initdb with invalid option nonzero exit code > ok 2 - initdb with invalid option prints error message > # Looks like your test exited with 256 just after 2. > not ok 3 - initdb options handling > > # Failed test 'initdb optio

Re: [HACKERS] INSERT ... ON CONFLICT {UPDATE | IGNORE}

2014-10-02 Thread Peter Geoghegan
On Thu, Oct 2, 2014 at 1:10 PM, Bruce Momjian wrote: > I think if we use the MERGE command for this feature we would need to > use a non-standard keyword to specify that we want OLTP/UPSERT > functionality. That would allow us to mostly use the MERGE standard > syntax without having surprises abo

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Claudio Freire
On Thu, Oct 2, 2014 at 6:03 PM, Stephen Frost wrote: > * Claudio Freire (klaussfre...@gmail.com) wrote: >> On Thu, Oct 2, 2014 at 4:40 PM, Stephen Frost wrote: >> > The downside of the 'explain' approach is that the script then has to be >> > modified to put 'explain' in front of everything and t

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Peter Geoghegan
On Thu, Oct 2, 2014 at 1:52 PM, Claudio Freire wrote: > The explain would show the AccessExclusiveLock, so it would be enough > for a heads-up to kill all idle-in-transaction holding locks on the > target relation (if killable, or just wait). I think that there are very few problems with recogniz

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Stephen Frost
* Claudio Freire (klaussfre...@gmail.com) wrote: > On Thu, Oct 2, 2014 at 4:40 PM, Stephen Frost wrote: > > The downside of the 'explain' approach is that the script then has to be > > modified to put 'explain' in front of everything and then you have to go > > through each statement and consider

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Claudio Freire
On Thu, Oct 2, 2014 at 6:00 PM, Peter Geoghegan wrote: >> Granted, it's something that's not easily automatable, whereas a nowait is. >> >> However, rather than nowait, I'd prefer "cancellable" semantics, that >> would cancel voluntarily if any other transaction requests a >> conflicting lock, lik

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Claudio Freire
On Thu, Oct 2, 2014 at 5:37 PM, Peter Geoghegan wrote: > Session 3 is an innocent bystander. It goes to query the same table in > an ordinary, routine way - a SELECT statement. Even though session 2's > lock is not granted yet, session 3 is not at liberty to skip the queue > and get its own Access

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Peter Geoghegan
On Thu, Oct 2, 2014 at 1:37 PM, Peter Geoghegan wrote: > And yet, in theory session 2's impact > on production should not be minimal, if we consider something like > EXPLAIN output. "Should have been minimal", I mean. -- Peter Geoghegan -- Sent via pgsql-hackers mailing list (pgsql-hackers@

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Peter Geoghegan
On Thu, Oct 2, 2014 at 12:40 PM, Stephen Frost wrote: > The downside of the 'explain' approach is that the script then has to be > modified to put 'explain' in front of everything and then you have to go > through each statement and consider it. Having a 'dry-run' transaction > type which then pr

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Claudio Freire
On Thu, Oct 2, 2014 at 4:40 PM, Stephen Frost wrote: > * Joshua D. Drake (j...@commandprompt.com) wrote: >> > 2. What do you think such a feature should look like? >> >> I liked the other post that said: EXPLAIN or whatever. >> Heck it could even be useful to have EXPLAIN ANALZYE >> in case peo

Re: [HACKERS] PL/pgSQL 2

2014-10-02 Thread Steven Lembark
> Python2 -> Python3 would've been a lot less painful if you could mark, > on a module-by-module basis, whether a module was python2 or python3 > code. It wasn't very practical for Python because python code can reach > deep into the guts of unrelated objects discovered at runtime - it can > add/

Re: [HACKERS] PL/pgSQL 2

2014-10-02 Thread Steven Lembark
On Mon, 01 Sep 2014 12:00:48 +0200 Marko Tiikkaja wrote: > create a new language. There are enough problems with SQL in general, enough alternatives proposed over time that it might be worth coming up with something that Just Works. -- Steven Lembark

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Steven Lembark
> EXPLAIN ALTER TABLE ? Good thing: People recognize it. Bad thing: People might not be able to tell the difference between a DDL and DML result. What about "EXPLAIN DDL ..."? The extra keyword ("DDL") makes it a bit more explicit that the results are not comparable to the standar

Re: [HACKERS] INSERT ... ON CONFLICT {UPDATE | IGNORE}

2014-10-02 Thread Bruce Momjian
On Tue, Sep 30, 2014 at 02:57:43PM -0700, Josh Berkus wrote: > I don't know that that is the *expectation*. However, I personally > would find it *acceptable* if it meant that we could get efficient merge > semantics on other aspects of the syntax, since my primary use for MERGE > is bulk loading.

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread José Luis Tallón
On 10/02/2014 06:30 PM, Dimitri Fontaine wrote: > Hi fellow hackers, > [snip] > Questions: > > 1. Do you agree that a systematic way to report what a DDL command (or > script, or transaction) is going to do on your production database > is a feature we should provide to our growing user ba

Re: [HACKERS] UPSERT wiki page, and SQL MERGE syntax

2014-10-02 Thread Peter Geoghegan
On Thu, Oct 2, 2014 at 12:54 AM, Peter Geoghegan wrote: > I've started off by adding varied examples of the use of the existing > proposed syntax. I'll expand on this soon. I spent some time today expanding on the details, and commenting on the issues around the custom syntax (exactly what it doe

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Josh Berkus
> Questions: > > 1. Do you agree that a systematic way to report what a DDL command (or > script, or transaction) is going to do on your production database > is a feature we should provide to our growing user base? Yes. > 2. What do you think such a feature should look like? As with

Re: [HACKERS] NEXT VALUE FOR

2014-10-02 Thread Robert Haas
On Thu, Oct 2, 2014 at 7:27 AM, Heikki Linnakangas wrote: >> SQL:2003 introduced the function NEXT VALUE FOR . Google >> tells me that at least DB2, SQL Server and a few niche databases >> understand it so far. As far as I can tell there is no standardised >> equivalent of currval and setval (but

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Stephen Frost
* Joshua D. Drake (j...@commandprompt.com) wrote: > > 2. What do you think such a feature should look like? > > I liked the other post that said: EXPLAIN or whatever. > Heck it could even be useful to have EXPLAIN ANALZYE > in case people want to run it on staging/test/dev environments to > jud

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Stephen Frost
* Harold Giménez (har...@heroku.com) wrote: > I think the main issue is when a table rewrite is triggered on a DDL > command on a large table, as this is what frequently leads to > unavailability. The idea of introducing a NOREWRITE keyword to DDL > commands then came up (credit: Peter Geoghegan).

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Stephen Frost
* Dimitri Fontaine (dimi...@2ndquadrant.fr) wrote: > 1. Do you agree that a systematic way to report what a DDL command (or > script, or transaction) is going to do on your production database > is a feature we should provide to our growing user base? I definitely like the idea of such a

Re: [HACKERS] Proper query implementation for Postgresql driver

2014-10-02 Thread Robert Haas
On Tue, Sep 30, 2014 at 1:20 AM, Craig Ringer wrote: > Frankly, I suggest dropping "simple" entirely and using only the > parse/bind/describe/execute flow in the v3 protocol. The last time I checked, that was significantly slower. http://www.postgresql.org/message-id/ca+tgmoyjkfnmrtmhodwhnoj1jwc

Re: [HACKERS] Scaling shared buffer eviction

2014-10-02 Thread Robert Haas
On Thu, Oct 2, 2014 at 1:07 PM, Andres Freund wrote: > Do a make check-world and it'll hopefully fail ;). Check > pg_buffercache_pages.c. Yep. Committed, with an update to the comments in lwlock.c to allude to the pg_buffercache issue. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com T

[HACKERS] TAP test breakage on MacOS X

2014-10-02 Thread Robert Haas
make check-world dies ingloriously for me, like this: /bin/sh ../../../config/install-sh -c -d tmp_check/log make -C ../../.. DESTDIR='/Users/rhaas/pgsql/src/bin/initdb'/tmp_check/install install >'/Users/rhaas/pgsql/src/bin/initdb'/tmp_check/log/install.log 2>&1 cd . && TESTDIR='/Users/rhaas/pgsq

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Joshua D. Drake
On 10/02/2014 09:30 AM, Dimitri Fontaine wrote: Questions: 1. Do you agree that a systematic way to report what a DDL command (or script, or transaction) is going to do on your production database is a feature we should provide to our growing user base? I would say it is late to

Re: [HACKERS] Inefficient barriers on solaris with sun cc

2014-10-02 Thread Andres Freund
On 2014-10-02 11:35:32 -0400, Robert Haas wrote: > On Thu, Oct 2, 2014 at 11:18 AM, Andres Freund wrote: > >> > Which is why these acquire/release fences, in contrast to > >> > acquire/release operations, have more guarantees... You put your finger > >> > right onto the spot. > >> > >> But, uh, we

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Joe Conway
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/02/2014 11:30 AM, Dimitri Fontaine wrote: > Questions: > > 1. Do you agree that a systematic way to report what a DDL command > (or script, or transaction) is going to do on your production > database is a feature we should provide to our growin

Re: [HACKERS] Scaling shared buffer eviction

2014-10-02 Thread Andres Freund
On 2014-10-02 20:04:58 +0300, Heikki Linnakangas wrote: > On 10/02/2014 05:40 PM, Robert Haas wrote: > >On Thu, Oct 2, 2014 at 10:36 AM, Andres Freund > >wrote: > >>>OK. > >> > >>Given that the results look good, do you plan to push this? > > > >By "this", you mean the increase in the number of b

Re: [HACKERS] Scaling shared buffer eviction

2014-10-02 Thread Heikki Linnakangas
On 10/02/2014 05:40 PM, Robert Haas wrote: On Thu, Oct 2, 2014 at 10:36 AM, Andres Freund wrote: OK. Given that the results look good, do you plan to push this? By "this", you mean the increase in the number of buffer mapping partitions to 128, and a corresponding increase in MAX_SIMUL_LWLO

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Harold Giménez
I think the main issue is when a table rewrite is triggered on a DDL command on a large table, as this is what frequently leads to unavailability. The idea of introducing a NOREWRITE keyword to DDL commands then came up (credit: Peter Geoghegan). When the NOREWRITE keyword is used and the DDL state

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Claudio Freire
On Thu, Oct 2, 2014 at 1:46 PM, Fabrízio de Royes Mello wrote: > On Thu, Oct 2, 2014 at 1:30 PM, Dimitri Fontaine > wrote: >> >> Hi fellow hackers, >> >> I would like to work on a new feature allowing our users to assess the >> amount of trouble they will run into when running a DDL script on the

Re: [HACKERS] DDL Damage Assessment

2014-10-02 Thread Fabrízio de Royes Mello
On Thu, Oct 2, 2014 at 1:30 PM, Dimitri Fontaine wrote: > > Hi fellow hackers, > > I would like to work on a new feature allowing our users to assess the > amount of trouble they will run into when running a DDL script on their > production setups, *before* actually getting their services down. >

[HACKERS] DDL Damage Assessment

2014-10-02 Thread Dimitri Fontaine
Hi fellow hackers, I would like to work on a new feature allowing our users to assess the amount of trouble they will run into when running a DDL script on their production setups, *before* actually getting their services down. The main practical example I can offer here is the ALTER TABLE comman

Re: [HACKERS] Log notice that checkpoint is to be written on shutdown

2014-10-02 Thread Michael Banck
Hi, Am Donnerstag, den 02.10.2014, 08:17 -0700 schrieb David G Johnston: > Michael Banck-2 wrote > > I've attached a trivial patch for this, should it be added to the next > > commitfest? > > Peeking at this provokes a couple of novice questions: > > While apparently it is impossible to have a

Re: [HACKERS] Per table autovacuum vacuum cost limit behaviour strange

2014-10-02 Thread Alvaro Herrera
Stephen Frost wrote: > * Robert Haas (robertmh...@gmail.com) wrote: > > I agree with both of those arguments. I have run into very few > > customers who have used the autovacuum settings to customize behavior > > for particular tables, and anyone who hasn't should see no change > > (right?), so m

Re: [HACKERS] Inefficient barriers on solaris with sun cc

2014-10-02 Thread Robert Haas
On Thu, Oct 2, 2014 at 11:18 AM, Andres Freund wrote: >> So let's use those, then. > > Right, I've never contended that. OK, cool. >> A fully barrier on x86 should be an mfence, right? > > Right. I've not talked about changing full barrier semantics. What I was > referring to is that until the a

Re: [HACKERS] Scaling shared buffer eviction

2014-10-02 Thread Andres Freund
On 2014-10-02 10:56:05 -0400, Robert Haas wrote: > On Thu, Oct 2, 2014 at 10:44 AM, Andres Freund wrote: > > On 2014-10-02 10:40:30 -0400, Robert Haas wrote: > >> On Thu, Oct 2, 2014 at 10:36 AM, Andres Freund > >> wrote: > >> >> OK. > >> > > >> > Given that the results look good, do you plan to

Re: [HACKERS] Inefficient barriers on solaris with sun cc

2014-10-02 Thread Andres Freund
On 2014-10-02 10:55:06 -0400, Robert Haas wrote: > On Thu, Oct 2, 2014 at 10:34 AM, Andres Freund wrote: > > It's actually more complex than that :( > > > > Simple things first: > > > > Oracle's definition seems pretty iron clad: > > http://docs.oracle.com/cd/E18659_01/html/821-1383/gjzmf.html > >

Re: [HACKERS] Log notice that checkpoint is to be written on shutdown

2014-10-02 Thread David G Johnston
Michael Banck-2 wrote > Hi, > > we have seen repeatedly that users can be confused about why PostgreSQL > is not shutting down even though they requested it. Usually, this is > because `log_checkpoints' is not enabled and the final checkpoint is > being written, delaying shutdown. As no message b

Re: [HACKERS] Per table autovacuum vacuum cost limit behaviour strange

2014-10-02 Thread Stephen Frost
* Robert Haas (robertmh...@gmail.com) wrote: > On Thu, Oct 2, 2014 at 9:54 AM, Alvaro Herrera > wrote: > > Alvaro Herrera wrote: > >> So in essence what we're going to do is that the balance mechanism > >> considers only tables that don't have per-table configuration options; > >> for those that

Re: [HACKERS] "port/atomics/arch-*.h" are missing from installation

2014-10-02 Thread Andres Freund
Hi, On 2014-10-02 23:33:36 +0900, Kohei KaiGai wrote: > I got the following error when I try to build my extension > towards the latest master branch. > > Is the "port/atomics/*.h" files forgotten on make install? You're right. > The attached patch is probably right remedy. I've changed the or

Re: [HACKERS] Scaling shared buffer eviction

2014-10-02 Thread Robert Haas
On Thu, Oct 2, 2014 at 10:44 AM, Andres Freund wrote: > On 2014-10-02 10:40:30 -0400, Robert Haas wrote: >> On Thu, Oct 2, 2014 at 10:36 AM, Andres Freund >> wrote: >> >> OK. >> > >> > Given that the results look good, do you plan to push this? >> >> By "this", you mean the increase in the numbe

Re: [HACKERS] Inefficient barriers on solaris with sun cc

2014-10-02 Thread Robert Haas
On Thu, Oct 2, 2014 at 10:34 AM, Andres Freund wrote: > It's actually more complex than that :( > > Simple things first: > > Oracle's definition seems pretty iron clad: > http://docs.oracle.com/cd/E18659_01/html/821-1383/gjzmf.html > __machine_acq_barrier is a clear superset of __machine_r_barrier

Re: [HACKERS] Scaling shared buffer eviction

2014-10-02 Thread Andres Freund
On 2014-10-02 10:40:30 -0400, Robert Haas wrote: > On Thu, Oct 2, 2014 at 10:36 AM, Andres Freund wrote: > >> OK. > > > > Given that the results look good, do you plan to push this? > > By "this", you mean the increase in the number of buffer mapping > partitions to 128, and a corresponding incre

Re: [HACKERS] Scaling shared buffer eviction

2014-10-02 Thread Robert Haas
On Thu, Oct 2, 2014 at 10:36 AM, Andres Freund wrote: >> OK. > > Given that the results look good, do you plan to push this? By "this", you mean the increase in the number of buffer mapping partitions to 128, and a corresponding increase in MAX_SIMUL_LWLOCKS? If so, and if you don't have any res

Re: [HACKERS] Scaling shared buffer eviction

2014-10-02 Thread Andres Freund
On 2014-09-25 10:42:29 -0400, Robert Haas wrote: > On Thu, Sep 25, 2014 at 10:24 AM, Andres Freund > wrote: > > On 2014-09-25 10:22:47 -0400, Robert Haas wrote: > >> On Thu, Sep 25, 2014 at 10:14 AM, Andres Freund > >> wrote: > >> > That leads me to wonder: Have you measured different, lower, n

Re: [HACKERS] Inefficient barriers on solaris with sun cc

2014-10-02 Thread Andres Freund
On 2014-09-26 10:28:21 -0400, Robert Haas wrote: > On Fri, Sep 26, 2014 at 8:55 AM, Oskari Saarenmaa wrote: > >> So you think a read barrier is the same thing as an acquire barrier > >> and a write barrier is the same as a release barrier? That would be > >> surprising. It's certainly not true i

[HACKERS] "port/atomics/arch-*.h" are missing from installation

2014-10-02 Thread Kohei KaiGai
I got the following error when I try to build my extension towards the latest master branch. Is the "port/atomics/*.h" files forgotten on make install? [kaigai@magro pg_strom]$ make gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-at

Re: [HACKERS] Per table autovacuum vacuum cost limit behaviour strange

2014-10-02 Thread Robert Haas
On Thu, Oct 2, 2014 at 9:54 AM, Alvaro Herrera wrote: > Alvaro Herrera wrote: >> So in essence what we're going to do is that the balance mechanism >> considers only tables that don't have per-table configuration options; >> for those that do, we will use the values configured there without any >>

Re: [HACKERS] WITH CHECK and Column-Level Privileges

2014-10-02 Thread Stephen Frost
* Dean Rasheed (dean.a.rash...@gmail.com) wrote: > On 30 September 2014 20:17, Stephen Frost wrote: > > * Dean Rasheed (dean.a.rash...@gmail.com) wrote: > >> One of the main things that detail is useful for is identifying the > >> failing row in a multi-row update. In most real-world cases, I woul

Re: [HACKERS] NEXT VALUE FOR

2014-10-02 Thread Tom Lane
Thomas Munro writes: > SQL:2003 introduced the function NEXT VALUE FOR . Google > tells me that at least DB2, SQL Server and a few niche databases > understand it so far. As far as I can tell there is no standardised > equivalent of currval and setval (but I only have access to second > hand info

Re: [HACKERS] Time measurement format - more human readable

2014-10-02 Thread Bogdan Pilch
> On 9/29/14, 1:08 AM, Andres Freund wrote: > >On 2014-09-28 20:32:30 -0400, Gregory Smith wrote: > >>There are already a wide range of human readable time interval output > >>formats available in the database; see the list at > >>http://www.postgresql.org/docs/current/static/datatype-datetime.htm

[HACKERS] Log notice that checkpoint is to be written on shutdown

2014-10-02 Thread Michael Banck
Hi, we have seen repeatedly that users can be confused about why PostgreSQL is not shutting down even though they requested it. Usually, this is because `log_checkpoints' is not enabled and the final checkpoint is being written, delaying shutdown. As no message besides "shutting down" is written

  1   2   >