Re: [HACKERS] Range Types - typo + NULL string constructor
On Thu, 2011-09-22 at 02:31 +0200, Florian Pflug wrote: My personal favourite would be '0', since it resembles the symbol used for empty sets in mathematics, and we already decided to use mathematical notation for ranges. If we're concerned that most of our users won't get that, then 'empty' would be a viable alternative I think. From a consistency POV it'd make sense to use a bracket-based syntax also for empty ranges. But the only available options would be '()' and '[]', which are too easily confused with '(,)' and '[,]' (which we already decided should represent the full range). Yes, I think () is too close to (,). Brainstorming so far: 0 : simple, looks like the empty set symbol empty : simple empty : a little more obvious that it's special : visually looks empty - : also looks empty {} : mathematical notation, but doesn't quite fit ranges I don't have a strong opinion. I'd be OK with any of those. Regards, Jeff Davis -- 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] EXPLAIN and nfiltered, take two
On 22.09.2011 07:51, Tom Lane wrote: Here's a revised version of the patch that behaves in a way that seems reasonable to me, in particular it suppresses zero filter-count rows in text mode. I've not done anything yet about the documentation. I haven't been following this closely, so sorry if this has already been discussed, but: I find it a bit strange to print the number of lines filtered out. I think that's the only place where we would print a negative like that, everywhere else we print the number of lines let through a node. How about printing the number of lines that enter the filter, instead? -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com -- 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] EXPLAIN and nfiltered, take two
Heikki Linnakangas heikki.linnakan...@enterprisedb.com writes: I haven't been following this closely, so sorry if this has already been discussed, but: I find it a bit strange to print the number of lines filtered out. I think that's the only place where we would print a negative like that, everywhere else we print the number of lines let through a node. How about printing the number of lines that enter the filter, instead? Yeah, I thought seriously about that too. The problem with it is that you end up having to print that line all the time, whether or not it adds any knowledge. The filter removed N rows approach has the saving grace that you can leave it out when no filtering is happening. Another point is that if you have two filters operating at a node, printing only the starting number of rows doesn't let you disentangle which filter did how much. Now having said that, I could still be talked into the other way if someone had a design that accounted for outer/semi/anti-join behavior more clearly than this does. I thought for a little bit that printing the starting number of rows might offer such a solution, but on inspection it didn't really seem to help. regards, tom lane -- 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] WIP: SP-GiST, Space-Partitioned GiST
On 06.09.2011 20:34, Oleg Bartunov wrote: Here is the latest spgist patch, which has all planned features as well as all overhead, introduced by concurrency and recovery, so performance measurement should be realistic now. I'm ignoring the text suffix-tree part of this for now, because of the issue with non-C locales that Alexander pointer out. Regarding the quadtree, have you compared the performance of that with Alexander's improved split algorithm? I ran some tests using the test harness I still had lying around from the fast GiST index build tests: testname | time | accesses | indexsize -+-+--+--- points unordered auto | 00:03:58.188866 | 378779 | 522 MB points ordered auto | 00:07:14.362355 | 177534 | 670 MB points unordered auto | 00:02:59.130176 |46561 | 532 MB points ordered auto | 00:04:00.50756 |45066 | 662 MB points unordered spgist | 00:03:05.569259 |78871 | 394 MB points ordered spgist | 00:01:46.06855 | 422104 | 417 MB (8 rows) These tests were with a table with 750 random points. In the ordered-tests, the table is sorted by x,y coordinates. 'time' is the time used to build the index on it, and 'accesses' is the total number of index blocks hit by a series of 1 bounding box queries, measured from pg_statio_user_indexes.idx_blks_hit + idx_blks_read. The first two tests in the list are with a GiST index on unpatched PostgreSQL. The next six tests are with Alexander's double-sorting split patch. The last two tests are with an SP-GiST index. It looks like the query performance with GiST using the double-sorting split is better than SP-GiST, although the SP-GiST index is somewhat smaller. The ordered case seems pathologically bad, is that some sort of a worst-case scenario for quadtrees? -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com -- 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] PostgreSQL X/Open Socket / BSD Socket Issue on HP-UX
Very sorry for late reply. You are right, _xpg_ socket functionality is not available in older systems, it is available in hp-ux 11.23 version through patch HCO_35744 . HPUX 10.20 is very old machine (1996). I am using latest HPUX B.11.31 machine, I don't have access to older systems. -D_XOPEN_SOURCE_EXTENDED make the postgres build X/Open Socket enabled including connector's i.e libpq. Now if system default 64bit perl (BSD Socket) try to use libpq (X/Open Socket) it will end up in unexpected results or errors . HP-UX don't allow mixing of X/Open Socket objects and BSD Socket objects in the same 64bit binary, HP tried to fix this issue through -D_HPUX_ALT_XOPEN_SOCKET_API on later version of OS. It seems nice that if postgres adopt this fix at least for connectors (PFA patch, minor change in src/interfaces/libpq/Makefile) and so that users on later hp-ux boxes don't trouble with these socket issues and connect their applications to database server with the help of libpq without the fear of X/Open Socket or BSD Socket complexity. On older system defining _HPUX_ALT_XOPEN_SOCKET_API should do no effects or issues. Thanks. ( http://docstore.mik.ua/manuals/hp-ux/en/B2355-60130/xopen_networking.7.html ).. HP-UX provides two styles of Sockets API: - default BSD Sockets -X/Open Sockets These two styles of Sockets API have the same function names but they have differences in semantics and argument types. For example, the optlen field in X/Open getsockopt() is size_t type, while BSD getsockopt() is int type. In 64 bit mode, size_t is 64 bit and int is still 32 bit. Linking objects compiled to X/Open Sockets specification and objects compiled to BSD Sockets specification in the same program using the linkage method in method A would erroneously resolve BSD Sockets calls to X/Open Sockets functions in the Xnet library. As a result, the program may result in application core dumps or unexpected Socket errors when it is run. These symptoms commonly occur when BSD Sockets accept(), getpeername(), getsockname(), getsockopt(), recvfrom(), sendmsg(), and recvmsg() are called. .. Best Regards,Muhammad Asif Naeem To: anaeem...@hotmail.com CC: pgsql-hackers@postgresql.org Subject: Re: [HACKERS] PostgreSQL X/Open Socket / BSD Socket Issue on HP-UX Date: Tue, 20 Sep 2011 18:06:55 -0400 From: t...@sss.pgh.pa.us MUHAMMAD ASIF anaeem...@hotmail.com writes: I faced similar issue as discussed in http://postgresql.1045698.n5.nabble.com/Fwd-DBD-Pg-on-HP-UX-11-31-64bit-td3305163.html;. (man xopen_networking - http://docstore.mik.ua/manuals/hp-ux/en/B2355-60130/xopen_networking.7.html) ... There are two ways to obtain X/Open Sockets functionality: * Method A is in compliance with X/Open compilation specification.* Method B slightly deviates from X/Open compilation specification. However, Method B allows a program to include both objects compiled to X/Open Sockets specification and objects compiled to BSD Sockets specification. ... PostgreSQL support X/Open Sockets. Apache web server (2.2.15, /opt/hpws22/apache) and Perl (5.8.8, /opt/perl_64) are BSD Socket applications that are default with the OS. I tried Method B (It provides wrapper _xpg_ socket functions that allows using X/Open socket objects and BSD socket objects in the same binary) to build PostgreSQL 9.1 code, I LD_PRELOAD the generated libpq binary, without any other change both perl and apache work fine with postgresql now,and it is easy to implement too. We just need to build the source code with -D_XOPEN_SOURCE=600 -D_HPUX_ALT_XOPEN_SOCKET_API and link binary with libc. PFA patch. Thanks. AFAICT, the proposed patch will break things on at least some versions of HPUX. You can't just arbitrarily remove the reference to -lxnet, at least not without explaining to us why the existing comment about it is wrong. Likewise, removing -D_XOPEN_SOURCE_EXTENDED isn't acceptable without a whole more supporting evidence than you've provided. (I'm fairly certain that the latter will break the build on my old HPUX 10.20 box, for example.) regards, tom lane hp-ux_socket.patch.v2 Description: Binary data -- 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] WIP: SP-GiST, Space-Partitioned GiST
On Thu, Sep 22, 2011 at 2:05 PM, Heikki Linnakangas heikki.linnakan...@enterprisedb.com wrote: Regarding the quadtree, have you compared the performance of that with Alexander's improved split algorithm? I ran some tests using the test harness I still had lying around from the fast GiST index build tests: testname | time | accesses | indexsize -+**-+--+-**-- points unordered auto | 00:03:58.188866 | 378779 | 522 MB points ordered auto | 00:07:14.362355 | 177534 | 670 MB points unordered auto | 00:02:59.130176 |46561 | 532 MB points ordered auto | 00:04:00.50756 |45066 | 662 MB points unordered spgist | 00:03:05.569259 |78871 | 394 MB points ordered spgist | 00:01:46.06855 | 422104 | 417 MB (8 rows) I assume first two rows to be produced by new linear split algorithm(current) and secound two rows by double sorting split algorithm(my patch). These tests were with a table with 750 random points. In the ordered-tests, the table is sorted by x,y coordinates. 'time' is the time used to build the index on it, and 'accesses' is the total number of index blocks hit by a series of 1 bounding box queries, measured from pg_statio_user_indexes.idx_**blks_hit + idx_blks_read. The first two tests in the list are with a GiST index on unpatched PostgreSQL. The next six tests are with Alexander's double-sorting split patch. The last two tests are with an SP-GiST index. It looks like the query performance with GiST using the double-sorting split is better than SP-GiST, although the SP-GiST index is somewhat smaller. The ordered case seems pathologically bad, is that some sort of a worst-case scenario for quadtrees? Comparison of search speed using number of page accesses is quite comprehensive for various GiST indexes. But when we're comparing SP-GiST vs GiST we should take into accoung that they have different CPU/IO ratio. GiST scans whole page which it accesses. SP-GiST can scan only fraction of page because several nodes can be packed into single page. Thereby it would be interesting to compare also CPU load GiST vs. SP-GiST. Also, there is some hope to reduce number of page accesses in SP-GiST by improving clustering algorithm. -- With best regards, Alexander Korotkov.
Re: [HACKERS] Double sorting split patch
! /* !* Calculate delta between penalties of join common entries to !* different groups. !*/ ! for (i = 0; i commonEntriesCount; i++) { ! double lower, ! upper; ! ! box = DatumGetBoxP(entryvec-vector[commonEntries[i].index].key); ! if (context.dim == 0) ! { ! lower = box-low.x; ! upper = box-high.x; ! } ! else ! { ! lower = box-low.y; ! upper = box-high.y; ! } ! commonEntries[i].delta = Abs(box_penalty(leftBox, box) - ! box_penalty(rightBox, box)); } 'lower' and 'upper' are not used for anything in the above. Is that just dead code that can be removed, or is there something missing that should be using them? -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com -- 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] [v9.2] make_greater_string() does not return a string in some cases
Thank you for your understanding on that point. At Wed, 21 Sep 2011 20:35:02 -0400, Robert Haas robertmh...@gmail.com wrote ...while Kyotaro Horiguchi clearly feels otherwise, citing the statistic that about 100 out of 7000 Japanese characters fail to work properly: http://archives.postgresql.org/pgsql-bugs/2011-07/msg00064.php That statistic seems to justify some action, but what? Ideas: Addition to the figures - based on whole characters defined in JIS X 0208 which is traditionally (It is becoming a history now.) for information exchange in Japan - narrowing to commonly-used characters (named `Jouyou-Kanji' in Japanese, to be learned by high school graduates in Japan), 35 out of 2100 hits. # On the other hand, widening to JIS X 0213 which is roughly # compatible with the Unicode, and defines more than 12K chars, I # have not counted, but the additional 5k characters can be # assumed to have less probability to fail than the chars in JIS # X 0208. 1. Adopt the patch as proposed, or something like it. 2. Instead of installing encoding-specific character incrementing functions, we could try to come up with a more reliable generic algorithm. Not sure exactly what, though. 3. Come up with some way to avoid needing to do this in the first place. One random idea I have is - instead of generating and clauses, could we define a prefix match operator - i.e. a ### b iff substr(a, 1, length(b)) = b? We'd need to do something about the selectivity, but I don't see why that would be a problem. Thoughts? I am a newbie for PostgreSQL, but from a general view, I think that the most radical and clean way to fix this behavior is to make indexes to have the forward-matching function for strings in itself, with ignoreing possible overheads I don't know. This can save the all failures this patch has left unsaved, assuming that the `greater string' is not necessary to be a `valid string' just on searching btree. Another idea that I can guess is to add a new operator that means examine if the string value is smaller than the `greater string' of the parameter.. This operator also can defer making `greater string' to just before searching btree or summing up histogram entries, or comparison with column values. If the assumption above is true, making greater string operation can be done in regardless of character encoding. This seems have smaller impact than prefix match operator. # But, mmm, The more investigating, the less difference it seems # for me to be... But It is out of my knowledge now, anyway.. I # need more study. On the other hand, if no additional encoding-specific `character increment function' will not come out, the modification of pg_wchar_table can be cancelled and make_greater_string will select the `character increment function' as 'switch (GetDatabaseEncoding()) { case PG_UTF8:.. }'. This get rid of the pg_generic_charinc tweak for libpq too. At Wed, 21 Sep 2011 21:49:27 -0400, Tom Lane t...@sss.pgh.pa.us wrote detail work; for instance, I noted an unconstrained memcpy into a 4-byte local buffer, as well as lots and lots of violations of PG house style. That's certainly all fixable but somebody will have to go through it. Sorry for the illegal style of the patch. I will confirm it. Regards, -- Kyotaro Horiguchi NTT Open Source Software Center -- 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] Double sorting split patch
On Thu, Sep 22, 2011 at 3:22 PM, Heikki Linnakangas heikki.linnakan...@enterprisedb.com wrote: ! /* !* Calculate delta between penalties of join common entries to !* different groups. !*/ ! for (i = 0; i commonEntriesCount; i++) { ! double lower, ! upper; ! ! box = DatumGetBoxP(entryvec-vector[** commonEntries[i].index].key); ! if (context.dim == 0) ! { ! lower = box-low.x; ! upper = box-high.x; ! } ! else ! { ! lower = box-low.y; ! upper = box-high.y; ! } ! commonEntries[i].delta = Abs(box_penalty(leftBox, box) - ! box_penalty(rightBox, box)); } 'lower' and 'upper' are not used for anything in the above. Is that just dead code that can be removed, or is there something missing that should be using them? Yes, it's just dead code. -- With best regards, Alexander Korotkov.
Re: [HACKERS] Online base backup from the hot-standby
On Wed, Sep 21, 2011 at 5:34 PM, Magnus Hagander mag...@hagander.net wrote: On Wed, Sep 21, 2011 at 08:23, Fujii Masao masao.fu...@gmail.com wrote: On Wed, Sep 21, 2011 at 2:13 PM, Magnus Hagander mag...@hagander.net wrote: Presumably pg_start_backup() will check this. And we'll somehow track this before pg_stop_backup() as well? (for such evil things such as the user changing FPW from on to off and then back to on again during a backup, will will make it look correct both during start and stop, but incorrect in the middle - pg_stop_backup needs to fail in that case as well) Right. As I suggested upthread, to address that problem, we need to log the change of FPW on the master, and then we need to check whether such a WAL is replayed on the standby during the backup. If it's done, pg_stop_backup() should emit an error. I somehow missed this thread completely, so I didn't catch your previous comments - oops, sorry. The important point being that we need to track if when this happens even if it has been reset to a valid value. So we can't just check the state of the variable at the beginning and at the end. Right. Let me explain again what I'm thinking. When FPW is changed, the master always writes the WAL record which contains the current value of FPW. This means that the standby can track all changes of FPW by reading WAL records. The standby has two flags: One indicates whether FPW has always been TRUE since last restartpoint. Another indicates whether FPW has always been TRUE since last pg_start_backup(). The standby can maintain those flags by reading WAL records streamed from the master. If the former flag indicates FALSE (i.e., the WAL records which the standby has replayed since last restartpoint might not contain required FPW), pg_start_backup() fails. If the latter flag indicates FALSE (i.e., the WAL records which the standby has replayed during the backup might not contain required FPW), pg_stop_backup() fails. If I'm not missing something, this approach can address the problem which you're concerned about. Regards, -- Fujii Masao NIPPON TELEGRAPH AND TELEPHONE CORPORATION NTT Open Source Software Center -- 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] [v9.2] make_greater_string() does not return a string in some cases
On Thu, Sep 22, 2011 at 12:24 AM, Tom Lane t...@sss.pgh.pa.us wrote: Robert Haas robertmh...@gmail.com writes: I'm a bit perplexed as to why we can't find a non-stochastic way of doing this. [ collations suck ] Ugh. Now, having said that, I'm starting to wonder again why it's worth our trouble to fool with encoding-specific incrementers. The exactness of the estimates seems unlikely to be improved very much by doing this. Well, so the problem is that the frequency with which the algorithm fails altogether seems to be disturbingly high for certain kinds of characters. I agree it might not be that important to get the absolutely best next string, but it does seem important not to fail outright. Kyotaro Horiguchi gives the example of UTF-8 characters ending with 0xbf. One random idea I have is - instead of generating and clauses, could we define a prefix match operator - i.e. a ### b iff substr(a, 1, length(b)) = b? We'd need to do something about the selectivity, but I don't see why that would be a problem. The problem is that you'd need to make that a btree-indexable operator. Well, right. Without that, there's not much point. But do you think that's prohibitively difficult? The problem is that you'd just be shifting all these same issues into the btree index machinery, which is not any better equipped to cope with them, and would not be a good place to be adding overhead. My thought was that it would avoid the need to do any character incrementing at all. You could just start scanning forward as if the operator were = and then stop when you hit the first string that doesn't have the same initial substring. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- 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] [v9.2] make_greater_string() does not return a string in some cases
On Thu, Sep 22, 2011 at 1:49 PM, Robert Haas robertmh...@gmail.com wrote: My thought was that it would avoid the need to do any character incrementing at all. You could just start scanning forward as if the operator were = and then stop when you hit the first string that doesn't have the same initial substring. But the whole problem is that not all the strings with the initial substring are in a contiguous block. The best we can hope for is that they're fairly dense within a block without too many non-matching strings. The example with / shows how that can happen. If you're looking for foo/% and you start with foo/ you'll find: foo/ foo0 foo/0 foo1 foo/1 ... Even just case-insensitive collations don't put all the strings with a common prefix in a contiguous block. If you're searching for foo% you'll find: foo Foobar foobar -- greg -- 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] Adding CORRESPONDING to Set Operations
On Sun, Sep 18, 2011 at 5:39 AM, Kerem Kat kerem...@gmail.com wrote: I am new to postgresql code, I would like to start implementing easyish TODO items. I have read most of the development guidelines, faqs, articles by Greg Smith (Hacking Postgres with UDFs, Adding WHEN to triggers). The item I would like to implement is adding CORRESPONDING [BY (col1[,col2,...]])] to INTERSECT and EXCEPT operators. Can anyone comment on how much effort this item needs? This seems reasonably tricky for a first project, but maybe not out of reach if you are a skilled C hacker. It's certainly more complicated than my first patch: http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=a0b76dc662efde6e02921c2d16e06418483b7534 I guess the first question that needs to be answered here is ... what exactly is this syntax supposed to do? A little looking around suggests that EXCEPT CORRESPONDING is supposed to make the correspondence run by column names rather than by column positions, and if you further add BY col1, ... then it restricts the comparison to those columns. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- 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] Online base backup from the hot-standby
On Wed, Sep 21, 2011 at 11:50 AM, Fujii Masao masao.fu...@gmail.com wrote: 2011/9/13 Jun Ishiduka ishizuka@po.ntts.co.jp: Update patch. Changes: * set 'on' full_page_writes by user (in document) * read FROM: XX in backup_label (in xlog.c) * check status when pg_stop_backup is executed (in xlog.c) Thanks for updating the patch. Before reviewing the patch, to encourage people to comment and review the patch, I explain what this patch provides: Attached is the updated version of the patch. I refactored the code, fixed some bugs, added lots of source code comments, improved the document, but didn't change the basic design. Please check this patch, and let's use this patch as the base if you agree with that. In the current patch, there is no safeguard for preventing users from taking backup during recovery when FPW is disabled. This is unsafe. Are you planning to implement such a safeguard? Regards, -- Fujii Masao NIPPON TELEGRAPH AND TELEPHONE CORPORATION NTT Open Source Software Center *** a/doc/src/sgml/backup.sgml --- b/doc/src/sgml/backup.sgml *** *** 935,940 SELECT pg_stop_backup(); --- 935,999 /para /sect2 + sect2 id=backup-during-recovery +titleMaking a Base Backup during Recovery/title + +para + It's possible to make a base backup during recovery. Which allows a user + to take a base backup from the standby to offload the expense of + periodic backups from the master. Its procedure is similar to that + during normal running. + orderedlist +listitem + para + Ensure that hot standby is enabled (see xref linkend=hot-standby + for more information). + /para +/listitem +listitem + para + Connect to the database as a superuser and execute functionpg_start_backup/. + This performs a restartpoint if there is at least one checkpoint record + replayed since last restartpoint. + /para +/listitem +listitem + para + Perform a file system backup. + /para +/listitem +listitem + para + Copy the pg_control file from the cluster directory to the backup as follows: + programlisting + cp $PGDATA/global/pg_control /mnt/server/backupdir/global + /programlisting + /para +/listitem +listitem + para + Again connect to the database as a superuser, and execute + functionpg_stop_backup/. This terminates the backup mode, but does not + perform a switch to the next WAL segment, create a backup history file and + wait for all required WAL segments to be archived, + unlike that during normal processing. + /para +/listitem + /orderedlist +/para + +para + You cannot use the applicationpg_basebackup/ tool to take the backup + during recovery. +/para +para + It's not possible to make a base backup from the server in recovery mode + when reading WAL written during a period when varnamefull_page_writes/ + was disabled. If you take a base backup from the standby, + varnamefull_page_writes/ must be set to true on the master. +/para + /sect2 + sect2 id=backup-pitr-recovery titleRecovering Using a Continuous Archive Backup/title *** a/doc/src/sgml/config.sgml --- b/doc/src/sgml/config.sgml *** *** 1680,1685 SET ENABLE_SEQSCAN TO OFF; --- 1680,1693 /para para + WAL written while varnamefull_page_writes/ is disabled does not + contain enough information to make a base backup during recovery + (see xref linkend=backup-during-recovery), + so varnamefull_page_writes/ must be enabled on the master + to take a backup from the standby. +/para + +para This parameter can only be set in the filenamepostgresql.conf/ file or on the server command line. The default is literalon/. *** a/doc/src/sgml/func.sgml --- b/doc/src/sgml/func.sgml *** *** 14014,14020 SELECT set_config('log_statement_stats', 'off', false); para The functions shown in xref linkend=functions-admin-backup-table assist in making on-line backups. ! These functions cannot be executed during recovery. /para table id=functions-admin-backup-table --- 14014,14021 para The functions shown in xref linkend=functions-admin-backup-table assist in making on-line backups. ! These functions except functionpg_start_backup/ and functionpg_stop_backup/ ! cannot be executed during recovery. /para table id=functions-admin-backup-table *** *** 14094,14100 SELECT set_config('log_statement_stats', 'off', false); database cluster's data directory, performs a checkpoint, and then returns the backup's starting transaction log location as text. The user can ignore this result value, but it is ! provided in case it is useful. programlisting postgres=# select
Re: [HACKERS] [v9.2] make_greater_string() does not return a string in some cases
On Thu, Sep 22, 2011 at 8:59 AM, Greg Stark st...@mit.edu wrote: On Thu, Sep 22, 2011 at 1:49 PM, Robert Haas robertmh...@gmail.com wrote: My thought was that it would avoid the need to do any character incrementing at all. You could just start scanning forward as if the operator were = and then stop when you hit the first string that doesn't have the same initial substring. But the whole problem is that not all the strings with the initial substring are in a contiguous block. The best we can hope for is that they're fairly dense within a block without too many non-matching strings. The example with / shows how that can happen. If you're looking for foo/% and you start with foo/ you'll find: foo/ foo0 foo/0 foo1 foo/1 ... Even just case-insensitive collations don't put all the strings with a common prefix in a contiguous block. If you're searching for foo% you'll find: foo Foobar foobar If that were true for the sorts of indexes we're using for LIKE queries, the existing approach wouldn't work either. All we're doing is translating: a LIKE 'foo/%' to a ~=~ 'foo/%' AND a ~~ 'foo0' ...where ~=~ and ~~ are just text-pattern-ops versions of = and that ignore the normal collation rules and just compare bytes. In general, if we wanted to get rid of text_pattern_ops and make all of this work with arbitrary indexes, yeah, that would be very difficult. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- 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] [v9.2] make_greater_string() does not return a string in some cases
Robert Haas robertmh...@gmail.com writes: On Thu, Sep 22, 2011 at 8:59 AM, Greg Stark st...@mit.edu wrote: But the whole problem is that not all the strings with the initial substring are in a contiguous block. If that were true for the sorts of indexes we're using for LIKE queries, the existing approach wouldn't work either. Right. Since it's not a problem for the sorts of indexes with which we can use LIKE, moving knowledge of LIKE into the btree machinery doesn't buy us a darn thing, except more complexity in a place where we can ill afford it. The essential problem here is when can you stop scanning, given a pattern with this prefix?, and btree doesn't know any more about that than make_greater_string does; it would in fact have to use make_greater_string or something isomorphic to it. regards, tom lane -- 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] memory barriers (was: Yes, WaitLatch is vulnerable to weak-memory-ordering bugs)
On Wed, Sep 21, 2011 at 5:07 PM, Kevin Grittner kevin.gritt...@wicourts.gov wrote: That's the sort of thing where it would be helpful to provide one or two URLs for cogent explanations of this. Even if it takes repeated readings and meditations on the explanations for it to sink in, this is worth it. (For SSI I had to read the paper many times, and then go read several referenced papers, before I really had my head around it, and I've had others say the same thing. But having a link to the material gives someone a chance to *do* that.) Hmm looks around the Internet some more These might be a good place to start, although the first one is somewhat Linux-kernel specific: http://www.rdrop.com/users/paulmck/scalability/paper/ordering.2007.09.19a.pdf http://www.rdrop.com/users/paulmck/scalability/paper/whymb.2010.06.07c.pdf There's also a reasonably cogent explanation in the Linux kernel itself, in Documentation/memory-barriers.txt -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- 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] new createuser option for replication role
Hello Before doing the complete review, I hit a regression with 9.1 createrole. the command ''createuser -e -s foo produce : CREATE ROLE foo SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN NOREPLICATION; before it was: CREATE ROLE foo SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN; The REPLICATION was allowed by default to superuser, and the current patch change the default to remove the right. I believe we should add only the REPLICATION when --replication is set, and NOREPLICATION when --no-replication is set. 2011/9/11 Fujii Masao masao.fu...@gmail.com: On Sat, Sep 10, 2011 at 11:50 PM, Tom Lane t...@sss.pgh.pa.us wrote: Fujii Masao masao.fu...@gmail.com writes: Currently createuser cannot create a role with REPLICATION privilege because it doesn't have any option to do that. Which sometimes annoys me when setting up replication. I'd like to propose to add new options -x (--replication) and -X (--no-replication) into createuser. -x allows the new user to do replication, and -X disallows. The default is -X. Is it worth creating the patch? Though I'd like to use -r and -R as the option name, they have already been used for CREATEROLE privilege. So I'm thinking to use -x and -X derived from XLOG. But does anyone have better option name? Better solution: don't have a short form of the switch. That sounds better. I revised the patch so that it adds only --replication option to createuser. Regards, -- Fujii Masao NIPPON TELEGRAPH AND TELEPHONE CORPORATION NTT Open Source Software Center -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers -- Cédric Villemain +33 (0)6 20 30 22 52 http://2ndQuadrant.fr/ PostgreSQL: Support 24x7 - Développement, Expertise et Formation -- 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] Adding CORRESPONDING to Set Operations
I delved into the code without waiting for comments from the list just to learn something about postgresql internals. And I have finished the CORRESPONDING, now CORRESPONDING BY is being tested. I will also write documentation and regression tests. Yes Robert, you are correct. Having used SQL 20nn standard draft as a guide, a brief explanation can be provided as such: Shorter version: column name lists are intersected. Short version: In the set operation queries, which are queries containing INTERSECT, EXCEPT or UNION, a CORRESPONDING clause can be used to project the resulting columns to only columns contained in both sides of the query. There is also and addition of BY(col1, col2, ...) to the clause which projects the columns to its own list. An example query would clarifiy. SELECT 1 a, 2 b UNION CORRESPONDING SELECT 3 a; a -- 1 3 SELECT 1 a, 2 b, 3 c UNION CORRESPONDING BY(a, c) SELECT 4 a, 5 c a c -- 1 3 4 5 On Thu, Sep 22, 2011 at 16:20, Robert Haas robertmh...@gmail.com wrote: On Sun, Sep 18, 2011 at 5:39 AM, Kerem Kat kerem...@gmail.com wrote: I am new to postgresql code, I would like to start implementing easyish TODO items. I have read most of the development guidelines, faqs, articles by Greg Smith (Hacking Postgres with UDFs, Adding WHEN to triggers). The item I would like to implement is adding CORRESPONDING [BY (col1[,col2,...]])] to INTERSECT and EXCEPT operators. Can anyone comment on how much effort this item needs? This seems reasonably tricky for a first project, but maybe not out of reach if you are a skilled C hacker. It's certainly more complicated than my first patch: http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=a0b76dc662efde6e02921c2d16e06418483b7534 I guess the first question that needs to be answered here is ... what exactly is this syntax supposed to do? A little looking around suggests that EXCEPT CORRESPONDING is supposed to make the correspondence run by column names rather than by column positions, and if you further add BY col1, ... then it restricts the comparison to those columns. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Re: [HACKERS] Hot Backup with rsync fails at pg_clog if under load
2.2. pg_start_backup(Obackup_under_loadš) on the master (this will take a while as master is loaded up); No. if you use pg_start_backup('foo', true) it will be fast. Check the manual. If the server is sufficiently heavily loaded that a checkpoint takes a nontrivial amount of time, the OP is correct that this will be not fast, regardless of whether you choose to force an immediate checkpoint. In order to check more cases, I have changed the procedure to force an immediate checkpoint, i.e. pg_start_backup('backup_under_load', true). With the same load generator running, pg_start_backup returned almost instantaneously compared to how long it took previously. Most importantly, after doing this change, I cannot reproduce the pg_clog error message anymore. In other words, with immediate checkpoint hot backup succeeds under this load! 2.3. rsync data/global/pg_control to the standby; Why are you doing this? If ... 2.4. rsync all other data/ (without pg_xlog) to the standby; you will copy it again or no? Don't understand your point. His point is that exercising the bug depends on doing the copying in a certain order. Any order of copying the data theoretically ought to be OK, as long as it's all between starting the backup and stopping the backup, but apparently it isn't. Please note that in the past I was able to reproduce the same pg_clog error even with taking a singular rsync of the whole data/ folder (i.e. without splitting it into two steps). The problem could be that the minimum recovery point (step 2.3) is different from the end of rsync if you are under load. Do you have ideas why does the Hot Backup operation with pg_start_backup('backup_under_load', true) succeed while pg_start_backup('backup_under_load') fails under the same load? Originally, I was using pg_start_backup('backup_under_load') in order not to clog the master server during the I/O required for the checkpoint. Of course, now, it seems, this should be sacrificed for the sake of a successful backup under load. It seems pretty clear that some relevant chunk of WAL isn't getting replayed, but it's not at all clear to me why not. It seems like it would be useful to compare the LSN returned by pg_start_backup() with If needed, I could do that, if I had the exact procedure... Currently, during the start of the backup I take the following information: pg_xlogfile_name(pg_start_backup(...)) the location at which replay begins when you fire up the clone. As you have seen in my original message, in the pg_log I get only the restored WAL file names after starting up the standby. Can I tune the postgresql.conf to include the location at which replay begins in the log? Could you provide us with the exact rsync version and parameters you use? rsync -azv version 2.6.8 protocol version 29 -- Sincerely, Linas Virbalas http://flyingclusters.blogspot.com/ -- 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] [v9.2] make_greater_string() does not return a string in some cases
On Thu, Sep 22, 2011 at 2:51 PM, Tom Lane t...@sss.pgh.pa.us wrote: The essential problem here is when can you stop scanning, given a pattern with this prefix?, and btree doesn't know any more about that than make_greater_string does; it would in fact have to use make_greater_string or something isomorphic to it. Hm, as long as btree_pattern_ops is the only opclass that behaves this way that's more or less true. But Robert's right that if btree just stops when it finds something that doesn't match it doesn't need to hard code any knowledge of what the next value would be. If there were any other op classes that had this abstract property of always putting strings with common prefixes in a contiguous block then it would continue to work without having to know where to find the boundaries of that contiguous block. Just as an example, if you had a pattern_ops opclass that sorted the string assuming it was in some other encoding like, say, EBCDIC, then make_greater_string would have to learn about it but Robert's model would just work. This isn't enitirely facetious. Sorting by EBCDIC ordering would be silly but I vague recall there being some examples that wouldn't be silly. And perhaps some collations could actually be marked as being acceptable even if they don't sort in pure ascii ordering and make_greater_string doesn't actually know about them. -- 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] [v9.2] make_greater_string() does not return a string in some cases
Robert Haas robertmh...@gmail.com writes: On Thu, Sep 22, 2011 at 12:24 AM, Tom Lane t...@sss.pgh.pa.us wrote: Now, having said that, I'm starting to wonder again why it's worth our trouble to fool with encoding-specific incrementers. The exactness of the estimates seems unlikely to be improved very much by doing this. Well, so the problem is that the frequency with which the algorithm fails altogether seems to be disturbingly high for certain kinds of characters. I agree it might not be that important to get the absolutely best next string, but it does seem important not to fail outright. Kyotaro Horiguchi gives the example of UTF-8 characters ending with 0xbf. [ thinks for a bit ... ] Yeah, it's certainly true that such a character might be relatively small in the overall sort order. The assumption underlying what we're doing now is that dropping the last character and incrementing the next-to-last one instead isn't terribly catastrophic from an estimation accuracy standpoint. I can see that there are cases where that would fail to be true, but I'm not exactly convinced that they're worse than all the other cases where we'll get a poor estimate. Anyway, I won't stand in the way of the patch as long as it's modified to limit the number of values considered for any one character position to something reasonably small. regards, tom lane -- 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] [v9.2] make_greater_string() does not return a string in some cases
Greg Stark st...@mit.edu writes: On Thu, Sep 22, 2011 at 2:51 PM, Tom Lane t...@sss.pgh.pa.us wrote: The essential problem here is when can you stop scanning, given a pattern with this prefix?, and btree doesn't know any more about that than make_greater_string does; it would in fact have to use make_greater_string or something isomorphic to it. Hm, as long as btree_pattern_ops is the only opclass that behaves this way that's more or less true. But Robert's right that if btree just stops when it finds something that doesn't match it doesn't need to hard code any knowledge of what the next value would be. But you've added mechanism (and hence cycles) to btree searches, and *you haven't actually gained anything*. If the feature is restricted to only work for sort orderings in which common-prefix strings are contiguous, then it doesn't do anything we can't do just as well with the existing mechanism. Moreover, you'll still need make_greater_string because of the problem of trying to extract LIKE selectivity estimates from locale-dependent pg_statistic data. regards, tom lane -- 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] memory barriers (was: Yes, WaitLatch is vulnerable to weak-memory-ordering bugs)
On 14 September 2011 21:29, Robert Haas robertmh...@gmail.com wrote: On Mon, Aug 8, 2011 at 7:47 AM, Robert Haas robertmh...@gmail.com wrote: I've been thinking about this too and actually went so far as to do some research and put together something that I hope covers most of the interesting cases. The attached patch is pretty much entirely untested, but reflects my present belief about how things ought to work. And, here's an updated version, with some of the more obviously broken things fixed. As I've already pointed out, the comment Won't work on Visual Studio 2003 is not accurate: http://msdn.microsoft.com/en-us/library/f20w0x5e(v=vs.71).aspx Besides, if it's not supported, why bother mentioning it? -- Peter Geoghegan http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training and Services -- 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] Adding CORRESPONDING to Set Operations
While testing I noticed that ordering is incorrect in my implementation. At first I thought that removing mismatched entries from ltargetlist and rtargetlist would be enough, it didn't seem enough so I added rtargetlist sorting. SELECT 1 a, 2 b, 3 c UNION CORRESPONDING 4 b, 5 a, 6 c; returns incorrectly: a b c 1 2 3 4 5 6 Correct: a b c 1 2 3 5 4 6 In the analyze.c:transfromSetOperationStmt, I tried to sort rtargetlist before the forboth(ltl, ltargetlist, rtl,rtargetlist) to no avail. Sorted column names are in correct order in rtargetlist, but query is executed as if rtargetlist is never sorted. Where the targetlist gets the column ordering? Apparently not while targetlist is being lappend'ed (?). regards, Kerem KAT On Thu, Sep 22, 2011 at 17:03, Kerem Kat kerem...@gmail.com wrote: I delved into the code without waiting for comments from the list just to learn something about postgresql internals. And I have finished the CORRESPONDING, now CORRESPONDING BY is being tested. I will also write documentation and regression tests. Yes Robert, you are correct. Having used SQL 20nn standard draft as a guide, a brief explanation can be provided as such: Shorter version: column name lists are intersected. Short version: In the set operation queries, which are queries containing INTERSECT, EXCEPT or UNION, a CORRESPONDING clause can be used to project the resulting columns to only columns contained in both sides of the query. There is also and addition of BY(col1, col2, ...) to the clause which projects the columns to its own list. An example query would clarifiy. SELECT 1 a, 2 b UNION CORRESPONDING SELECT 3 a; a -- 1 3 SELECT 1 a, 2 b, 3 c UNION CORRESPONDING BY(a, c) SELECT 4 a, 5 c a c -- 1 3 4 5 On Thu, Sep 22, 2011 at 16:20, Robert Haas robertmh...@gmail.com wrote: On Sun, Sep 18, 2011 at 5:39 AM, Kerem Kat kerem...@gmail.com wrote: I am new to postgresql code, I would like to start implementing easyish TODO items. I have read most of the development guidelines, faqs, articles by Greg Smith (Hacking Postgres with UDFs, Adding WHEN to triggers). The item I would like to implement is adding CORRESPONDING [BY (col1[,col2,...]])] to INTERSECT and EXCEPT operators. Can anyone comment on how much effort this item needs? This seems reasonably tricky for a first project, but maybe not out of reach if you are a skilled C hacker. It's certainly more complicated than my first patch: http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=a0b76dc662efde6e02921c2d16e06418483b7534 I guess the first question that needs to be answered here is ... what exactly is this syntax supposed to do? A little looking around suggests that EXCEPT CORRESPONDING is supposed to make the correspondence run by column names rather than by column positions, and if you further add BY col1, ... then it restricts the comparison to those columns. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Re: [HACKERS] memory barriers (was: Yes, WaitLatch is vulnerable to weak-memory-ordering bugs)
On Thu, Sep 22, 2011 at 10:53 AM, Peter Geoghegan pe...@2ndquadrant.com wrote: As I've already pointed out, the comment Won't work on Visual Studio 2003 is not accurate: http://msdn.microsoft.com/en-us/library/f20w0x5e(v=vs.71).aspx Besides, if it's not supported, why bother mentioning it? I mentioned it because it took me a long time to figure out whether it was supported or not, and I finally came to the conclusion that it wasn't. I stand corrected, though; I've now removed that reference. Sorry for not jumping on it sooner; it was still vaguely on my list of things to fix at some point, but it hadn't percolated to the top yet. The attached version (hopefully) fixes various other things people have complained about as well, including: - Heikki's complaint about sometimes writing atomic instead of barrier (which was leftovers), and - Gurjeet's complaint that I hadn't defined the variable anywhere I've also added a lengthy README file to the patch that attempts to explain how barriers should be used in PostgreSQL coding. It's certainly not a comprehensive treatment of the topic, but hopefully it's enough to get people oriented. I've attempted to tailor it a bit to PostgreSQL conventions, like talking about shared memory vs. backend-private memory instead of assuming (as a number of other discussions of this topic do) a thread model. It also includes some advice about when memory barriers shouldn't be used or won't work, and some references for further reading. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company barrier-v3.patch Description: Binary data -- 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] memory barriers (was: Yes, WaitLatch is vulnerable to weak-memory-ordering bugs)
On 22 September 2011 16:18, Robert Haas robertmh...@gmail.com wrote: On Thu, Sep 22, 2011 at 10:53 AM, Peter Geoghegan pe...@2ndquadrant.com wrote: As I've already pointed out, the comment Won't work on Visual Studio 2003 is not accurate: http://msdn.microsoft.com/en-us/library/f20w0x5e(v=vs.71).aspx Besides, if it's not supported, why bother mentioning it? I mentioned it because it took me a long time to figure out whether it was supported or not, and I finally came to the conclusion that it wasn't. I stand corrected, though; I've now removed that reference. Sorry for not jumping on it sooner; it was still vaguely on my list of things to fix at some point, but it hadn't percolated to the top yet. The attached version (hopefully) fixes various other things people have complained about as well, including: - Heikki's complaint about sometimes writing atomic instead of barrier (which was leftovers), and - Gurjeet's complaint that I hadn't defined the variable anywhere I've also added a lengthy README file to the patch that attempts to explain how barriers should be used in PostgreSQL coding. It's certainly not a comprehensive treatment of the topic, but hopefully it's enough to get people oriented. I've attempted to tailor it a bit to PostgreSQL conventions, like talking about shared memory vs. backend-private memory instead of assuming (as a number of other discussions of this topic do) a thread model. It also includes some advice about when memory barriers shouldn't be used or won't work, and some references for further reading. s/visca-versa/vice-versa/ s/laods/loads/ -- Thom Brown Twitter: @darkixion IRC (freenode): dark_ixion Registered Linux user: #516935 EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- 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] [v9.2] make_greater_string() does not return a string in some cases
On Thu, Sep 22, 2011 at 10:36 AM, Tom Lane t...@sss.pgh.pa.us wrote: Anyway, I won't stand in the way of the patch as long as it's modified to limit the number of values considered for any one character position to something reasonably small. One thing I was thinking about is that it would be useful to have some metric for judging how well any given algorithm that we might pick here actually works. For example, if we were to try all possible three character strings in some encoding and run make_greater_string() on each one of them, we could then measure the failure percentage. Or if that's too many cases to crank through then we could limit it some way - but the point is, without some kind of test harness here, we have no way of measuring the trade-off between spending more CPU time and improving accuracy. Maybe you have a better feeling for what's reasonable there than I do, but I'm not prepared to take a stab in the dark without benefit of some real measurements. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- 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] memory barriers (was: Yes, WaitLatch is vulnerable to weak-memory-ordering bugs)
On Thu, Sep 22, 2011 at 11:25 AM, Thom Brown t...@linux.com wrote: s/visca-versa/vice-versa/ s/laods/loads/ Fixed. v4 attached. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company barrier-v4.patch Description: Binary data -- 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] unaccent contrib
Before 9.x, how do unaccent full text searches ? i 2011/9/21 Tom Lane t...@sss.pgh.pa.us Euler Taveira de Oliveira eu...@timbira.com writes: On 21-09-2011 13:28, Daniel Vázquez wrote: unaccent is compatible with postgresql 8.4 (but not is in their contrib version distribution) No, it is not. AFAICS it is necessary to add some backend code that is not in 8.4. [ pokes at it ] Yeah, you are right. The version of unaccent that is in our source tree is a filtering dictionary, and therefore cannot possibly work with backends older than 9.0 (when the filtering dictionary feature was added). So I'm wondering where the OP read that it was compatible with 8.4. Our own documentation about it certainly does not say that. It's possible that Oleg and Teodor had some prototype version, different from what got committed to our tree, that would work in 8.4. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers -- Daniel Vázquez SICONET (A Bull Group Company) Torre Agbar. Avda. Diagonal, 211 - planta 23 08018 - Barcelona telf: + 34 93 2272727 (Ext. 2952) fax: + 34 93 2272728 www.bull.es - www.siconet.es daniel.vazq...@bull.es
Re: [HACKERS] Online base backup from the hot-standby
On Thu, Sep 22, 2011 at 14:13, Fujii Masao masao.fu...@gmail.com wrote: On Wed, Sep 21, 2011 at 5:34 PM, Magnus Hagander mag...@hagander.net wrote: On Wed, Sep 21, 2011 at 08:23, Fujii Masao masao.fu...@gmail.com wrote: On Wed, Sep 21, 2011 at 2:13 PM, Magnus Hagander mag...@hagander.net wrote: Presumably pg_start_backup() will check this. And we'll somehow track this before pg_stop_backup() as well? (for such evil things such as the user changing FPW from on to off and then back to on again during a backup, will will make it look correct both during start and stop, but incorrect in the middle - pg_stop_backup needs to fail in that case as well) Right. As I suggested upthread, to address that problem, we need to log the change of FPW on the master, and then we need to check whether such a WAL is replayed on the standby during the backup. If it's done, pg_stop_backup() should emit an error. I somehow missed this thread completely, so I didn't catch your previous comments - oops, sorry. The important point being that we need to track if when this happens even if it has been reset to a valid value. So we can't just check the state of the variable at the beginning and at the end. Right. Let me explain again what I'm thinking. When FPW is changed, the master always writes the WAL record which contains the current value of FPW. This means that the standby can track all changes of FPW by reading WAL records. The standby has two flags: One indicates whether FPW has always been TRUE since last restartpoint. Another indicates whether FPW has always been TRUE since last pg_start_backup(). The standby can maintain those flags by reading WAL records streamed from the master. If the former flag indicates FALSE (i.e., the WAL records which the standby has replayed since last restartpoint might not contain required FPW), pg_start_backup() fails. If the latter flag indicates FALSE (i.e., the WAL records which the standby has replayed during the backup might not contain required FPW), pg_stop_backup() fails. If I'm not missing something, this approach can address the problem which you're concerned about. Yeah, it sounds safe to me. Would it make sense for pg_start_backup() to have the ability to wait for the next restartpoint in a case like this, if we know that FPW has been set? Instead of failing? Or maybe that's just overcomplicating things when trying to be user-friendly. -- Magnus Hagander Me: http://www.hagander.net/ Work: http://www.redpill-linpro.com/ -- 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] memory barriers (was: Yes, WaitLatch is vulnerable to weak-memory-ordering bugs)
Excerpts from Robert Haas's message of jue sep 22 12:18:47 -0300 2011: I've also added a lengthy README file to the patch that attempts to explain how barriers should be used in PostgreSQL coding. Very enlightening, thanks. Note a typo laods. -- Álvaro Herrera alvhe...@commandprompt.com The PostgreSQL Company - Command Prompt, Inc. PostgreSQL Replication, Consulting, Custom Development, 24x7 support -- 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] [v9.2] make_greater_string() does not return a string in some cases
Robert Haas robertmh...@gmail.com writes: One thing I was thinking about is that it would be useful to have some metric for judging how well any given algorithm that we might pick here actually works. Well, the metric that we were indirectly using earlier was the number of characters in a given locale for which the algorithm fails to find a greater one (excluding whichever character is last, I guess, or you could just recognize there's always at least one). For example, if we were to try all possible three character strings in some encoding and run make_greater_string() on each one of them, we could then measure the failure percentage. Or if that's too many cases to crank through then we could limit it some way - Even in UTF8 there's only a couple million assigned code points, so for test purposes anyway it doesn't seem like we couldn't crank through them all. Also, in many cases you could probably figure it out by analysis instead of brute-force testing every case. A more reasonable objection might be that a whole lot of those code points are things nobody cares about, and so we need to weight the results somehow by the actual popularity of the character. Not sure how to take that into account. Another issue here is that we need to consider not just whether we find a greater character, but how much greater it is. This would apply to my suggestion of incrementing the top byte without considering lower-order bytes --- we'd be skipping quite a lot of code space for each increment, and it's conceivable that that would be quite hurtful in some cases. Not sure how to account for that either. An extreme example here is an incrementer that just immediately returns the last character in the sort order for any lesser input. regards, tom lane -- 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] unaccent contrib
On 22-09-2011 12:39, Daniel Vázquez wrote: Before 9.x, how do unaccent full text searches ? Perform pre-processing (normalization) of the string *before* inserting and *before* searching. -- Euler Taveira de Oliveira - Timbira http://www.timbira.com.br/ PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento -- 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] unaccent contrib
2011/9/22 Daniel Vázquez daniel2d2...@gmail.com: Before 9.x, how do unaccent full text searches ? It seems that Oleg has published something on his web site that supposedly works with 8.4: http://www.sai.msu.su/~megera/wiki/unaccent But I'm not really sure how it works, or even where the source code is. I would suggest that you Google postgresql 8.4 unaccent or something like that and click through the results. Also, this mailing list is for discussions of PostgreSQL development, so I think this discussion is quite a bit off-topic. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- 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] Hot Backup with rsync fails at pg_clog if under load
On 22-09-2011 11:24, Linas Virbalas wrote: In order to check more cases, I have changed the procedure to force an immediate checkpoint, i.e. pg_start_backup('backup_under_load', true). With the same load generator running, pg_start_backup returned almost instantaneously compared to how long it took previously. Most importantly, after doing this change, I cannot reproduce the pg_clog error message anymore. In other words, with immediate checkpoint hot backup succeeds under this load! Interesting. I remembered someone reporting this same problem but it was not reproducible by some of us. Do you have ideas why does the Hot Backup operation with pg_start_backup('backup_under_load', true) succeed while pg_start_backup('backup_under_load') fails under the same load? I don't but if you show us the output of the steps above... If needed, I could do that, if I had the exact procedure... Currently, during the start of the backup I take the following information: Just show us the output of pg_start_backup and part of the standby log with the following message 'redo starts at' and the subsequent messages up to the failure. -- Euler Taveira de Oliveira - Timbira http://www.timbira.com.br/ PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento -- 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] [v9.2] make_greater_string() does not return a string in some cases
On Thu, Sep 22, 2011 at 11:46 AM, Tom Lane t...@sss.pgh.pa.us wrote: Well, the metric that we were indirectly using earlier was the number of characters in a given locale for which the algorithm fails to find a greater one (excluding whichever character is last, I guess, or you could just recognize there's always at least one). What about characters that sort differently in sequence than individually? For example, if we were to try all possible three character strings in some encoding and run make_greater_string() on each one of them, we could then measure the failure percentage. Or if that's too many cases to crank through then we could limit it some way - Even in UTF8 there's only a couple million assigned code points, so for test purposes anyway it doesn't seem like we couldn't crank through them all. Also, in many cases you could probably figure it out by analysis instead of brute-force testing every case. A more reasonable objection might be that a whole lot of those code points are things nobody cares about, and so we need to weight the results somehow by the actual popularity of the character. Not sure how to take that into account. I guess whether that's a problem in practice will depend somewhat on the quality of the algorithms we're able to find. If our best algorithms still have a 1% failure rate, then yeah, that's an issue, but in that case I'd suggest that our best algorithms suck and we need to think harder about alternate solutions. If we're talking about failing on 5 characters out of a million we can just eyeball them. I'm not trying to reduce this testing to something that is entirely mechanic in every way; I'm just saying that I'm not optimistic about my ability to judge which algorithms will work best in practice without some kind of automated aid. Another issue here is that we need to consider not just whether we find a greater character, but how much greater it is. This would apply to my suggestion of incrementing the top byte without considering lower-order bytes --- we'd be skipping quite a lot of code space for each increment, and it's conceivable that that would be quite hurtful in some cases. Not sure how to account for that either. An extreme example here is an incrementer that just immediately returns the last character in the sort order for any lesser input. Right... well, this is why I'm not wild about doing this by incrementing in the first place. But now that I think about it, what about using some slightly-less-stupid version of that approach as a fallback strategy? For example, we could pick, oh, say, 20 characters out of the space of code points, about evenly distributed under whatever collations we think are likely to be in use. In the incrementer, we try some kind of increment-the-bytes strategy for a while and if it doesn't pan out, we zip through the array and try substituting each of the fallback characters. If more than one works, we test the survivors against each other until we're left with just one winner. The bound might not be real tight, but as long as it's good enough to make the planner pick an index scan it might not matter very much. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- 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] [v9.2] make_greater_string() does not return a string in some cases
Robert Haas robertmh...@gmail.com writes: On Thu, Sep 22, 2011 at 11:46 AM, Tom Lane t...@sss.pgh.pa.us wrote: Well, the metric that we were indirectly using earlier was the number of characters in a given locale for which the algorithm fails to find a greater one (excluding whichever character is last, I guess, or you could just recognize there's always at least one). What about characters that sort differently in sequence than individually? Yeah, there's a whole 'nother set of issues there, but the character incrementer is unlikely to affect that very much either way, I think. But now that I think about it, what about using some slightly-less-stupid version of that approach as a fallback strategy? For example, we could pick, oh, say, 20 characters out of the space of code points, about evenly distributed under whatever collations we think are likely to be in use. Sure, if the increment the top byte strategy proves to not accomplish that effectively. But I'd prefer not to design a complex strategy until it's been proven that a simpler one doesn't work. regards, tom lane -- 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] new createuser option for replication role
On Thu, Sep 22, 2011 at 10:55 PM, Cédric Villemain cedric.villemain.deb...@gmail.com wrote: Before doing the complete review, I hit a regression with 9.1 createrole. Thanks! the command ''createuser -e -s foo produce : CREATE ROLE foo SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN NOREPLICATION; before it was: CREATE ROLE foo SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN; The REPLICATION was allowed by default to superuser, and the current patch change the default to remove the right. I believe we should add only the REPLICATION when --replication is set, and NOREPLICATION when --no-replication is set. Agreed. Attached is the updated version of the patch. It adds two options --replication and --no-replication. If neither specified, neither REPLICATION nor NOREPLICATION is specified in CREATE ROLE, i.e., in this case, replication privilege is granted to only superuser. Regards, -- Fujii Masao NIPPON TELEGRAPH AND TELEPHONE CORPORATION NTT Open Source Software Center createuser_replication_option_v3.patch Description: Binary data -- 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] EXPLAIN and nfiltered, take two
On Thu, Sep 22, 2011 at 02:41:12AM -0400, Tom Lane wrote: Yeah, I thought seriously about that too. The problem with it is that you end up having to print that line all the time, whether or not it adds any knowledge. The filter removed N rows approach has the saving grace that you can leave it out when no filtering is happening. Another point is that if you have two filters operating at a node, printing only the starting number of rows doesn't let you disentangle which filter did how much. I wonder if it would be more useful to print a percentage. If 0% is filtered out you can still drop it but it gives a more useful output if the number of rows is really large. Have a nice day, -- Martijn van Oosterhout klep...@svana.org http://svana.org/kleptog/ He who writes carelessly confesses thereby at the very outset that he does not attach much importance to his own thoughts. -- Arthur Schopenhauer signature.asc Description: Digital signature
Re: [HACKERS] citext operator precedence fix
1. citext_eq(citext,citext) 2. citext_eq(text,citext) 3. citext_eq(citext,text) Then the question is: does it find only #2 via polymorphic lookup, or does it think that either #1 or #2 could work (because text supports an implicit cast to citext, IIRC). If it's more than one it's an error. Not sure if the same issue exists for operators. Well, I just ran through the 7 potential combinations, and didn't get any errors. Hard to tell which function is being used, of course. -- Josh Berkus PostgreSQL Experts Inc. http://pgexperts.com -- 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] citext operator precedence fix
On Sep 22, 2011, at 9:53 AM, Josh Berkus wrote: Then the question is: does it find only #2 via polymorphic lookup, or does it think that either #1 or #2 could work (because text supports an implicit cast to citext, IIRC). If it's more than one it's an error. Not sure if the same issue exists for operators. Well, I just ran through the 7 potential combinations, and didn't get any errors. Hard to tell which function is being used, of course. That's what tests are for. David -- 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] citext operator precedence fix
Well, I just ran through the 7 potential combinations, and didn't get any errors. Hard to tell which function is being used, of course. That's what tests are for. So, tell me how to write a test to check which function is being used. -- Josh Berkus PostgreSQL Experts Inc. http://pgexperts.com -- 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] citext operator precedence fix
On Sep 22, 2011, at 10:11 AM, Josh Berkus wrote: That's what tests are for. So, tell me how to write a test to check which function is being used. Just write some comparisons like upthread, and see if the output is f or t. Put them into sql/citext.sql. Best, David -- 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] Hot Backup with rsync fails at pg_clog if under load
2011/9/22 Euler Taveira de Oliveira eu...@timbira.com: On 22-09-2011 11:24, Linas Virbalas wrote: In order to check more cases, I have changed the procedure to force an immediate checkpoint, i.e. pg_start_backup('backup_under_load', true). With the same load generator running, pg_start_backup returned almost instantaneously compared to how long it took previously. Most importantly, after doing this change, I cannot reproduce the pg_clog error message anymore. In other words, with immediate checkpoint hot backup succeeds under this load! Interesting. I remembered someone reporting this same problem but it was not reproducible by some of us. So maybe there's some action that has to happen between the time the redo pointer is set and the time the checkpoint is WAL-logged to tickle the bug. Like... CLOG extension, maybe? *grep grep grep* OK, so ExtendCLOG() just zeroes the page in memory, writes the WAL record, and calls it good. All the interesting stuff is done while holding CLogControlLock. So, at checkpoint time, we'd better make sure to flush those pages out to disk before writing the checkpoint record. Otherwise, the redo pointer might advance past the CLOG-extension record before the corresponding page hits the disk. That's the job of CheckPointCLOG(), which is called from CheckPointGuts(), which is called just from CreateCheckPoint() just after setting the redo pointer. Now, there is some funny business with the locking here as we're writing the dirty pages (CheckPointCLOG() calls SimpleLruFlush()). We release and reacquire the control lock many times. But I don't see how that can cause a problem, because it's all being done after the redo pointer has already been said. We could end up having buffers get dirtied again after they are flushed, but that shouldn't matter either as long as each buffer is written out at least once. And if the write fails we throw an error. So I don't see any holes there. Anybody else have an idea? -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- 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] memory barriers (was: Yes, WaitLatch is vulnerable to weak-memory-ordering bugs)
Robert Haas robertmh...@gmail.com wrote: I've also added a lengthy README file to the patch that attempts to explain how barriers should be used in PostgreSQL coding. It's certainly not a comprehensive treatment of the topic, but hopefully it's enough to get people oriented. I've attempted to tailor it a bit to PostgreSQL conventions, like talking about shared memory vs.backend-private memory instead of assuming (as a number of other discussions of this topic do) a thread model. It also includes some advice about when memory barriers shouldn't be used or won't work, and some references for further reading. Thanks, that seems like it's at the right level of detail to me. -Kevin -- 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] citext operator precedence fix
On 9/22/11 10:26 AM, David E. Wheeler wrote: On Sep 22, 2011, at 10:11 AM, Josh Berkus wrote: That's what tests are for. So, tell me how to write a test to check which function is being used. Just write some comparisons like upthread, and see if the output is f or t. Put them into sql/citext.sql. Oh, ok. I thought you meant checking the actual function call. Tests go in the main SQL file? Shouldn't they have their own file? -- Josh Berkus PostgreSQL Experts Inc. http://pgexperts.com -- 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] citext operator precedence fix
On Sep 22, 2011, at 10:50 AM, Josh Berkus wrote: Just write some comparisons like upthread, and see if the output is f or t. Put them into sql/citext.sql. Oh, ok. I thought you meant checking the actual function call. Tests go in the main SQL file? Shouldn't they have their own file? That is the test file. The main SQL file is citext--1.0.sql. You'll actually need to bump the version number to 1.1, rename that file to citext--1.1.sql, and also add them to a citext--1.0--1.1.sql. There probably also needs to be a citext--unpackaged--1.1.sql file. Best, David -- 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] citext operator precedence fix
Excerpts from David E. Wheeler's message of jue sep 22 14:51:59 -0300 2011: On Sep 22, 2011, at 10:50 AM, Josh Berkus wrote: Just write some comparisons like upthread, and see if the output is f or t. Put them into sql/citext.sql. Oh, ok. I thought you meant checking the actual function call. Tests go in the main SQL file? Shouldn't they have their own file? That is the test file. The main SQL file is citext--1.0.sql. You'll actually need to bump the version number to 1.1, rename that file to citext--1.1.sql, and also add them to a citext--1.0--1.1.sql. There probably also needs to be a citext--unpackaged--1.1.sql file. Hmm, if there's a citext--unpackaged--1.0.sql and also citext--1.0--1.1.sql, is it really necessary to have citext--unpackaged--1.1.sql? Shouldn't the upgrade facility be able to just run both scripts? -- Álvaro Herrera alvhe...@commandprompt.com The PostgreSQL Company - Command Prompt, Inc. PostgreSQL Replication, Consulting, Custom Development, 24x7 support -- 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] citext operator precedence fix
On Sep 22, 2011, at 11:07 AM, Alvaro Herrera wrote: That is the test file. The main SQL file is citext--1.0.sql. You'll actually need to bump the version number to 1.1, rename that file to citext--1.1.sql, and also add them to a citext--1.0--1.1.sql. There probably also needs to be a citext--unpackaged--1.1.sql file. Hmm, if there's a citext--unpackaged--1.0.sql and also citext--1.0--1.1.sql, is it really necessary to have citext--unpackaged--1.1.sql? Shouldn't the upgrade facility be able to just run both scripts? No, because if 1.1 was installed on 8.4, you'd need the commands to move all its functions into the extension, not re-create them. However, since this ships with core, it's probably not necessary, because theoretically no one will use it in 8.4, so the functions will never be unpackaged. Best, David -- 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] citext operator precedence fix
David E. Wheeler da...@kineticode.com wrote: On Sep 22, 2011, at 11:07 AM, Alvaro Herrera wrote: Hmm, if there's a citext--unpackaged--1.0.sql and also citext--1.0--1.1.sql, is it really necessary to have citext--unpackaged--1.1.sql? Shouldn't the upgrade facility be able to just run both scripts? No, because if 1.1 was installed on 8.4, you'd need the commands to move all its functions into the extension, not re-create them. Shouldn't a version installed on 8.4 be installed as unpackaged? Doesn't citext--unpackaged--1.0.sql contain the commands to move all its functions into the extension? -Kevin -- 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] citext operator precedence fix
On Sep 22, 2011, at 11:14 AM, Kevin Grittner wrote: No, because if 1.1 was installed on 8.4, you'd need the commands to move all its functions into the extension, not re-create them. Shouldn't a version installed on 8.4 be installed as unpackaged? Doesn't citext--unpackaged--1.0.sql contain the commands to move all its functions into the extension? It contains everything need to move 1.0 functions into the extension. If Josh adds new functions they obviously would not be moved. So a new script would need to move them. And unpackaged--1.1 does not first run unpackaged--1.0. Best, David -- 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] citext operator precedence fix
On Thu, Sep 22, 2011 at 2:16 PM, David E. Wheeler da...@kineticode.com wrote: On Sep 22, 2011, at 11:14 AM, Kevin Grittner wrote: No, because if 1.1 was installed on 8.4, you'd need the commands to move all its functions into the extension, not re-create them. Shouldn't a version installed on 8.4 be installed as unpackaged? Doesn't citext--unpackaged--1.0.sql contain the commands to move all its functions into the extension? It contains everything need to move 1.0 functions into the extension. If Josh adds new functions they obviously would not be moved. So a new script would need to move them. And unpackaged--1.1 does not first run unpackaged--1.0. I believe the point David is trying to make is that someone might take an 9.2 version of a contrib module and manually install it on an 8.4 server by executing the install script, perhaps with some amount of hackery. But I don't think we're required to support that case. If the user does a non-standard install, it's their job to deal with the fallout. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- 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] citext operator precedence fix
On Sep 22, 2011, at 11:23 AM, Robert Haas wrote: I believe the point David is trying to make is that someone might take an 9.2 version of a contrib module and manually install it on an 8.4 server by executing the install script, perhaps with some amount of hackery. Right. But I don't think we're required to support that case. If the user does a non-standard install, it's their job to deal with the fallout. Agreed; I was thinking of how one would handle this for non-core distributed extensions. Probably not necessary for contrib. David -- 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] citext operator precedence fix
But I don't think we're required to support that case. If the user does a non-standard install, it's their job to deal with the fallout. Well, I'll write the script anyway, since *I* need it. I'm installing this on a 9.0 database which will be later upgraded to 9.1. However, before I write all this, I'd like to settle the question of acceptability. What do I need to do to make it OK to break backwards compatibility for this? I feel strongly that I'm correcting it to the behavior users expect, but that's not statistically backed. I don't want to spend several hours writing scripts so that it can be rejected *for that reason*. -- Josh Berkus PostgreSQL Experts Inc. http://pgexperts.com -- 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] citext operator precedence fix
On Thu, Sep 22, 2011 at 2:36 PM, Josh Berkus j...@agliodbs.com wrote: But I don't think we're required to support that case. If the user does a non-standard install, it's their job to deal with the fallout. Well, I'll write the script anyway, since *I* need it. I'm installing this on a 9.0 database which will be later upgraded to 9.1. However, before I write all this, I'd like to settle the question of acceptability. What do I need to do to make it OK to break backwards compatibility for this? I feel strongly that I'm correcting it to the behavior users expect, but that's not statistically backed. I don't want to spend several hours writing scripts so that it can be rejected *for that reason*. I'm OK with the proposed behavior change and I agree that it's probably what people want, but I am awfully suspicious that those extra casts are going to break something you haven't thought about. It might be worth posting a rough version first just to see if I (or someone else) can break it before you spend a lot of time on it. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- 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] Double sorting split patch
On Thu, Sep 22, 2011 at 3:31 PM, Alexander Korotkov aekorot...@gmail.comwrote: On Thu, Sep 22, 2011 at 3:22 PM, Heikki Linnakangas heikki.linnakan...@enterprisedb.com wrote: 'lower' and 'upper' are not used for anything in the above. Is that just dead code that can be removed, or is there something missing that should be using them? Yes, it's just dead code. Patch without that dead code is attached. -- With best regards, Alexander Korotkov. double-sorting-split-0.3.patch.gz Description: GNU Zip compressed data -- 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] patch: plpgsql - remove unnecessary ccache search when a array variable is updated
note: some basic test shows about 15% speedup Regards Pavel Stehule -- 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] memory barriers (was: Yes, WaitLatch is vulnerable to weak-memory-ordering bugs)
On Thu, 2011-09-22 at 11:31 -0400, Robert Haas wrote: On Thu, Sep 22, 2011 at 11:25 AM, Thom Brown t...@linux.com wrote: s/visca-versa/vice-versa/ s/laods/loads/ Fixed. v4 attached. Can you please explain the more subtly part below? +A common pattern where this actually does result in a bug is when adding items +onto a queue. The writer does this: + +q-items[q-num_items] = new_item; +++q-num_items; + +The reader does this: + +num_items = q-num_items; +for (i = 0; i num_items; ++i) +/* do something with q-items[i] */ + +This code turns out to be unsafe, because the writer might increment +q-num_items before it finishes storing the new item into the appropriate slot. +More subtly, the reader might prefetch the contents of the q-items array +before reading q-num_items. How would the reader prefetch the contents of the items array, without knowing how big it is? Regards, Jeff Davis -- 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] memory barriers (was: Yes, WaitLatch is vulnerable to weak-memory-ordering bugs)
On Thu, Sep 22, 2011 at 5:45 PM, Jeff Davis pg...@j-davis.com wrote: +This code turns out to be unsafe, because the writer might increment +q-num_items before it finishes storing the new item into the appropriate slot. +More subtly, the reader might prefetch the contents of the q-items array +before reading q-num_items. How would the reader prefetch the contents of the items array, without knowing how big it is? By guessing or (I think) just by having a stale value left over in some CPU cache. It's pretty mind-bending, but it's for real. I didn't, in either the implementation or the documentation, go much into the difference between dependency barriers and general read barriers. We might need to do that at some point, but for a first version I don't think it's necessary. But since you asked... as I understand it, unless you're running on Alpha, you actually don't need a barrier here at all, because all currently-used CPUs other than alpha respect data dependencies, which means that if q-num_items is used to compute an address to be read from memory, the CPU will ensure that the read of that address is performed after the read of the value used to compute the address. At least that's my understanding. But Alpha won't. So we could try to further distinguish between read barriers where a data dependency is present and read barriers where no data dependency is present, and the latter type could be a no-op on all CPUs other than Alpha. Or we could even jettison support for Alpha altogether if we think it's hopelessly obsolete and omit read-barriers-with-dependency altogether. I think that would be a bad idea, though. First, it's not impossible that some future CPU could have behavior similar to Alpha, and the likelihood of such a thing is substantially more because of the fact that the Linux kernel, which seems to be the gold standard in this area, still supports them. If we don't record places where a dependency barrier would be needed and then need to go find them later, that will be a lot more work, and a lot more error-prone. Second, there's a natural pairing between read barriers and write barriers. Generally, for every algorithm, each write barrier on the write side should be matched by a read barrier on the read side. So putting them all in will make it easier to verify code correctness. Now, if we find down the line that some of those read barriers are hurting our performance on, say, Itanium, or PowerPC, then we can certainly consider distinguishing further. But for round one I'm voting for not worrying about it. I think it's going to be a lot more important to put our energy into (1) adding barrier implementations for any platforms that aren't included in this initial patch that we want to support, (2) making sure that all of our implementations actually work, and (3) making sure that the algorithms that use them are correct. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- 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] patch: plpgsql - remove unnecessary ccache search when a array variable is updated
On Thu, Sep 22, 2011 at 5:10 PM, Pavel Stehule pavel.steh...@gmail.com wrote: note: some basic test shows about 15% speedup Eh that's good, but I think you need to fix the fact that it crashes... -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- 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] memory barriers (was: Yes, WaitLatch is vulnerable to weak-memory-ordering bugs)
On Thu, 2011-09-22 at 19:12 -0400, Robert Haas wrote: But since you asked... as I understand it, unless you're running on Alpha, you actually don't need a barrier here at all, because all currently-used CPUs other than alpha respect data dependencies, which means that if q-num_items is used to compute an address to be read from memory, the CPU will ensure that the read of that address is performed after the read of the value used to compute the address. At least that's my understanding. But Alpha won't. I'm still trying to figure out how it's even possible to read an address that's not computed yet. Something sounds strange about that... I think it might have more to do with branch prediction or something else. In your example, the address is not computed from q-num_items directly, it's computed using i. But that branch being followed is dependent on a comparison with q-num_items. Maybe that's the dependency that's not respected? Regards, Jeff Davis -- 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] memory barriers (was: Yes, WaitLatch is vulnerable to weak-memory-ordering bugs)
On Thu, Sep 22, 2011 at 7:46 PM, Jeff Davis pg...@j-davis.com wrote: On Thu, 2011-09-22 at 19:12 -0400, Robert Haas wrote: But since you asked... as I understand it, unless you're running on Alpha, you actually don't need a barrier here at all, because all currently-used CPUs other than alpha respect data dependencies, which means that if q-num_items is used to compute an address to be read from memory, the CPU will ensure that the read of that address is performed after the read of the value used to compute the address. At least that's my understanding. But Alpha won't. I'm still trying to figure out how it's even possible to read an address that's not computed yet. Something sounds strange about that... That's because it's strange. You might have a look at http://www.linuxjournal.com/article/8212 Basically, it seems like on Alpha, the CPU is allowed to do pretty much anything short of entirely fabricating the value that gets returned. I think it might have more to do with branch prediction or something else. In your example, the address is not computed from q-num_items directly, it's computed using i. But that branch being followed is dependent on a comparison with q-num_items. Maybe that's the dependency that's not respected? You might be right. I can't swear I understand exactly what goes wrong there; in fact I'm not 100% sure that you don't need a read-barrier on things less crazy than Alpha. I speculate that the problem is something this: q-num_items is in some cache line and all the elements of q-items is in some other cache line, and you see that you're about to use both of those so you suck the cache lines into memory. But because one cache bank is busier than the other, you get q-items first. And between the time you get the cache line containing q-items and the time you get the cache line containing q-num_items, someone insert an item into the queue, and now you're hosed, because you have the old array contents with the new array length. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- 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] patch: plpgsql - remove unnecessary ccache search when a array variable is updated
Hello 2011/9/23 Robert Haas robertmh...@gmail.com: On Thu, Sep 22, 2011 at 5:10 PM, Pavel Stehule pavel.steh...@gmail.com wrote: note: some basic test shows about 15% speedup Eh that's good, but I think you need to fix the fact that it crashes... I fixed crash that described Tom. Do you know about other? Regards Pavel -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- 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] Adding CORRESPONDING to Set Operations
Kerem Kat kerem...@gmail.com writes: While testing I noticed that ordering is incorrect in my implementation. At first I thought that removing mismatched entries from ltargetlist and rtargetlist would be enough, it didn't seem enough so I added rtargetlist sorting. I don't think you can get away with changing the targetlists of the UNION subqueries; you could break their semantics. Consider for instance select distinct a, b, c from t1 union corresponding select b, c from t2; If you discard the A column from t1's output list then it will deliver a different set of rows than it should, because the DISTINCT is considering the wrong set of values. One possible way to fix that is to introduce a level of sub-select, as if the query had been written select b, c from (select distinct a, b, c from t1) ss1 union select b, c from (select b, c from t2) ss2; However, the real problem with either type of hackery is that these machinations will be visible in the parsed query, which means for example that a view defined as create view v1 as select distinct a, b, c from t1 union corresponding select b, c from t2; would come out looking like the transformed version rather than the original when it's dumped, or even just examined with tools such as psql's \d+. I think this is bad style. It's certainly ugly to expose your implementation shortcuts to the user like that, and it also can cause problems down the road: if in the future we think of some better way to implement CORRESPONDING, we've lost the chance to do so for any stored views that got transformed this way. (There are several places in Postgres now that take such shortcuts, and all of them were mistakes that we need to clean up someday, IMO.) So I think that as far as the parser is concerned, you just want to store the CORRESPONDING clause more or less as-is, and not do too much more than verify that it's valid. The place to actually implement it is in the planner (see prepunion.c). Possibly the add-a-level-of-subselect approach will work, but you want to do that querytree transformation at plan time not parse time. regards, tom lane -- 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] [BUGS] BUG #5206: wal_sync_method in stock postgresql.conf may be wrong
... moving to hackers ... On Mon, Nov 23, 2009 at 7:25 PM, Tom Lane t...@sss.pgh.pa.us wrote: Robert Haas robertmh...@gmail.com writes: On Fri, Nov 20, 2009 at 6:56 PM, Alvaro Herrera alvhe...@postgresql.org wrote: I have two suggestions to fix this: 1. avoid displaying any value at all as if it were the true default (this would perhaps make the line invalid were the user to uncomment it) 2. change initdb so that it modifies that line too (along with shared_buffers etc) to put the actual default value in there, but without uncommenting it. I also have one non-suggestion: 3. do nothing I like #3 or #1 better than #2. Putting logic into initdb to edit the comments in the file doesn't really seem like a worthwhile use of time. I agree, it seems like more work than the problem is worth. We could change the entry to something like #wal_sync_method = (platform-dependent) # the default is ... and we have another one now: effective_io_concurrency, in postgresql.conf it seems that it defaults to 1 but in windows and solaris it actually defaults to 0 (I still think we should get rid of the commented-out settings altogether, but that's another argument...) That's another reason not to expend work here --- it still seems fairly likely that that might happen. time has passed and we still have this... maybe is time to make initdb lead with this? or at least follow Tom's suggestion above? -- Jaime Casanova www.2ndQuadrant.com Professional PostgreSQL: Soporte 24x7 y capacitación -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers