Re: [HACKERS] Extended Prefetching using Asynchronous IO - proposal and patch

2014-05-30 Thread Heikki Linnakangas
On 05/30/2014 12:53 AM, John Lumby wrote: Date: Thu, 29 May 2014 18:00:28 -0300 Subject: Re: [HACKERS] Extended Prefetching using Asynchronous IO - proposal and patch From: klaussfre...@gmail.com To: hlinnakan...@vmware.com CC: johnlu...@hotmail.com; pgsql-hackers@postgresql.org On Thu, May

Re: [HACKERS] Fwd: Typo fixes in Solution.pm, part of MSVC scripts

2014-05-30 Thread Michael Paquier
On Fri, May 30, 2014 at 4:31 AM, Robert Haas robertmh...@gmail.com wrote: I suspect it would be good, then, to separate this into two patches, one for back-patch and one not. Attached are patches for master and 9.3. 9.2 and older versions are not impacted. Regards, -- Michael diff --git

Re: [HACKERS] Fwd: Typo fixes in Solution.pm, part of MSVC scripts

2014-05-30 Thread Heikki Linnakangas
On 05/30/2014 10:25 AM, Michael Paquier wrote: On Fri, May 30, 2014 at 4:31 AM, Robert Haas robertmh...@gmail.com wrote: I suspect it would be good, then, to separate this into two patches, one for back-patch and one not. Attached are patches for master and 9.3. 9.2 and older versions are not

[HACKERS] Fix xpath() to return namespace definitions

2014-05-30 Thread Ali Akbar
Hi all, While developing some XML processing queries, i stumbled on an old bug mentioned in http://wiki.postgresql.org/wiki/Todo#XML: Fix Nested or repeated xpath() that apparently mess up namespaces. Source of the bug is that libxml2's xmlNodeDump won't output XML namespace definitions that

Re: [HACKERS] pg_class.relpages/allvisible probably shouldn't be a int4

2014-05-30 Thread Andres Freund
On 2014-05-11 23:30:37 +0200, Andres Freund wrote: On 2014-05-11 12:24:30 -0400, Tom Lane wrote: Andres Freund and...@2ndquadrant.com writes: On 2014-05-10 23:21:34 -0700, Peter Geoghegan wrote: On Fri, May 9, 2014 at 1:50 PM, Andres Freund and...@2ndquadrant.com wrote: And adding

Re: [HACKERS] pg_class.relpages/allvisible probably shouldn't be a int4

2014-05-30 Thread Simon Riggs
On 12 May 2014 08:15, Andres Freund and...@2ndquadrant.com wrote: But I concur that in practice, if you're dealing with 16TB tables, it's time to partition. Well, we need to improve our partitioning for that to be viable for all relations. Not having usable foreign and unique keys makes it a

Re: [HACKERS] pg_class.relpages/allvisible probably shouldn't be a int4

2014-05-30 Thread Andres Freund
On 2014-05-30 12:00:47 +0100, Simon Riggs wrote: On 12 May 2014 08:15, Andres Freund and...@2ndquadrant.com wrote: But I concur that in practice, if you're dealing with 16TB tables, it's time to partition. Well, we need to improve our partitioning for that to be viable for all

Re: [HACKERS] Odd uuid-ossp behavior on smew and shearwater

2014-05-30 Thread Magnus Hagander
On Fri, May 30, 2014 at 12:45 AM, Andrew Dunstan and...@dunslane.net wrote: On 05/29/2014 05:41 PM, Josh Kupershmidt wrote: On Thu, May 29, 2014 at 4:06 PM, Andrew Dunstan and...@dunslane.net wrote: Almost all my critters run in VMs (all but jacana and bowerbird). They're not running on

[HACKERS] jsonb access operators inefficiency

2014-05-30 Thread Teodor Sigaev
Hi! jsonb operators -text, -text,-int, -int use inefficient methods to access to needed field, proportional O(N/2). Attached patch suggests for text operators O(log(N)) and for integer - O(1). The fuctions with fast access already are existed in current code and are used in contains

Re: [HACKERS] CREATE REPLICATION SLOT fails on a timeout

2014-05-30 Thread Steve Singer
On 05/28/2014 06:41 PM, Andres Freund wrote: Hi, Pushed a fix for it. I am pretty sure it will, but could you still test that it fixes your problem? Thanks! The fix seems to work (I am no longer getting the timeout on slot creation) Thanks Andres Freund -- Sent via pgsql-hackers

Re: [HACKERS] Extended Prefetching using Asynchronous IO - proposal and patch

2014-05-30 Thread Claudio Freire
On Fri, May 30, 2014 at 4:15 AM, Heikki Linnakangas hlinnakan...@vmware.com wrote: We don't want polling... And even if we did, calling aio_suspend() in a way that's known to be broken, in a loop, is a pretty crappy way of polling. Well, as mentioned earlier, it is not broken. Whether

Re: [HACKERS] pg_class.relpages/allvisible probably shouldn't be a int4

2014-05-30 Thread Alvaro Herrera
Andres Freund wrote: On 2014-05-11 23:30:37 +0200, Andres Freund wrote: Yea. I really don't like to take on such a major project to solve a minor problem. What I am thinking about right now is to expose a 'pg_blocknumber' type. That only does very basic operations and implicitly casts to

Re: [HACKERS] SP-GiST bug.

2014-05-30 Thread Teodor Sigaev
The point I'm making is that the scenario your test case exposes is not an infinite loop of picksplits, but an infinite loop of choose calls. Thank you, now I see what I missed before. After some brainstorming, it's possible to use '\0' only as end of string marker. The idea is: when we split

Re: [HACKERS] jsonb access operators inefficiency

2014-05-30 Thread Andrew Dunstan
On 05/30/2014 09:35 AM, Teodor Sigaev wrote: Hi! jsonb operators -text, -text,-int, -int use inefficient methods to access to needed field, proportional O(N/2). Attached patch suggests for text operators O(log(N)) and for integer - O(1). The fuctions with fast access already are existed in

Re: [HACKERS] recovery testing for beta

2014-05-30 Thread Heikki Linnakangas
On 05/29/2014 07:39 PM, Jeff Janes wrote: It also implicitly tested the xlog parallel write slots thing, as that is common code to all recovery. During development, I hit a lot of bugs in that patch by setting wal_buffers to 32kb (the minimum). Causes more backends to wait for each other,

Re: [HACKERS] Proposal for CSN based snapshots

2014-05-30 Thread Greg Stark
On Fri, May 30, 2014 at 3:59 PM, Heikki Linnakangas hlinnakan...@vmware.com wrote: If transaction A commits synchronously with commit LSN 1, and transaction B commits asynchronously with commit LSN 2, B cannot become visible before A. And we cannot acknowledge B as committed to the client until

Re: [HACKERS] SP-GiST bug.

2014-05-30 Thread Bruce Momjian
On Fri, May 30, 2014 at 06:55:18PM +0400, Teodor Sigaev wrote: The point I'm making is that the scenario your test case exposes is not an infinite loop of picksplits, but an infinite loop of choose calls. Thank you, now I see what I missed before. After some brainstorming, it's possible to

Re: [HACKERS] Proposal for CSN based snapshots

2014-05-30 Thread Heikki Linnakangas
On 05/30/2014 06:09 PM, Greg Stark wrote: On Fri, May 30, 2014 at 3:59 PM, Heikki Linnakangas hlinnakan...@vmware.com wrote: If transaction A commits synchronously with commit LSN 1, and transaction B commits asynchronously with commit LSN 2, B cannot become visible before A. And we cannot

Re: [HACKERS] Proposal for CSN based snapshots

2014-05-30 Thread Andres Freund
Hi, On 2014-05-30 17:59:23 +0300, Heikki Linnakangas wrote: So, here's a first version of the patch. Still very much WIP. Cool. One thorny issue came up in discussions with other hackers on this in PGCon: When a transaction is committed asynchronously, it becomes visible to other backends

[HACKERS] pivot aggregation with a patched intarray

2014-05-30 Thread Marc Mamin
Hello, (sorry for this long post) I have patched intarray with 3 additional functions in order to count[distinct] event IDs into arrays, whereas the array position correspond to the integer values. (mimic column oriented storage) I need to use an array for the event IDs as I don't know how

Re: [HACKERS] SP-GiST bug.

2014-05-30 Thread Teodor Sigaev
If we bump the system catalog version, pg_upgrade can mark those indexes as invalid and output a script to reindex them. Between 9.3 - 9.4 catalog version is changed anyway. -- Teodor Sigaev E-mail: teo...@sigaev.ru WWW:

Re: [HACKERS] pivot aggregation with a patched intarray

2014-05-30 Thread Marc Mamin
(reposted, this time with attachment. sorry) Hello, (sorry for this long post) I have patched intarray with 3 additional functions in order to count[distinct] event IDs into arrays, whereas the array position correspond to the integer values. (mimic column oriented storage) I need to use

Re: [HACKERS] jsonb access operators inefficiency

2014-05-30 Thread Andrew Dunstan
On 05/30/2014 11:08 AM, Andrew Dunstan wrote: On 05/30/2014 09:35 AM, Teodor Sigaev wrote: Hi! jsonb operators -text, -text,-int, -int use inefficient methods to access to needed field, proportional O(N/2). Attached patch suggests for text operators O(log(N)) and for integer - O(1). The

Re: [HACKERS] jsonb access operators inefficiency

2014-05-30 Thread Teodor Sigaev
If we're going to construct varlena objects inside a StringInfo, maybe we need a proper API for it. Isn't there a danger that data member of the StringInfo won't be properly aligned to allow us to do this? In any case, we should get most of the benefit of your patch without this optimization.

Re: [HACKERS] jsonb access operators inefficiency

2014-05-30 Thread Teodor Sigaev
I see that palloc.h says: The result of palloc() is always word-aligned void * repalloc(void *pointer, Size size) { ... /* * Try to detect bogus pointers handed to us, poorly though we can. * Presumably, a pointer that isn't MAXALIGNED isn't pointing at an * allocated

Re: [HACKERS] jsonb access operators inefficiency

2014-05-30 Thread Oleg Bartunov
The patch really improves access performance to jsonb. On the delicious bookmarks I got 5 times better performance.Now jsonb outperforms json on simple access (slide 12 of pgcon presentation) by 103 times ! Oleg On Fri, May 30, 2014 at 9:35 AM, Teodor Sigaev teo...@sigaev.ru wrote: Hi!

Re: [HACKERS] jsonb access operators inefficiency

2014-05-30 Thread Andrew Dunstan
On 05/30/2014 01:30 PM, Oleg Bartunov wrote: The patch really improves access performance to jsonb. On the delicious bookmarks I got 5 times better performance.Now jsonb outperforms json on simple access (slide 12 of pgcon presentation) by 103 times ! (Oleg, please try not to top-post)

Re: [HACKERS] jsonb access operators inefficiency

2014-05-30 Thread Tom Lane
Andrew Dunstan and...@dunslane.net writes: If we're going to construct varlena objects inside a StringInfo, maybe we need a proper API for it. Isn't there a danger that data member of the StringInfo won't be properly aligned to allow us to do this? In any case, we should get most of the

Re: [HACKERS] jsonb access operators inefficiency

2014-05-30 Thread Teodor Sigaev
The question is whether the speedup comes from the reduction in lookup times or the reduction in string copying. I have a strong suspicion that it's mostly the first, not the second. Agree with about Oleg's test, but some users put huge values into json... Actually, I don't insist, ITSM,

Re: [HACKERS] Proposal for CSN based snapshots

2014-05-30 Thread Heikki Linnakangas
On 05/30/2014 06:27 PM, Andres Freund wrote: On 2014-05-30 17:59:23 +0300, Heikki Linnakangas wrote: One thorny issue came up in discussions with other hackers on this in PGCon: When a transaction is committed asynchronously, it becomes visible to other backends before the commit WAL record is

Re: [HACKERS] Proposal for CSN based snapshots

2014-05-30 Thread Heikki Linnakangas
(forgot to answer this question) On 05/30/2014 06:27 PM, Andres Freund wrote: On 2014-05-30 17:59:23 +0300, Heikki Linnakangas wrote: * I expanded pg_clog to 64-bits per XID, but people suggested keeping pg_clog as is, with two bits per commit, and adding a new SLRU for the commit LSNs beside

Re: [HACKERS] [GENERAL] unable to build postgres-9.4 in os x 10.9 with python

2014-05-30 Thread Tom Lane
Asif Naeem anaeem...@gmail.com writes: On Fri, May 30, 2014 at 9:49 PM, reiner peterke zedaa...@drizzle.com wrote: Since upgrading my mac from os x 10.8 to 10.9, i can no long build postgres with '--with-python’. Latest PG 9.4 source code seems building fine with --with-python option on

Re: [HACKERS] [GENERAL] unable to build postgres-9.4 in os x 10.9 with python

2014-05-30 Thread Adrian Klaver
On 05/30/2014 11:52 AM, Tom Lane wrote: Asif Naeem anaeem...@gmail.com writes: On Fri, May 30, 2014 at 9:49 PM, reiner peterke zedaa...@drizzle.com wrote: Since upgrading my mac from os x 10.8 to 10.9, i can no long build postgres with '--with-python’. Latest PG 9.4 source code seems

Re: [HACKERS] SP-GiST bug.

2014-05-30 Thread Bruce Momjian
On Fri, May 30, 2014 at 08:19:07PM +0400, Teodor Sigaev wrote: If we bump the system catalog version, pg_upgrade can mark those indexes as invalid and output a script to reindex them. Between 9.3 - 9.4 catalog version is changed anyway. Right. I was thinking of beta users between beta1

Re: [HACKERS] [GENERAL] unable to build postgres-9.4 in os x 10.9 with python

2014-05-30 Thread Tom Lane
Adrian Klaver adrian.kla...@aklaver.com writes: On 05/30/2014 11:52 AM, Tom Lane wrote: If you do the ld call by hand without the -syslibroot option, it works. AFAICS it could never have worked with such an option, so I'm thinking this is some new misbehavior in the latest version of Xcode.

Re: [HACKERS] Proposing pg_hibernate

2014-05-30 Thread Josh Kupershmidt
On Tue, May 27, 2014 at 10:01 PM, Gurjeet Singh gurj...@singh.im wrote: When the Postgres server is being stopped/shut down, the `Buffer Saver` scans the shared-buffers of Postgres, and stores the unique block identifiers of each cached block to the disk. This information is saved under the

Re: [HACKERS] recovery testing for beta

2014-05-30 Thread Jeff Janes
On Thu, May 29, 2014 at 8:15 PM, Amit Kapila amit.kapil...@gmail.com wrote: On Thu, May 29, 2014 at 10:09 PM, Jeff Janes jeff.ja...@gmail.com wrote: What features in 9.4 need more beta testing for recovery? Another feature which have interaction with recovery is reduced WAL for Update

Re: [HACKERS] [GENERAL] unable to build postgres-9.4 in os x 10.9 with python

2014-05-30 Thread Adrian Klaver
On 05/30/2014 01:31 PM, Tom Lane wrote: Adrian Klaver adrian.kla...@aklaver.com writes: On 05/30/2014 11:52 AM, Tom Lane wrote: If you do the ld call by hand without the -syslibroot option, it works. AFAICS it could never have worked with such an option, so I'm thinking this is some new

Re: [HACKERS] recovery testing for beta

2014-05-30 Thread Noah Misch
On Thu, May 29, 2014 at 09:39:56AM -0700, Jeff Janes wrote: I've applied my partial-write testing harness to several scenarios in 9.4. So far its found a recovery bug for gin indexes, a recovery bug for btree, a vacuum bug for btree indexes (with foreign keys, but that is not relevant to the

Re: [HACKERS] recovery testing for beta

2014-05-30 Thread Amit Kapila
On Sat, May 31, 2014 at 3:51 AM, Jeff Janes jeff.ja...@gmail.com wrote: On Thu, May 29, 2014 at 8:15 PM, Amit Kapila amit.kapil...@gmail.com wrote: On Thu, May 29, 2014 at 10:09 PM, Jeff Janes jeff.ja...@gmail.com wrote: What features in 9.4 need more beta testing for recovery? Another