Re: [HACKERS] Patch: Show process IDs of processes holding a lock; show relation and tuple infos of a lock to acquire
Hi, On 27/01/14 11:44, Rajeev rastogi wrote: I have checked the revised patch. It looks fine to me except one minor code formatting issue. In elog.c, two tabs are missing in the definition of function errdetail_log_plural. Please run pgindent tool to check the same. I did, but this reformats various other locations in the file, too. Nevertheless I now ran pg_indent against it and removed the other parts. Attached you will find the corrected patch version. Also I would like to highlight one behavior here is that process ID of process trying to acquire lock is also listed in the list of Request queue. E.g. session 1 with process id X: BEGIN; LOCK TABLE foo IN SHARE MODE; session 2 with process id Y: BEGIN; LOCK TABLE foo IN EXCLUSIVE MODE; On execution of LOCK in session-2, as part of log it will display as: DETAIL: Process holding the lock: X. Request queue: Y. Where Y is the process ID of same process, which was trying to acquire lock. This is on purpose due to the rewording of the Message. In the first version the PID of the backend was missing. Thanks for the review! Best regards, -- Christian Kruse http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training Services diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c index ee6c24c..6c648cf 100644 --- a/src/backend/storage/lmgr/proc.c +++ b/src/backend/storage/lmgr/proc.c @@ -1195,13 +1195,23 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable) */ if (log_lock_waits deadlock_state != DS_NOT_YET_CHECKED) { - StringInfoData buf; + StringInfoData buf, + lock_waiters_sbuf, + lock_holders_sbuf; const char *modename; long secs; int usecs; long msecs; + SHM_QUEUE *procLocks; + PROCLOCK *proclock; + bool first_holder = true, + first_waiter = true; + int lockHoldersNum = 0; initStringInfo(buf); + initStringInfo(lock_waiters_sbuf); + initStringInfo(lock_holders_sbuf); + DescribeLockTag(buf, locallock-tag.lock); modename = GetLockmodeName(locallock-tag.lock.locktag_lockmethodid, lockmode); @@ -1211,10 +1221,67 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable) msecs = secs * 1000 + usecs / 1000; usecs = usecs % 1000; + /* + * we loop over the lock's procLocks to gather a list of all + * holders and waiters. Thus we will be able to provide more + * detailed information for lock debugging purposes. + * + * lock-procLocks contains all processes which hold or wait for + * this lock. + */ + + LWLockAcquire(partitionLock, LW_SHARED); + + procLocks = (lock-procLocks); + proclock = (PROCLOCK *) SHMQueueNext(procLocks, procLocks, + offsetof(PROCLOCK, lockLink)); + + while (proclock) + { +/* + * we are a waiter if myProc-waitProcLock == proclock; we are + * a holder if it is NULL or something different + */ +if (proclock-tag.myProc-waitProcLock == proclock) +{ + if (first_waiter) + { + appendStringInfo(lock_waiters_sbuf, %d, + proclock-tag.myProc-pid); + first_waiter = false; + } + else + appendStringInfo(lock_waiters_sbuf, , %d, + proclock-tag.myProc-pid); +} +else +{ + if (first_holder) + { + appendStringInfo(lock_holders_sbuf, %d, + proclock-tag.myProc-pid); + first_holder = false; + } + else + appendStringInfo(lock_holders_sbuf, , %d, + proclock-tag.myProc-pid); + + lockHoldersNum++; +} + +proclock = (PROCLOCK *) SHMQueueNext(procLocks, proclock-lockLink, + offsetof(PROCLOCK, lockLink)); + } + + LWLockRelease(partitionLock); + if (deadlock_state == DS_SOFT_DEADLOCK) ereport(LOG, (errmsg(process %d avoided deadlock for %s on %s by rearranging queue order after %ld.%03d ms, - MyProcPid, modename, buf.data, msecs, usecs))); +MyProcPid, modename, buf.data, msecs, usecs), + (errdetail_log_plural(Process holding the lock: %s. Request queue: %s., + Processes holding the lock: %s. Request queue: %s., + lockHoldersNum, lock_holders_sbuf.data, lock_waiters_sbuf.data; else if (deadlock_state == DS_HARD_DEADLOCK) { /* @@ -1226,13 +1293,19 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable) */ ereport(LOG, (errmsg(process %d detected deadlock while waiting for %s on %s after %ld.%03d ms, - MyProcPid, modename, buf.data, msecs, usecs))); +MyProcPid, modename, buf.data, msecs, usecs), + (errdetail_log_plural(Process holding the lock: %s. Request queue: %s., + Processes holding lock: %s. Request queue: %s., + lockHoldersNum, lock_holders_sbuf.data, lock_waiters_sbuf.data; } if (myWaitStatus == STATUS_WAITING) ereport(LOG, (errmsg(process %d still waiting for %s on %s after
Re: [HACKERS] Infinite recursion in row-security based on updatable s.b. views
On 01/24/2014 07:16 PM, Dean Rasheed wrote: think recursively calling the rewriter to expand view references in the new RLS qual, and expand_security_qual() to expand any additional RLS quals in the securityQuals list With this, it'd be helpful if expand_security_qual(...) took a RangeTblEntry instead of an rt_index. That'd also be much more efficient with large rtables if we can arrange a scan through the rtable when looking for security quals. Like other places that operate on the rangetable while it's being modified, we can walk the rangetable list up until the final entry that existed when we started walking. This approach saves the series of rt_fetch calls, which are something like O(n log n) for n relations. It's safe because the operation will only append rangetable entries. (I can't help wonder how much we'd gain by making the rtable an array that gets doubled in size and copied whenever it overflows, rather than a linked list, given all the walking of it that gets done, and how dead entries to get flagged as dead rather than actually removed.) I'm looking for where I found the code that already does this so I can point and say I'm not crazy, we already do it here. Will follow up with a patch. -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training 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] Storing pg_stat_statements query texts externally, pg_stat_statements in core
I noticed a minor omission in the patch as committed. Attached patch corrects this. -- Peter Geoghegan *** a/contrib/pg_stat_statements/pg_stat_statements.c --- b/contrib/pg_stat_statements/pg_stat_statements.c *** generate_normalized_query(pgssJumbleStat *** 2726,2732 if (tok_len 0) continue; /* ignore any duplicates */ ! /* Copy next chunk, or as much as will fit */ len_to_wrt = off - last_off; len_to_wrt -= last_tok_len; --- 2726,2732 if (tok_len 0) continue; /* ignore any duplicates */ ! /* Copy next chunk */ len_to_wrt = off - last_off; len_to_wrt -= last_tok_len; -- 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] pg_basebackup and pg_stat_tmp directory
On Tue, Jan 28, 2014 at 6:11 AM, Amit Kapila amit.kapil...@gmail.comwrote: On Tue, Jan 28, 2014 at 9:26 AM, Fujii Masao masao.fu...@gmail.com wrote: Hi, The files in pg_stat_tmp directory don't need to be backed up because they are basically reset at the archive recovery. So I think it's worth changing pg_basebackup so that it skips any files in pg_stat_tmp directory. Thought? I think this is good idea, but can't it also avoid PGSTAT_STAT_PERMANENT_TMPFILE along with temp files in pg_stat_tmp All stats files should be excluded. IIRC the PGSTAT_STAT_PERMANENT_TMPFILE refers to just the global one. You want to exclude based on PGSTAT_STAT_PERMANENT_DIRECTORY (and of course based on the guc stats_temp_directory if it's in PGDATA. -- Magnus Hagander Me: http://www.hagander.net/ Work: http://www.redpill-linpro.com/
[HACKERS] Observed Compilation warning in WIN32 build
I observed below WIN32 compilation warnings in postmaster.c (seems introduced by commit ea9df812d8502fff74e7bc37d61bdc7d66d77a7f Relax the requirement that all lwlocks be stored in a single array.). 1.\src\backend\postmaster\postmaster.c(5625) : warning C4133: '=' : incompatible types - from 'LWLockPadded *' to 'LWLock *' 1.\src\backend\postmaster\postmaster.c(5856) : warning C4133: '=' : incompatible types - from 'LWLock *' to 'LWLockPadded *' Attached is the patch with the fix. Thanks and Regards, Kumar Rajeev Rastogi compile_issue_lwlock.patch Description: compile_issue_lwlock.patch -- 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: Show process IDs of processes holding a lock; show relation and tuple infos of a lock to acquire
On 28/01/14, Christian Kruse wrote: I have checked the revised patch. It looks fine to me except one minor code formatting issue. In elog.c, two tabs are missing in the definition of function errdetail_log_plural. Please run pgindent tool to check the same. I did, but this reformats various other locations in the file, too. Nevertheless I now ran pg_indent against it and removed the other parts. Attached you will find the corrected patch version. Also I would like to highlight one behavior here is that process ID of process trying to acquire lock is also listed in the list of Request queue. E.g. session 1 with process id X: BEGIN; LOCK TABLE foo IN SHARE MODE; session 2 with process id Y: BEGIN; LOCK TABLE foo IN EXCLUSIVE MODE; On execution of LOCK in session-2, as part of log it will display as: DETAIL: Process holding the lock: X. Request queue: Y. Where Y is the process ID of same process, which was trying to acquire lock. This is on purpose due to the rewording of the Message. In the first version the PID of the backend was missing. Thanks for the review! Now patch looks fine to me. I am marking this as Ready for Committer. Thanks and Regards, Kumar Rajeev Rastogi -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
[HACKERS] Function definition removed but prototype still there
As part of the below commit 36a35c550ac114caa423bcbe339d3515db0cd957 (Compress GIN posting lists, for smaller index size.) Function GinDataPageAddItemPointer definition was removed but corresponding prototype was still there. Attached is the patch to fix the same. Thanks and Regards, Kumar Rajeev Rastogi unwanted_prototype.patch Description: unwanted_prototype.patch -- 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] UNION ALL on partitioned tables won't use indices.
Hello, Thank you, and I' sorry to have kept you waiting. Let's focus on type 3; Tom and I both found it most promising. Agreed. The attached two patches are rebased to current 9.4dev HEAD and make check at the topmost directory and src/test/isolation are passed without error. One bug was found and fixed on the way. It was an assertion failure caused by probably unexpected type conversion introduced by collapse_appendrels() which leads implicit whole-row cast from some valid reltype to invalid reltype (0) into adjust_appendrel_attrs_mutator(). What query demonstrated this bug in the previous type 2/3 patches? - unionall_inh_idx_typ3_v4_20140114.patch You have not addressed my review comments from November: http://www.postgresql.org/message-id/20131123073913.ga1008...@tornado.leadboat.com mmm. Sorry, I've overlooked most of it.. em_is_child is no more a issue, and the rest seem to cited below, thanks. Specifically, these: [transvar_merge_mutator()] has roughly the same purpose as adjust_appendrel_attrs_mutator(), but it propagates the change to far fewer node types. Why this case so much simpler? The parent translated_vars of parent_appinfo may bear mostly-arbitrary expressions. There are only two places where AppendRelInfo node is generated, expand_inherited_rtentry and pull_up_union_leaf_queries.(_copyAppendrelInfo is irrelevant to this discussion.) The core part generating translated_vars for them are make_inh_translation_list and make_setop_translation_list respectively. That's all. And they are essentially works on the same way, making a Var for every referred target entry of children like following. | makeVar(varno, | tle-resno, | exprType((Node *) tle-expr), | exprTypmod((Node *) tle-expr), | exprCollation((Node *) tle-expr), | 0); So all we should do to collapse nested appendrels is simplly connecting each RTEs directly to the root (most ancient?) RTE in the relationship, resolving Vars like above, as seen in patched expand_inherited_rtentry. # If translated_vars are generated always in the way shown above, # using tree walker might be no use.. This can be done apart from all other stuffs compensating translation skew done in adjust_appendrel_attrs. I believe they are in orthogonal relationship. Approaches (2) and (3) leave the inheritance parent with rte-inh == true despite no AppendRelInfo pointing to it as their parent. Until now, expand_inherited_rtentry() has been careful to clear rte-inh in such cases. Thank you. I missed that point. rte-inh at first works as a trigger to try expand inheritance and create append_rel_list entries, and later works to say dig me through appinfos. From that point of view, inh of the RTEs whose children took away should be 0. The two meanings of inh are now become different from each other so I suppose it'd better rename it, but I don't come up with good alternatives.. Anyway this is corrected in the patch attached and works as follows, BEFORE: rte[1] Subquery SELECT*1, inh = 1 +- appinfo[0] - rte[4] Relation p1, inh = 1 | +- appinfo[2] - rte[6] Relation p1, inh = 0 | +- appinfo[3] - rte[7] Relation c11, inh = 0 | +- appinfo[4] - rte[8] Relation c12, inh = 0 +- appinfo[1] - rte[5] Relation p2, inh = 1 +- appinfo[5] - rte[9] Relation p1, inh = 0 +- appinfo[6] - rte[10] Relation c11, inh = 0 +- appinfo[7] - rte[11] Relation c12, inh = 0 COLLAPSED: rte[1] Subquery SELECT*1, inh = 1 +- appinfo[0] - rte[4] Relation p1, inh = 1 = 0 +- appinfo[2] - rte[6] Relation p1, inh = 0 +- appinfo[3] - rte[7] Relation c11, inh = 0 +- appinfo[4] - rte[8] Relation c12, inh = 0 +- appinfo[1] - rte[5] Relation p2, inh = 1 = 0 +- appinfo[5] - rte[9] Relation p1, inh = 0 +- appinfo[6] - rte[10] Relation c11, inh = 0 +- appinfo[7] - rte[11] Relation c12, inh = 0 I get this warning: prepunion.c: In function `expand_inherited_rtentry': prepunion.c:1450: warning: passing argument 1 of `expression_tree_mutator' from incompatible pointer type Sorry, I forgot to put a casting to generic type. It is fixed in the attached version. regards, -- Kyotaro Horiguchi NTT Open Source Software Center diff --git a/src/backend/optimizer/prep/prepunion.c b/src/backend/optimizer/prep/prepunion.c index 52dcc72..6ef82d7 100644 --- a/src/backend/optimizer/prep/prepunion.c +++ b/src/backend/optimizer/prep/prepunion.c @@ -57,6 +57,11 @@ typedef struct AppendRelInfo *appinfo; } adjust_appendrel_attrs_context; +typedef struct { + AppendRelInfo *child_appinfo; + Index target_rti; +} transvars_merge_context; + static Plan *recurse_set_operations(Node *setOp, PlannerInfo *root, double tuple_fraction, List *colTypes, List *colCollations, @@ -98,6 +103,8 @@ static List *generate_append_tlist(List *colTypes, List
Re: [HACKERS] WIP patch (v2) for updatable security barrier views
On 28 January 2014 04:10, Kouhei Kaigai kai...@ak.jp.nec.com wrote: AFAICS the only area of objection is the handling of inherited relations, which occurs within the planner in the current patch. I can see that would be a cause for concern since the planner is pluggable and it would then be possible to bypass security checks. Obviously installing a new planner isn't trivial, but doing so shouldn't cause collateral damage. FWIW, I don't see any way _not_ to do that in RLS. If there are security quals on a child table, they must be added, and that can only happen once inheritance expansion happens. That's in the planner. I don't see it as acceptable to ignore security quals on child tables, and if we can't, we've got to do some work in the planner. (I'm starting to really loathe inheritance). Let me ask an elemental question. What is the reason why inheritance expansion logic should be located on the planner stage, not on the tail of rewriter? Reference to a relation with children is very similar to reference of multiple tables using UNION ALL. Isn't it a crappy idea to move the logic into rewriter stage (if we have no technical reason here)? I agree that this is being seen the wrong way around. The planner contains things it should not do, and as a result we are now discussing enhancing the code that is in the wrong place, which of course brings objections. I think we would be best served by stopping inheritance in its tracks and killing it off. It keeps getting in the way. What we need is real partitioning. Other uses are pretty obscure and we should re-examine things. In the absence of that, releasing this updateable-security views without suppport for inheritance is a good move. It gives us most of what we want now and continuing to have some form of restriction is better than having a much greater restriction of it not working at all. -- Simon Riggs http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training 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] Add min and max execute statement time in pg_stat_statement
(2014/01/28 15:17), Rajeev rastogi wrote: On 27th January, Mitsumasa KONDO wrote: 2014-01-26 Simon Riggs si...@2ndquadrant.com mailto:si...@2ndquadrant.com On 21 January 2014 19:48, Simon Riggs si...@2ndquadrant.com mailto:si...@2ndquadrant.com wrote: On 21 January 2014 12:54, KONDO Mitsumasa kondo.mitsum...@lab.ntt.co.jp mailto:kondo.mitsum...@lab.ntt.co.jp wrote: Rebased patch is attached. Does this fix the Windows bug reported by Kumar on 20/11/2013 ? Sorry, I was misunderstanding. First name of Mr. Rajeev Rastogi is Kumar! I searched only e-mail address and title by his name... I don't have windows compiler enviroment, but attached patch might be fixed. Could I ask Mr. Rajeev Rastogi to test my patch again? I tried to test this but I could not apply the patch on latest git HEAD. This may be because of recent patch (related to pg_stat_statement only pg_stat_statements external query text storage ), which got committed on 27th January. Thank you for trying to test my patch. As you say, recently commit changes pg_stat_statements.c a lot. So I have to revise my patch. Please wait for a while. By the way, latest pg_stat_statement might affect performance in Windows system. Because it uses fflush() system call every creating new entry in pg_stat_statements, and it calls many fread() to warm file cache. It works well in Linux system, but I'm not sure in Windows system. If you have time, could you test it on your Windows system? If it affects perfomance a lot, we can still change it. Regards, -- Mitsumasa KONDO 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] Infinite recursion in row-security based on updatable s.b. views
On 01/28/2014 04:39 PM, Craig Ringer wrote: I'm looking for where I found the code that already does this so I can point and say I'm not crazy, we already do it here. Will follow up with a patch. I spoke to soon. The code I'm talking about is expand_inherited_tables(...) and it still uses rt_fetch, it just avoids foreach(...) in favour of stopping scanning at the end of the original rtable. So I get to be crazy after all. I really don't like how many places we're rt_fetch'ing the same RTE from in updatable s.b. views and its interaction with row-security, but that can be a later problem. For now I'll stick with RTIs. -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training 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] A better way than tweaking NTUP_PER_BUCKET
On 27/01/14 18:00, Simon Riggs wrote: On 27 January 2014 17:44, Pavel Stehule pavel.steh...@gmail.com wrote: This topic is interesting - we found very bad performance with hashing large tables with high work_mem. MergeJoin with quicksort was significantly faster. I've seen this also. I didn't deeper research - there is a possibility of virtualization overhead. I took measurements and the effect was repeatable and happened for all sizes of work_mem, but nothing more to add. FWIW my current list-based internal merge seems to perform worse at larger work-mem, compared to quicksort. I've been starting to wonder if the rate of new ram-chip page opens is an issue (along with the more-usually considered cache effects). Any random-access workload would be affected by this, if it really exists. -- Cheers, Jeremy -- 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] PoC: Partial sort
On Tue, Jan 28, 2014 at 7:51 AM, Alexander Korotkov aekorot...@gmail.com wrote: I didn't test it, but I worry that overhead might be high. If it's true then it could be like constraint_exclusion option which id off by default because of planning overhead. I see, that makes sense. I will try to find the time to run some benchmarks in the coming few days. Regards, Marti -- 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] alternative back-end block formats
Le lundi 27 janvier 2014 13:42:29 Christian Convey a écrit : On Sun, Jan 26, 2014 at 5:47 AM, Craig Ringer cr...@2ndquadrant.com wrote: On 01/21/2014 07:43 PM, Christian Convey wrote: Does anyone know if this has been done before with Postgres? I would have assumed yes, but I'm not finding anything in Google about people having done this. AFAIK (and I don't know much in this area) the storage manager isn't very pluggable compared to the rest of Pg. Thanks for the warning. Duly noted. As written in the meeting notes, Tom Lane revealed an interest in pluggable storage. So it might be interesting to check that. https://wiki.postgresql.org/wiki/PgCon_2013_Developer_Meeting -- Cédric Villemain +33 (0)6 20 30 22 52 http://2ndQuadrant.fr/ PostgreSQL: Support 24x7 - Développement, Expertise et Formation signature.asc Description: This is a digitally signed message part.
Re: [HACKERS] Review: Patch FORCE_NULL option for copy COPY in CSV mode
2013-11-01 Payal Singh pa...@omniti.com: The post was made before I subscribed to the mailing list, so posting my review separately. The link to the original patch mail is http://www.postgresql.org/message-id/CAB8KJ=jS-Um4TGwenS5wLUfJK6K4rNOm_V6GRUj+tcKekL2=g...@mail.gmail.com Hi, This patch implements the following TODO item: Allow COPY in CSV mode to control whether a quoted zero-length string is treated as NULL Currently this is always treated as a zero-length string, which generates an error when loading into an integer column Re: [PATCHES] allow CSV quote in NULL http://archives.postgresql.org/pgsql-hackers/2007-07/msg00905.php http://wiki.postgresql.org/wiki/Todo#COPY I had a very definite use-case for this functionality recently while importing CSV files generated by Oracle, and was somewhat frustrated by the existence of a FORCE_NOT_NULL option for specific columns, but not one for FORCE_NULL. I'll add this to the November commitfest. Regards Ian Barwick == Contents Purpose == This patch introduces a new 'FORCE_NULL' option which has the opposite functionality of the already present 'FORCE_NOT_NULL' option for the COPY command. Prior to this option there was no way to convert a zeroed-length quoted value to a NULL value when COPY FROM is used to import data from CSV formatted files. == Submission Review == The patch is in the correct context diff format. It includes changes to the documentation as well as additional regression tests. The description has been discussed and defined in the previous mails leading to this patch. = Functionality Review = CORRECTION NEEDED - Due to a minor error in code (details in 'Code Review' section below), force_null option is not limited to COPY FROM, and works even when COPY TO is used. This should instead give an error message. The updated documentation describes the added functionality clearly. All regression tests passed successfully. Code compilation after including patch was successful. No warnings either. Manually tested COPY FROM with FORCE_NULL for a number of scenarios, all with expected outputs. No issues. Been testing the patch for a few days, no crashes or weird behavior observed. = Code Formatting Review (Needs Improvement) = Looks good, the tabs between variable declaration and accompanying comment can be improved. = Code Review (Needs Improvement) = 1. There is a NOTE: force_not_null option are not applied to the returned fields. before COPY FROM block. Similar note should be added for force_null option too. 2. One of the conditions to check and give an error if force_null is true and copy from is false is wrong, cstate-force_null should be checked instead of cstate-force_notnull: /* Check force_notnull */ if (!cstate-csv_mode cstate-force_notnull != NIL) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg(COPY force not null available only in CSV mode))); if (cstate-force_notnull != NIL !is_from) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg(COPY force not null only available using COPY FROM))); /* Check force_null */ if (!cstate-csv_mode cstate-force_null != NIL) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg(COPY force null available only in CSV mode))); == if (cstate-force_notnull != NIL !is_from) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg(COPY force null only available using COPY FROM))); === Suggested Changes Conclusion === The Above mentioned error condition should be corrected. Minor comments and tab changes are upto the author. In all, suggested modifications aside, the patch works well and in my opinion, would be a useful addition to the COPY command. Hi Payal Many thanks for the review, and my apologies for not getting back to you earlier. Updated version of the patch attached with suggested corrections. I'm not sure about the tabs in the variable declarations - the whole section seems to be all over the place (regardless of whether tabs are set to 4 or 8 spaces) and could do with tidying up, however I didn't want to expand the scope of the patch too much. Quick recap of the reasons behind this patch - we had a bunch of CSV files (and by bunch I mean
Re: [HACKERS] Retain dynamic shared memory segments for postmaster lifetime
Hello, Currently there is no way user can keep the dsm segments if he wants for postmaster lifetime, so I have exposed a new API dsm_keep_segment() to implement the same. I had a short look on this patch. - DSM implimentation seems divided into generic part (dsm.c) and platform dependent part(dsm_impl.c). This dsm_keep_segment puts WIN32 specific part directly into dms.c. I suppose it'd be better defining DSM_OP_KEEP_SEGMENT and calling dms_impl_op from dms_keep_segment, or something. - Repeated calling of dsm_keep_segment even from different backends creates new (orphan) handles as many as it is called. Simplly invoking this function in some of extensions intending to stick segments might results in so many orphan handles. Something to curb that situation would be needed. - Global/PostgreSQL.%u is the same literal constant with that occurred in dsm_impl_windows. It should be defined as a constant (or a macro). - dms_impl_windows uses errcode_for_dynamic_shared_memory() for ereport and it finally falls down to errcode_for_file_access(). I think it is preferable, maybe. The specs and need for this API is already discussed in thread: http://www.postgresql.org/message-id/ca+tgmoakogujqbedgeykysxud9eaidqx77j2_hxzrgfo3hr...@mail.gmail.com I had used dsm_demo (hacked it a bit) module used during initial tests for dsm API's to verify the working on Windows. So one idea could be that I can extend that module to use this new API, so that it can be tested by others as well or if you have any other better way, please do let me know. I'll run on windows sooner:-) As the discussion about its specs and need is already discussed in above mentioned thread, so I will upload this patch to CF unless there is any Objection. 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] Observed Compilation warning in WIN32 build
On 2014-01-28 09:13:15 +, Rajeev rastogi wrote: I observed below WIN32 compilation warnings in postmaster.c (seems introduced by commit ea9df812d8502fff74e7bc37d61bdc7d66d77a7f Relax the requirement that all lwlocks be stored in a single array.). 1.\src\backend\postmaster\postmaster.c(5625) : warning C4133: '=' : incompatible types - from 'LWLockPadded *' to 'LWLock *' 1.\src\backend\postmaster\postmaster.c(5856) : warning C4133: '=' : incompatible types - from 'LWLock *' to 'LWLockPadded *' Attached is the patch with the fix. Thanks and Regards, Kumar Rajeev Rastogi *** a/src/backend/postmaster/postmaster.c --- b/src/backend/postmaster/postmaster.c *** *** 5622,5628 save_backend_variables(BackendParameters *param, Port *port, #ifndef HAVE_SPINLOCKS param-SpinlockSemaArray = SpinlockSemaArray; #endif ! param-MainLWLockArray = MainLWLockArray; param-ProcStructLock = ProcStructLock; param-ProcGlobal = ProcGlobal; param-AuxiliaryProcs = AuxiliaryProcs; --- 5622,5628 #ifndef HAVE_SPINLOCKS param-SpinlockSemaArray = SpinlockSemaArray; #endif ! param-MainLWLockArray = (LWLock*)MainLWLockArray; param-ProcStructLock = ProcStructLock; param-ProcGlobal = ProcGlobal; param-AuxiliaryProcs = AuxiliaryProcs; *** *** 5853,5859 restore_backend_variables(BackendParameters *param, Port *port) #ifndef HAVE_SPINLOCKS SpinlockSemaArray = param-SpinlockSemaArray; #endif ! MainLWLockArray = param-MainLWLockArray; ProcStructLock = param-ProcStructLock; ProcGlobal = param-ProcGlobal; AuxiliaryProcs = param-AuxiliaryProcs; --- 5853,5859 #ifndef HAVE_SPINLOCKS SpinlockSemaArray = param-SpinlockSemaArray; #endif ! MainLWLockArray = (LWLockPadded*)param-MainLWLockArray; ProcStructLock = param-ProcStructLock; ProcGlobal = param-ProcGlobal; AuxiliaryProcs = param-AuxiliaryProcs; This strikes me as the wrong fix, the types in BackendParams should be changed instead. Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training 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] [PATCH] Use MAP_HUGETLB where supported (v3)
On 01/27/2014 09:20 PM, Alvaro Herrera wrote: Heikki Linnakangas wrote: I spent some time whacking this around, new patch version attached. I moved the mmap() code into a new function, that leaves the PGSharedMemoryCreate more readable. Did this patch go anywhere? Oh darn, I remembered we had already committed this, but clearly not. I'd love to still get this into 9.4. The latest patch (hugepages-v5.patch) was pretty much ready for commit, except for documentation. - Heikki -- 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] Use MAP_HUGETLB where supported (v3)
Hi, On 28/01/14 13:51, Heikki Linnakangas wrote: Oh darn, I remembered we had already committed this, but clearly not. I'd love to still get this into 9.4. The latest patch (hugepages-v5.patch) was pretty much ready for commit, except for documentation. I'm working on it. I ported it to HEAD and currently doing some benchmarks. Next will be documentation. Best regards, -- Christian Kruse http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training Services pgpHMKmOD_jGn.pgp Description: PGP signature
Re: [HACKERS] alternative back-end block formats
On Tue, Jan 28, 2014 at 5:42 AM, Cédric Villemain ced...@2ndquadrant.comwrote: ... As written in the meeting notes, Tom Lane revealed an interest in pluggable storage. So it might be interesting to check that. https://wiki.postgresql.org/wiki/PgCon_2013_Developer_Meeting Thanks. I just read those meeting notes, and also Josh Berkus' blog on the topic: http://www.databasesoup.com/2013/05/postgresql-new-development-priorities-2.html I was only thinking to enable pluggable operations on a single, specified heap page, probably as a function of which table owned the page. Josh's blog seems to describe something a little broader in scope, although I can't tell from that post exactly what functionality that entails. Either way, this sounds like something I'd enjoy pitching in on, to whatever extent I could be useful. Has anyone started work on this yet?
Re: [HACKERS] [Review] inherit support for foreign tables
(2014/01/27 21:49), Shigeru Hanada wrote: 2014-01-27 Etsuro Fujita fujita.ets...@lab.ntt.co.jp: (2014/01/25 11:27), Shigeru Hanada wrote: Yeah, the consistency is essential for its ease of use. But I'm not sure that inherited stats ignoring foreign tables is actually useful for query optimization. What I think about the consistency is a) the ANALYZE command with no table names skips ANALYZEing inheritance trees that include at least one foreign table as a child, but b) the ANALYZE command with a table name indicating an inheritance tree that includes any foreign tables does compute the inherited stats in the same way as an inheritance tree consiting of only ordinary tables by acquiring the sample rows from each foreign table on the far side. b) sounds little complex to understand or explain. Is it too big change that making ANALYZE command to handle foreign tables too even if no table name was specified? IIRC, performance issue was the reason to exclude foreign tables from auto-analyze processing. ANALYZEing large database contains local huge data also takes long time. One idea to avoid unexpected long processing is to add option to foreign tables to mark it as not-auto-analyzable. Maybe I didn't express my idea clearly. Sorry for that. I don't think that we now allow the ANALYZE command to handle foreign tables when no table name is specified with the command. I think that we allow the ANALYZE command to handle an inheritance tree that includes foreign tables when the name of the parent table is specified, without ignoring such foreign tables in the caluculation. ISTM it would be possible to do so if we introduce a new parameter, say, vac_mode, which indicates wether vacuum() is called with a specific table or not. I'll try to modify the ANALYZE command to do so on top of you patch. Thanks, Best regards, Etsuro Fujita -- 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] Use MAP_HUGETLB where supported (v3)
Hi, On 15/11/13 15:17, Heikki Linnakangas wrote: I spent some time whacking this around, new patch version attached. I moved the mmap() code into a new function, that leaves the PGSharedMemoryCreate more readable. I think there's a bug in this version of the patch. Have a look at this: + if (huge_tlb_pages == HUGE_TLB_ON || huge_tlb_pages == HUGE_TLB_TRY) + { […] + ptr = mmap(NULL, *size, PROT_READ | PROT_WRITE, + PG_MMAP_FLAGS | MAP_HUGETLB, -1, 0); […] + } +#endif + + if (huge_tlb_pages == HUGE_TLB_OFF || huge_tlb_pages == HUGE_TLB_TRY) + { + allocsize = *size; + ptr = mmap(NULL, *size, PROT_READ | PROT_WRITE, PG_MMAP_FLAGS, -1, 0); + } This will lead to a duplicate mmap() if hugepages work and huge_tlb_pages == HUGE_TLB_TRY, or am I missing something? I think it should be like this: if (huge_tlb_pages == HUGE_TLB_OFF || (huge_tlb_pages == HUGE_TLB_TRY ptr == MAP_FAILED)) Best regards, -- Christian Kruse http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training Services pgpG9E74KaJDV.pgp Description: PGP signature
Re: [HACKERS] KNN-GiST with recheck
On 01/13/2014 07:17 PM, Alexander Korotkov wrote: Here goes a desription of this patch same as in original thread. KNN-GiST provides ability to get ordered results from index, but this order is based only on index information. For instance, GiST index contains bounding rectangles for polygons, and we can't get exact distance to polygon from index (similar situation is in PostGIS). In attached patch, GiST distance method can set recheck flag (similar to consistent method). This flag means that distance method returned lower bound of distance and we should recheck it from heap. See an example. create table test as (select id, polygon(3+(random()*10)::int, circle(point(random(), random()), 0.0003 + random()*0.001)) as p from generate_series(1,100) id); create index test_idx on test using gist (p); We can get results ordered by distance from polygon to point. postgres=# select id, p - point(0.5,0.5) from test order by p - point(0.5,0.5) limit 10; id | ?column? +-- 755611 | 0.000405855808916853 807562 | 0.000464123777564343 437778 | 0.000738524708741959 947860 | 0.00076250998760724 389843 | 0.000886362723569568 17586 | 0.000981960100555216 411329 | 0.00145338112316853 894191 | 0.00149399559703506 391907 | 0.0016647896049741 235381 | 0.00167554614889509 (10 rows) It's fast using just index scan. QUERY PLAN -- Limit (cost=0.29..1.86 rows=10 width=36) (actual time=0.180..0.230 rows=10 loops=1) - Index Scan using test_idx on test (cost=0.29..157672.29 rows=100 width=36) (actual time=0.179..0.228 rows=10 loops=1) Order By: (p - '(0.5,0.5)'::point) Total runtime: 0.305 ms (4 rows) Nice! Some thoughts: 1. This patch introduces a new polygon - point operator. That seems useful on its own, with or without this patch. 2. I wonder how useful it really is to allow mixing exact and non-exact return values from the distance function. The distance function included in the patch always returns recheck=true. I have a feeling that all other distance function will also always return either true or false. 3. A binary heap would be a better data structure to buffer the rechecked values. A Red-Black tree allows random insertions and deletions, but in this case you need to insert arbitrary values but only remove the minimum item. That's exactly what a binary heap excels at. We have a nice binary heap implementation in the backend that you can use, see src/backend/lib/binaryheap.c. 4. (as you mentioned in the other thread: ) It's a modularity violation that you peek into the heap tuple from gist. I think the proper way to do this would be to extend the IndexScan executor node to perform the re-shuffling of tuples that come from the index in wrong order, or perhaps add a new node type for it. Of course that's exactly what your partial sort patch does :-). I haven't looked at that in detail, but I don't think the approach the partial sort patch takes will work here as is. In the KNN-GiST case, the index is returning tuples roughly in the right order, but a tuple that it returns might in reality belong somewhere later in the ordering. In the partial sort patch, the input stream of tuples is divided into non-overlapping groups, so that the tuples within the group are not sorted, but the groups are. I think the partial sort case is a special case of the KNN-GiST case, if you consider the lower bound of each tuple to be the leading keys that you don't need to sort. BTW, this capability might also be highly useful for the min/max indexes as well. A min/max index cannot return an exact ordering of tuples, but it can also give a lower bound for a group of tuples. - Heikki -- 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] Add force option to dropdb
Hello Sawada, - This patch is not patched to master branch Sorry, My mistake //new connections are not allowed Corrected. I hope now the patch in better state, if somthing left, I will be glad to fix it Regards On Tuesday, January 28, 2014 4:17 AM, Sawada Masahiko sawada.m...@gmail.com wrote: On 2014年1月17日 0:56, salah jubeh s_ju...@yahoo.com wrote: If the user owns objects, that will prevent this from working also. I have the feeling that adding DROP OWNED BY and/or REASSIGNED OWNED BY calls to this utility would be a bit excessive, but who knows. Please find attached the first attempt to drop drop the client connections. I have added an option -k, --kill instead of force since killing client connection does not guarantee -drop force-. Regards On Tuesday, January 14, 2014 8:06 PM, Alvaro Herrera alvhe...@2ndquadrant.com wrote: salah jubeh wrote: For the sake of completeness: 1. I think also, I need also to temporary disallow conecting to the database, is that right? 2. Is there other factors can hinder dropping database? If the user owns objects, that will prevent this from working also. I have the feeling that adding DROP OWNED BY and/or REASSIGNED OWNED BY calls to this utility would be a bit excessive, but who knows. 3. Should I write two patches one for pg_version=9.2 and one for pg_version9.2 No point -- nothing gets applied to branches older than current development anyway. Thank you for the patch. And sorry for delay in reviewing. I started to look this patch, So the following is first review comment. - This patch is not patched to master branch I tried to patch this patch file to master branch, but I got following error. $ cd postgresql $ patch -d. -p1 ../dropdb.patch can't find fiel to patch at input line 3 Perhaps you used the wrong -p or --strip option? the text leading up to this was: -- |--- dropdb_org.c 2014-01-16 |+++ dropdb.c 2014-01-16 -- There is not dropdb_org.c. I think that you made mistake when the patch is created. - This patch is not according the coding rule For example, line 71 of the patch: //new connections are not allowed It should be: /* new connections are not allowed */ (Comment blocks that need specific line breaks should be formatted as block comments, where the comment starts as /*--.) Please refer to coding rule. http://wiki.postgresql.org/wiki/Developer_FAQ#What.27s_the_formatting_style_used_in_PostgreSQL_source_code.3F Regards, --- Sawada Masahikodiff --git a/src/bin/scripts/dropdb.c b/src/bin/scripts/dropdb.c index fa6ea3e..755abf4 100644 --- a/src/bin/scripts/dropdb.c +++ b/src/bin/scripts/dropdb.c @@ -32,6 +32,7 @@ main(int argc, char *argv[]) {echo, no_argument, NULL, 'e'}, {interactive, no_argument, NULL, 'i'}, {if-exists, no_argument, if_exists, 1}, + {kill, no_argument, NULL, 'k'}, {maintenance-db, required_argument, NULL, 2}, {NULL, 0, NULL, 0} }; @@ -48,6 +49,8 @@ main(int argc, char *argv[]) enum trivalue prompt_password = TRI_DEFAULT; bool echo = false; bool interactive = false; + bool kill = false; + char *database_conn_limit = -1; PQExpBufferData sql; @@ -59,7 +62,7 @@ main(int argc, char *argv[]) handle_help_version_opts(argc, argv, dropdb, help); - while ((c = getopt_long(argc, argv, h:p:U:wWei, long_options, optindex)) != -1) + while ((c = getopt_long(argc, argv, h:p:U:wWeik, long_options, optindex)) != -1) { switch (c) { @@ -84,6 +87,9 @@ main(int argc, char *argv[]) case 'i': interactive = true; break; + case 'k': +kill = true; +break; case 0: /* this covers the long options */ break; @@ -121,8 +127,6 @@ main(int argc, char *argv[]) initPQExpBuffer(sql); - appendPQExpBuffer(sql, DROP DATABASE %s%s;\n, - (if_exists ? IF EXISTS : ), fmtId(dbname)); /* Avoid trying to drop postgres db while we are connected to it. */ if (maintenance_db == NULL strcmp(dbname, postgres) == 0) @@ -131,11 +135,64 @@ main(int argc, char *argv[]) conn = connectMaintenanceDatabase(maintenance_db, host, port, username, prompt_password, progname); + /* Disallow database connections and terminate client connections */ + if (kill) + { + appendPQExpBuffer(sql, SELECT datconnlimit FROM pg_database WHERE datname= '%s';,fmtId(dbname)); + result = executeQuery(conn, sql.data, progname, echo); + /* Get the datconnĺimit to do a cleanup in case of dropdb fail */ + if (PQntuples(result) == 1) + { + database_conn_limit = PQgetvalue(result, 0, 0); + } else + { + fprintf(stderr, _(%s: database removal failed: %s\n), + progname, dbname); + PQclear(result); + PQfinish(conn); + exit(1); + } + PQclear(result); + resetPQExpBuffer(sql); + /* New connections are not allowed */ + appendPQExpBuffer(sql, UPDATE pg_database SET datconnlimit = 0 WHERE datname= '%s';\n,fmtId(dbname)); + if (echo) + printf(%s, sql.data); + result = PQexec(conn,
Re: [HACKERS] Planning time in explain/explain analyze
On Thu, Jan 9, 2014 at 11:45 PM, Tom Lane t...@sss.pgh.pa.us wrote: Greg Stark st...@mit.edu writes: On Thu, Jan 9, 2014 at 9:14 PM, Tom Lane t...@sss.pgh.pa.us wrote: In short then, I think we should just add this to EXPLAIN and be done. -1 for sticking the info into PlannedStmt or anything like that. I'm confused. I thought I was arguing to support your suggestion that the initial planning store the time in the cached plan and explain should output the time the original planning took. Uh, no, wasn't my suggestion. Doesn't that design imply measuring *every* planning cycle, explain or no? I was thinking more of just putting the timing calls into explain.c. The problem is that you really can't do it that way. ExplainOneQuery() is a good place to add the timing calls in general, but ExplainExecuteQuery() in prepare.c never calls it; it does GetCachedPlan(), which ultimately calls pg_plan_query() after about four levels of indirection, and then passes the resulting plan directly to ExplainOnePlan(). So if you only add timing calls to explain.c, you can't handle anything that goes through ExplainExecuteQuery(), which is confusingly in prepare.c rather than explain.c. One reasonably principled solution is to just give up on showing the plan time for prepared queries altogether. If we don't want to adopt that approach, then I think the right way to do this is to add a bool timing argument to pg_plan_query(). When set, pg_plan_query() measures the time before and after calling planner() and stores it in the PlannedStmt. It could alternatively return it via an out parameter, but that's not very convenient for prepare.c, which is planning a *list* of queries and therefore presumably needs planning time for each one. I'm not bent on this design; I just don't see another way to do this that has any conceptual integrity. Having the normal path measure the time required to call pg_plan_query() and the prepared path measure the time required to call GetCachedPlan() which may or may not eventually call pg_plan_query() one or more times doesn't seem like a good design, particularly if it's motivated solely by a desire to minimize the code footprint of what's never going to be a very large patch. The most recent version of the patch tries to finesse this issue by determining whether GetCachedPlan() actually did anything; I think the way it does that is likely an abstraction violation that we don't want to countenance. But even if we're OK with that, it still munges the planning times of multiple queries into a single number, while the normal case separates them. It just seems like we're going to a lot of trouble here to avoid the obvious design, and I'm not sure why. -- 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] KNN-GiST with recheck
On Tue, Jan 28, 2014 at 5:54 PM, Heikki Linnakangas hlinnakan...@vmware.com wrote: On 01/13/2014 07:17 PM, Alexander Korotkov wrote: Here goes a desription of this patch same as in original thread. KNN-GiST provides ability to get ordered results from index, but this order is based only on index information. For instance, GiST index contains bounding rectangles for polygons, and we can't get exact distance to polygon from index (similar situation is in PostGIS). In attached patch, GiST distance method can set recheck flag (similar to consistent method). This flag means that distance method returned lower bound of distance and we should recheck it from heap. See an example. create table test as (select id, polygon(3+(random()*10)::int, circle(point(random(), random()), 0.0003 + random()*0.001)) as p from generate_series(1,100) id); create index test_idx on test using gist (p); We can get results ordered by distance from polygon to point. postgres=# select id, p - point(0.5,0.5) from test order by p - point(0.5,0.5) limit 10; id | ?column? +-- 755611 | 0.000405855808916853 807562 | 0.000464123777564343 437778 | 0.000738524708741959 947860 | 0.00076250998760724 389843 | 0.000886362723569568 17586 | 0.000981960100555216 411329 | 0.00145338112316853 894191 | 0.00149399559703506 391907 | 0.0016647896049741 235381 | 0.00167554614889509 (10 rows) It's fast using just index scan. QUERY PLAN -- Limit (cost=0.29..1.86 rows=10 width=36) (actual time=0.180..0.230 rows=10 loops=1) - Index Scan using test_idx on test (cost=0.29..157672.29 rows=100 width=36) (actual time=0.179..0.228 rows=10 loops=1) Order By: (p - '(0.5,0.5)'::point) Total runtime: 0.305 ms (4 rows) Nice! Some thoughts: 1. This patch introduces a new polygon - point operator. That seems useful on its own, with or without this patch. Yeah, but exact-knn cant come with no one implementation. But it would better come in a separate patch. 2. I wonder how useful it really is to allow mixing exact and non-exact return values from the distance function. The distance function included in the patch always returns recheck=true. I have a feeling that all other distance function will also always return either true or false. For geometrical datatypes recheck variations in consistent methods are also very rare (I can't remember any). But imagine opclass for arrays where keys have different representation depending on array length. For such opclass and knn on similarity recheck flag could be useful. 3. A binary heap would be a better data structure to buffer the rechecked values. A Red-Black tree allows random insertions and deletions, but in this case you need to insert arbitrary values but only remove the minimum item. That's exactly what a binary heap excels at. We have a nice binary heap implementation in the backend that you can use, see src/backend/lib/binaryheap.c. Hmm. For me binary heap would be a better data structure for KNN-GiST at all :-) 4. (as you mentioned in the other thread: ) It's a modularity violation that you peek into the heap tuple from gist. I think the proper way to do this would be to extend the IndexScan executor node to perform the re-shuffling of tuples that come from the index in wrong order, or perhaps add a new node type for it. Of course that's exactly what your partial sort patch does :-). I haven't looked at that in detail, but I don't think the approach the partial sort patch takes will work here as is. In the KNN-GiST case, the index is returning tuples roughly in the right order, but a tuple that it returns might in reality belong somewhere later in the ordering. In the partial sort patch, the input stream of tuples is divided into non-overlapping groups, so that the tuples within the group are not sorted, but the groups are. I think the partial sort case is a special case of the KNN-GiST case, if you consider the lower bound of each tuple to be the leading keys that you don't need to sort. Yes. But, for instance btree accesses heap for unique checking. Is really it so crimilal? :-) This is not only question of a new node or extending existing node. We need to teach planner/executor access method can return value of some expression which is lower bound of another expression. AFICS now access method can return only original indexed datums and TIDs. So, I afraid that enormous infrastructure changes are required. And I can hardly imagine what they should look like. -- With best regards, Alexander Korotkov.
[HACKERS] bison, flex and ./configure
Hello, Today, I have noticed that ./configure does not return an error when bison and flex are missing. Is this intended ? OS: Ubuntu 13.04 Regards
Re: [HACKERS] bison, flex and ./configure
On 01/28/2014 04:14 PM, salah jubeh wrote: Today, I have noticed that ./configure does not return an error when bison and flex are missing. Is this intended ? Yes. Bison and flex are not required when building from a source tarball, because the tarball includes the generated files. If you're building from a git checkout, however, then you need bison and flex. You will get an error at make, and IIRC a warning at ./configure. - Heikki -- 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] bison, flex and ./configure
Yes. Bison and flex are not required when building from a source tarball, because the tarball includes the generated files. If you're building from a git checkout, however, then you need bison and flex. You will get an error at make, and IIRC a warning at ./configure Thanks for the quick reply. For curiosity reasons why the differentiation between tar and git. Regards On Tuesday, January 28, 2014 3:18 PM, Heikki Linnakangas hlinnakan...@vmware.com wrote: On 01/28/2014 04:14 PM, salah jubeh wrote: Today, I have noticed that ./configure does not return an error when bison and flex are missing. Is this intended ? Yes. Bison and flex are not required when building from a source tarball, because the tarball includes the generated files. If you're building from a git checkout, however, then you need bison and flex. You will get an error at make, and IIRC a warning at ./configure. - Heikki
Re: [HACKERS] jsonb and nested hstore
On Mon, Jan 27, 2014 at 9:43 PM, Andrew Dunstan and...@dunslane.net wrote: On 01/26/2014 05:42 PM, Andrew Dunstan wrote: Here is the latest set of patches for nested hstore and jsonb. Because it's so large I've broken this into two patches and compressed them. The jsonb patch should work standalone. The nested hstore patch depends on it. All the jsonb functions now use the jsonb API - there is no more turning jsonb into text and reparsing it. At this stage I'm going to be starting cleanup on the jsonb code (indentation, error messages, comments etc.) as well get getting up some jsonb docs. Here is an update of the jsonb part of this. Charges: * there is now documentation for jsonb * most uses of elog() in json_funcs.c are replaced by ereport(). * indentation fixes and other tidying. No changes in functionality. Don't have time to fire it up this morning, but a quick scan of the patch turned up a few minor things: * see a comment typo, line 290 'jsonn': * line 332: 'bogus input' -- is this up to error reporting standards? How about value 'x' must be one of array, object, numeric, string, bool? * line 357: jsonb's key could be only a string prefer non possessive: jsonb keys must be a string * line 374, 389: ditto 332 * line 513: is panic appropriate here? * line 599: ditto * line 730: odd phrasing in comment, also commenting on this function is a little light * line 807: slightly prefer 'with respect to' * line 888: another PANIC: these maybe correct, seems odd to halt server on corrupted datum though* * line 1150: hm, is the jsonb internal hash structure documented? Aside: why didn't we use standard hash table (performance maybe)? * line 1805-6: poor phrasing. How about: it will order and make unique the hash keys. Otherwise we believe that pushed keys are ordered and unique. (Don't like verbed 'unqiue'). * line 1860: no break here: merlin -- 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] bison, flex and ./configure
On 01/28/2014 04:28 PM, salah jubeh wrote: Yes. Bison and flex are not required when building from a source tarball, because the tarball includes the generated files. If you're building from a git checkout, however, then you need bison and flex. You will get an error at make, and IIRC a warning at ./configure Thanks for the quick reply. For curiosity reasons why the differentiation between tar and git. We include the generated files in the tarballs for the convenience of people who just want to download, compile, and install the software. Fewer dependencies is good in that case. It also ensures that an official version, ie. from a tarball, is always built using the same version of bison/flex. Whereas if you do a git checkout, you're probably a developer, and want to modify the sources. It's not unreasonable to expect a developer to have bison and flex installed. Also, including the generated files in the git repository would cause unnecessary diffs when people have different versions of bison/flex installed on their development boxes. We've chosen a different approach with autoconf; the configure file is generated from configure.in, but we include the configure file in the git repository. It does add some extra effort to developers that need to modify configure.in, but OTOH, if you don't modify it, you don't need to have autoconf installed. - Heikki -- 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] ALTER TABLE lock strength reduction patch is unsafe
On Mon, Jan 27, 2014 at 08:57:26PM +, Simon Riggs wrote: We get the new behaviour by default and I expect we'll be very happy with it. A second thought is that if we have problems of some kind in the field as a result of the new lock modes then we will be able to turn them off. I'm happy to fix any problems that occur, but that doesn't mean there won't be any. If everybody is confident that we've foreseen every bug, then no problem, lets remove it. I recall being asked to add hot_standby = on | off for similar reasons. Addressing a larger issue, I have no problem with systematically adding GUCs to turn off features we add in each major release if we can also systematically remove those GUCs in the next major release. This would require putting all these settings in the compatibility section of postgresql.conf. However, I don't think it makes sense to do this in a one-off manner. It is also possible that there are enough cases where we _can't_ turn the feature off with a GUC that this would be unworkable. So, if we can't do it systematically, that means we will have enough breakage cases that we just need to rush out new versions to fix major breakage and one-off GUCs just don't buy us much, and add confusion. Does that make sense? -- Bruce Momjian br...@momjian.ushttp://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + -- 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] bison, flex and ./configure
Hello Heikki, Thanks for sharing. Reagrds On Tuesday, January 28, 2014 3:48 PM, Heikki Linnakangas hlinnakan...@vmware.com wrote: On 01/28/2014 04:28 PM, salah jubeh wrote: Yes. Bison and flex are not required when building from a source tarball, because the tarball includes the generated files. If you're building from a git checkout, however, then you need bison and flex. You will get an error at make, and IIRC a warning at ./configure Thanks for the quick reply. For curiosity reasons why the differentiation between tar and git. We include the generated files in the tarballs for the convenience of people who just want to download, compile, and install the software. Fewer dependencies is good in that case. It also ensures that an official version, ie. from a tarball, is always built using the same version of bison/flex. Whereas if you do a git checkout, you're probably a developer, and want to modify the sources. It's not unreasonable to expect a developer to have bison and flex installed. Also, including the generated files in the git repository would cause unnecessary diffs when people have different versions of bison/flex installed on their development boxes. We've chosen a different approach with autoconf; the configure file is generated from configure.in, but we include the configure file in the git repository. It does add some extra effort to developers that need to modify configure.in, but OTOH, if you don't modify it, you don't need to have autoconf installed. - Heikki
Re: [HACKERS] jsonb and nested hstore
On 01/28/2014 09:38 AM, Merlin Moncure wrote: On Mon, Jan 27, 2014 at 9:43 PM, Andrew Dunstan and...@dunslane.net wrote: On 01/26/2014 05:42 PM, Andrew Dunstan wrote: Here is the latest set of patches for nested hstore and jsonb. Because it's so large I've broken this into two patches and compressed them. The jsonb patch should work standalone. The nested hstore patch depends on it. All the jsonb functions now use the jsonb API - there is no more turning jsonb into text and reparsing it. At this stage I'm going to be starting cleanup on the jsonb code (indentation, error messages, comments etc.) as well get getting up some jsonb docs. Here is an update of the jsonb part of this. Charges: * there is now documentation for jsonb * most uses of elog() in json_funcs.c are replaced by ereport(). * indentation fixes and other tidying. No changes in functionality. Don't have time to fire it up this morning, but a quick scan of the patch turned up a few minor things: * see a comment typo, line 290 'jsonn': * line 332: 'bogus input' -- is this up to error reporting standards? How about value 'x' must be one of array, object, numeric, string, bool? * line 357: jsonb's key could be only a string prefer non possessive: jsonb keys must be a string * line 374, 389: ditto 332 * line 513: is panic appropriate here? * line 599: ditto * line 730: odd phrasing in comment, also commenting on this function is a little light * line 807: slightly prefer 'with respect to' * line 888: another PANIC: these maybe correct, seems odd to halt server on corrupted datum though* * line 1150: hm, is the jsonb internal hash structure documented? Aside: why didn't we use standard hash table (performance maybe)? * line 1805-6: poor phrasing. How about: it will order and make unique the hash keys. Otherwise we believe that pushed keys are ordered and unique. (Don't like verbed 'unqiue'). * line 1860: no break here: Looks like this review is against jsonb-5, not jsonb-6. cheers andrew -- 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] Review: Patch FORCE_NULL option for copy COPY in CSV mode
On 01/28/2014 05:55 AM, Ian Lawrence Barwick wrote: Hi Payal Many thanks for the review, and my apologies for not getting back to you earlier. Updated version of the patch attached with suggested corrections. On a very quick glance, I see that you have still not made adjustments to contrib/file_fdw to accommodate this new option. I don't see why this COPY option should be different in that respect. cheers andrew -- 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] Union-ifying RangeTblEntry
On Tue, Jan 28, 2014 at 1:18 AM, Craig Ringer cr...@2ndquadrant.com wrote: I'm about to have to add _another_ flag to RangeTblEntry, to track row-security expansion. In the process I noticed the comment: /* * XXX the fields applicable to only some rte kinds should be * merged into a union. I didn't do this yet because the diffs * would impact a lot of code that is being actively worked on. * FIXME someday. */ and it struck me that the end of the 9.4 commitfest might be a reasonable time to do this now that PstgreSQL is subject to pulsed development with commitfests. As part of that, a number of the flag fields on RangeTblEntry into a bitfield. Comments? I'd be more inclined to just remove the comment. Does a RangeTblEntry really use enough memory that we need to conserve bytes there? -- 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] jsonb and nested hstore
Looks like this review is against jsonb-5, not jsonb-6. oh yep -- shoot, sorry for the noise. merlin -- 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] proposal: hide application_name from other users
On Sat, Jan 25, 2014 at 2:33 AM, Magnus Hagander mag...@hagander.net wrote: With that many options of hiding it, I would still argue for just picking one of those. For example, of Heroku wants to protect their customers against the behaviour of the pg gem, you can for example set PGAPPNAME in the environment. That will override what the gem sets in fallback_application_name, but those users that actually use it and specify it in their connection string, will override that default. The problem with that is that it doesn't just hide it. It removes the debugging information altogether. Even the administrator of the application itself and the DBA won't have this information. The reason the Gem is putting that information in application_name is precisely because it's useful. In fact it was a patch from Heroku that added that information to application_name in the first place because it's useful. And all of that without removing a valuable debugging/tracing tool from other users. Why is application_name useful for users who aren't the DBA and aren't the user in question. The sql_query would probably be more useful than application_name but we hide that... -- 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] Review: Patch FORCE_NULL option for copy COPY in CSV mode
2014-01-29 Andrew Dunstan and...@dunslane.net: On 01/28/2014 05:55 AM, Ian Lawrence Barwick wrote: Hi Payal Many thanks for the review, and my apologies for not getting back to you earlier. Updated version of the patch attached with suggested corrections. On a very quick glance, I see that you have still not made adjustments to contrib/file_fdw to accommodate this new option. I don't see why this COPY option should be different in that respect. Hmm, that idea seems to have escaped me completely. I'll get onto it forthwith. Regards Ian Barwick -- 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] jsonb and nested hstore
Andrew Dunstan wrote: para +There are two JSON data types: typejson/type and typejsonb/type. +Both accept identical sets of values as input. The difference is primarily +a matter of efficiency. The typejson/type data type stores an exact +copy of the the input text, and the processing functions have to reparse +it to precess it, while the typejsonb/type is stored in a decomposed +form that makes it slightly less efficient to input but very much faster +to process, since it never needs reparsing. + /para typo precess duplicated word of the the input + /indextermindexterm + primaryjsonb_each/primary + /indextermparaliteraljson_each(json)/literal + /paraparaliteraljsonb_each(jsonb)/literal + /para/entry This SGML nesting is odd and hard to read. Please place opening tags in separate lines (or at least not immediately following a closing tag). I am not sure whether the mentions of jsonb_each vs. json_each there are correct or typos. This also occurs in other places. Expands the object in replaceablefrom_json/replaceable to a row whose columns match the record type defined by base. Conversion will be best effort; columns in base with no corresponding key in replaceablefrom_json/replaceable - will be left null. If a column is specified more than once, the last value is used. + will be left null. When processing typejson/type, if a column is + specified more than once, the last value is used. Maybe you also need to specify what happens with jsonb? diff --git a/src/backend/utils/adt/jsonb.c b/src/backend/utils/adt/jsonb.c new file mode 100644 index 000..107ebf0 --- /dev/null +++ b/src/backend/utils/adt/jsonb.c @@ -0,0 +1,544 @@ +/*- + * + * jsonb.c + * I/O for jsonb type + * + * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group 2014. Why Portions, if we don't attribute any portion to UCB? + * NOTE. JSONB type is designed to be binary compatible with hstore. + * + * src/backend/utils/adt/jsonb_support.c Typo'ed name here. +#include postgres.h + +#include libpq/pqformat.h +#include utils/builtins.h +#include utils/json.h +#include utils/jsonapi.h +#include utils/jsonb.h Misplaced prototype? +static void recvJsonb(StringInfo buf, JsonbValue *v, uint32 level, uint32 header); Not sure about the jsonb_1.out file. Is that only due to encoding differences? What happens if you run it in a completely different encoding than whatever you tested with? (I would assume Latin-9 and UTF8) If it fails, then I think you'll end up ripping those tests out, so probably the _1.out file will have no value at all. I also wonder if it'd be better to have one large .sql file that produces the same output in all platforms that tests most of the common stuff, so that tests that changes output in different platforms can have smaller alternative expected files. -- Álvaro Herrerahttp://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training 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] proposal: hide application_name from other users
Greg Stark st...@mit.edu writes: The problem with that is that it doesn't just hide it. It removes the debugging information altogether. Even the administrator of the application itself and the DBA won't have this information. The reason the Gem is putting that information in application_name is precisely because it's useful. In fact it was a patch from Heroku that added that information to application_name in the first place because it's useful. Oh really. So, to clean up after their own ill-considered decision, they'd like to take useful information away from everybody. 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
[HACKERS] Suspicion of a compiler bug in clang: using ternary operator in ereport()
Hi, just a word of warning: it seems as if there is compiler bug in clang regarding the ternary operator when used in ereport(). While working on a patch I found that this code: ereport(FATAL, (errmsg(could not map anonymous shared memory: %m), (errno == ENOMEM) ? errhint(This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory or swap space. To reduce the request size (currently %zu bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections., *size) : 0)); did not emit a errhint when using clang, although errno == ENOMEM was true. The same code works with gcc. I used the same data dir, so config was exactly the same, too. I reported this bug at clang.org: http://llvm.org/bugs/show_bug.cgi?id=18644 Best regards, -- Christian Kruse http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training Services pgpA2ZYq2t26Z.pgp Description: PGP signature
Re: [HACKERS] Union-ifying RangeTblEntry
Robert Haas robertmh...@gmail.com writes: On Tue, Jan 28, 2014 at 1:18 AM, Craig Ringer cr...@2ndquadrant.com wrote: In the process I noticed the comment: /* * XXX the fields applicable to only some rte kinds should be * merged into a union. I didn't do this yet because the diffs * would impact a lot of code that is being actively worked on. * FIXME someday. */ I'd be more inclined to just remove the comment. Does a RangeTblEntry really use enough memory that we need to conserve bytes there? It doesn't; RTEs aren't that big, and more to the point, there aren't that many of them per query. I think I wrote that comment, many years ago, when memory was more precious ... but even then it was more out of neatnik-ism than any real need to conserve space. A bigger consideration is the risk of introducing bugs: how certain are we that no code ever touches fields that are not supposed to be used for the current rtekind? I'm sure not. Right now, it's safe to assume that e.g. subquery is NULL if it's not an RTE_SUBQUERY, and I think there are probably places that depend on that. And lastly, we'd be touching enough code to make such a change a serious PITA for back-patching, and for third-party modules. In return for not much. So yeah, let's just drop the comment in favor of a note that irrelevant fields should be zero/null. 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
[HACKERS] Mailing subscription test
Sorry, i can't receive mailing :( -- 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] alternative back-end block formats
Christian Convey christian.con...@gmail.com writes: On Tue, Jan 28, 2014 at 5:42 AM, Cédric Villemain ced...@2ndquadrant.comwrote: As written in the meeting notes, Tom Lane revealed an interest in pluggable storage. So it might be interesting to check that. https://wiki.postgresql.org/wiki/PgCon_2013_Developer_Meeting Thanks. I just read those meeting notes, and also Josh Berkus' blog on the topic: http://www.databasesoup.com/2013/05/postgresql-new-development-priorities-2.html I was only thinking to enable pluggable operations on a single, specified heap page, probably as a function of which table owned the page. Josh's blog seems to describe something a little broader in scope, although I can't tell from that post exactly what functionality that entails. Either way, this sounds like something I'd enjoy pitching in on, to whatever extent I could be useful. Has anyone started work on this yet? Nope, but it's still on the radar screen. There are a couple of really huge issues that would have to be argued out before any progress could be made. One is that tuple layout (particularly tuple header format) is something known in detail throughout large parts of the system. This is a PITA if the storage layer would like to use some other tuple format, but is it worthwhile or even possible to abstract it? Another is that we've got whole *classes* of utility commands that are specifically targeted to the storage engine we've got. VACUUM, CLUSTER, ALTER TABLE SET TABLESPACE for example. Not to mention autovacuum. It's not clear where these would fit if we tried to define a storage engine API layer. 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] proposal: hide application_name from other users
On 2014-01-28 07:27:52 -0800, Greg Stark wrote: And all of that without removing a valuable debugging/tracing tool from other users. Why is application_name useful for users who aren't the DBA and aren't the user in question. The sql_query would probably be more useful than application_name but we hide that... It is useful to find out what the backend blocking you by taking out locks or using all CPU is doing. And a sql query obviously can contain actually sensitive data that you can't really hide. Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training 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] [PATCH] Implement json_array_elements_text
On 01/20/2014 10:34 PM, Andrew Dunstan wrote: On 01/20/2014 09:58 PM, Laurence Rowe wrote: Following the discussion on pgsql-general, I thought I'd have a go implementing json_array_elements_text following the same pattern as json_each_text. The function makes it possible to join elements of a json array onto a table, Can we sneak this very small feature into 9.4? I'm happy to take on the review etc. I'm going to take silence as consent and try to get the updated version of this committed today. cheers andrew -- 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] Suspicion of a compiler bug in clang: using ternary operator in ereport()
Hi, when I remove the errno comparison and use a 1 it works: ereport(FATAL, (errmsg(could not map anonymous shared memory: %m), 1 ? errhint(This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory or swap space. To reduce the request size (currently %zu bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections., *size) : 0)); Same if I use an if(errno == ENOMEM) instead of the ternary operator. Best regards, -- Christian Kruse http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training Services pgpjAIs_29NNJ.pgp Description: PGP signature
Re: [HACKERS] jsonb and nested hstore
On 01/28/2014 10:50 AM, Alvaro Herrera wrote: + /indextermindexterm + primaryjsonb_each/primary + /indextermparaliteraljson_each(json)/literal + /paraparaliteraljsonb_each(jsonb)/literal + /para/entry This SGML nesting is odd and hard to read. Please place opening tags in separate lines (or at least not immediately following a closing tag). I am not sure whether the mentions of jsonb_each vs. json_each there are correct or typos. This also occurs in other places. As I understand it, an entry tag can only contain block-level elements like para if there are no inline elements (including white space). If that's not correct I'll change it, but that's what I read here: http://oreilly.com/openbook/docbook/book/entry.html cheers andrew -- 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] jsonb and nested hstore
Andrew Dunstan and...@dunslane.net writes: On 01/28/2014 10:50 AM, Alvaro Herrera wrote: + /indextermindexterm + primaryjsonb_each/primary + /indextermparaliteraljson_each(json)/literal + /paraparaliteraljsonb_each(jsonb)/literal + /para/entry This SGML nesting is odd and hard to read. Please place opening tags in separate lines (or at least not immediately following a closing tag). I am not sure whether the mentions of jsonb_each vs. json_each there are correct or typos. This also occurs in other places. As I understand it, an entry tag can only contain block-level elements like para if there are no inline elements (including white space). Practically every existing use of indexterm is freer than this in its use of whitespace. It sounds to me like maybe you are trying to put the indexterm inside something it shouldn't go inside of. 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] [PATCH] Use MAP_HUGETLB where supported (v3)
Hi, attached you will find a new version of the patch, ported to HEAD, fixed the mentioned bug and - hopefully - dealing the the remaining issues. Best regards, -- Christian Kruse http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training Services diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 14ed6c7..e7c2559 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -1107,6 +1107,43 @@ include 'filename' /listitem /varlistentry + varlistentry id=guc-huge-tlb-pages xreflabel=huge_tlb_pages + termvarnamehuge_tlb_pages/varname (typeenum/type)/term + indexterm + primaryvarnamehuge_tlb_pages/ configuration parameter/primary + /indexterm + listitem + para +Enables/disables the use of huge TLB pages. Valid values are +literaltry/literal (the default), literalon/literal, +and literaloff/literal. + /para + + para +At present, this feature is supported only on Linux. The setting +is ignored on other systems. + /para + + para +The use of huge TLB pages results in smaller page tables and +less CPU time spent on memory management, increasing performance. For +more details, see +ulink url=https://wiki.debian.org/Hugepages;the Debian wiki/ulink. +Remember that you will need at least shared_buffers / huge page size + +1 huge TLB pages. So for example for a system with 6GB shared buffers +and a hugepage size of 2kb of you will need at least 3156 huge pages. + /para + + para +With varnamehuge_tlb_pages/varname set to literaltry/literal, +the server will try to use huge pages, but fall back to using +normal allocation if that fails. With literalon/literal, failure +to use huge pages will prevent the server from starting up. With +literaloff/literal, huge pages will not be used. + /para + /listitem + /varlistentry + varlistentry id=guc-temp-buffers xreflabel=temp_buffers termvarnametemp_buffers/varname (typeinteger/type)/term indexterm diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c index 0d01617..b3b87d7 100644 --- a/src/backend/port/sysv_shmem.c +++ b/src/backend/port/sysv_shmem.c @@ -32,6 +32,7 @@ #include portability/mem.h #include storage/ipc.h #include storage/pg_shmem.h +#include utils/guc.h typedef key_t IpcMemoryKey; /* shared memory key passed to shmget(2) */ @@ -41,7 +42,7 @@ typedef int IpcMemoryId; /* shared memory ID returned by shmget(2) */ unsigned long UsedShmemSegID = 0; void *UsedShmemSegAddr = NULL; static Size AnonymousShmemSize; -static void *AnonymousShmem; +static void *AnonymousShmem = NULL; static void *InternalIpcMemoryCreate(IpcMemoryKey memKey, Size size); static void IpcMemoryDetach(int status, Datum shmaddr); @@ -317,6 +318,80 @@ PGSharedMemoryIsInUse(unsigned long id1, unsigned long id2) return true; } +/* + * Creates an anonymous mmap()ed shared memory segment. + * + * Pass the desired size in *size. This function will modify *size to the + * actual size of the allocation, if it ends up allocating a larger than + * desired segment. + */ +#ifndef EXEC_BACKEND +static void * +CreateAnonymousSegment(Size *size) +{ + Size allocsize; + void *ptr = MAP_FAILED; + +#ifndef MAP_HUGETLB + if (huge_tlb_pages == HUGE_TLB_ON) + ereport(ERROR, +(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg(huge TLB pages not supported on this platform))); +#else + if (huge_tlb_pages == HUGE_TLB_ON || huge_tlb_pages == HUGE_TLB_TRY) + { + /* + * Round up the request size to a suitable large value. + * + * Some Linux kernel versions are known to have a bug, which causes + * mmap() with MAP_HUGETLB to fail if the request size is not a + * multiple of any supported huge page size. To work around that, we + * round up the request size to nearest 2MB. 2MB is the most common + * huge page page size on affected systems. + * + * Aside from that bug, even with a kernel that does the allocation + * correctly, rounding it up ourselvees avoids wasting memory. Without + * it, if we for example make an allocation of 2MB + 1 bytes, the + * kernel might decide to use two 2MB huge pages for that, and waste 2 + * MB - 1 of memory. When we do the rounding ourselves, we can use + * that space for allocations. + */ + int hugepagesize = 2 * 1024 * 1024; + + allocsize = *size; + if (allocsize % hugepagesize != 0) + allocsize += hugepagesize - (allocsize % hugepagesize); + + ptr = mmap(NULL, *size, PROT_READ | PROT_WRITE, + PG_MMAP_FLAGS | MAP_HUGETLB, -1, 0); + if (huge_tlb_pages == HUGE_TLB_TRY ptr == MAP_FAILED) + elog(DEBUG1, mmap with MAP_HUGETLB failed, huge pages disabled: %m); + } +#endif + + if (huge_tlb_pages == HUGE_TLB_OFF || + (huge_tlb_pages == HUGE_TLB_TRY ptr == MAP_FAILED)) + { +
Re: [HACKERS] A minor correction in comment in heaptuple.c
On Mon, Jan 27, 2014 at 02:51:59PM -0800, Kevin Grittner wrote: So anyway, *I* would object to applying that; it was meant to illustrate what the comment, if any, should cover; not to be an actual code change. I don't think the change that was pushed helps that comment carry its own weight, either. If we can't do better than that, we should just drop it. I guess I won't try to illustrate a point *that* particular way again OK, so does anyone object to removing this comment line? slot_attisnull() ... /* -- * assume NULL if attnum is out of range according to the tupdesc */ if (attnum tupleDesc-natts) return true; -- Bruce Momjian br...@momjian.ushttp://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + -- 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] A minor correction in comment in heaptuple.c
On 2014-01-28 11:14:49 -0500, Bruce Momjian wrote: On Mon, Jan 27, 2014 at 02:51:59PM -0800, Kevin Grittner wrote: So anyway, *I* would object to applying that; it was meant to illustrate what the comment, if any, should cover; not to be an actual code change. I don't think the change that was pushed helps that comment carry its own weight, either. If we can't do better than that, we should just drop it. I guess I won't try to illustrate a point *that* particular way again OK, so does anyone object to removing this comment line? Let's just not do anything. This is change for changes sake. Not improving anything the slightest. Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training 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] Suspicion of a compiler bug in clang: using ternary operator in ereport()
Christian Kruse christ...@2ndquadrant.com writes: just a word of warning: it seems as if there is compiler bug in clang regarding the ternary operator when used in ereport(). While working on a patch I found that this code: ... did not emit a errhint when using clang, although errno == ENOMEM was true. Huh. I noticed a buildfarm failure a couple days ago in which the visible regression diff was that an expected HINT was missing. This probably explains that, because we use ternary operators in this style in quite a few places. 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] jsonb and nested hstore
On 01/28/2014 11:09 AM, Tom Lane wrote: Andrew Dunstan and...@dunslane.net writes: On 01/28/2014 10:50 AM, Alvaro Herrera wrote: + /indextermindexterm + primaryjsonb_each/primary + /indextermparaliteraljson_each(json)/literal + /paraparaliteraljsonb_each(jsonb)/literal + /para/entry This SGML nesting is odd and hard to read. Please place opening tags in separate lines (or at least not immediately following a closing tag). I am not sure whether the mentions of jsonb_each vs. json_each there are correct or typos. This also occurs in other places. As I understand it, an entry tag can only contain block-level elements like para if there are no inline elements (including white space). Practically every existing use of indexterm is freer than this in its use of whitespace. It sounds to me like maybe you are trying to put the indexterm inside something it shouldn't go inside of. The problem is not the indexterm element, it's the space that might exist outside it. Are we using block level elements like para inside entry elements anywhere else? If not, then your observation is not relevant. If there are no block level elements then AIUI we can space things out how we like inside the entry element. If you can show me how else legally to get a line break inside an entry element I'm very interested. I tried several things before I found this way of making it work. cheers andrew -- 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] jsonb and nested hstore
Tom Lane wrote: Andrew Dunstan and...@dunslane.net writes: On 01/28/2014 10:50 AM, Alvaro Herrera wrote: + /indextermindexterm + primaryjsonb_each/primary + /indextermparaliteraljson_each(json)/literal + /paraparaliteraljsonb_each(jsonb)/literal + /para/entry This SGML nesting is odd and hard to read. Please place opening tags in separate lines (or at least not immediately following a closing tag). I am not sure whether the mentions of jsonb_each vs. json_each there are correct or typos. This also occurs in other places. As I understand it, an entry tag can only contain block-level elements like para if there are no inline elements (including white space). Practically every existing use of indexterm is freer than this in its use of whitespace. It sounds to me like maybe you are trying to put the indexterm inside something it shouldn't go inside of. FWIW I was just talking about formatting of the SGML source so that it is easier to read. -- Álvaro Herrerahttp://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training 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] jsonb and nested hstore
Alvaro Herrera alvhe...@2ndquadrant.com writes: Tom Lane wrote: Practically every existing use of indexterm is freer than this in its use of whitespace. It sounds to me like maybe you are trying to put the indexterm inside something it shouldn't go inside of. FWIW I was just talking about formatting of the SGML source so that it is easier to read. Yeah, me too. I'm just suggesting that maybe Andrew needs to move the indexterm so that he can format it more readably. 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] jsonb and nested hstore
On 01/28/2014 11:27 AM, Tom Lane wrote: Alvaro Herrera alvhe...@2ndquadrant.com writes: Tom Lane wrote: Practically every existing use of indexterm is freer than this in its use of whitespace. It sounds to me like maybe you are trying to put the indexterm inside something it shouldn't go inside of. FWIW I was just talking about formatting of the SGML source so that it is easier to read. Yeah, me too. I'm just suggesting that maybe Andrew needs to move the indexterm so that he can format it more readably. Hmm. Maybe I could put them inside the para elements. So we'd have: entrypara indexterm /indexterm para text /parapara indexterm /indexterm para text /para/entry cheers andrew -- 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] ALTER TABLE lock strength reduction patch is unsafe
On 28 January 2014 14:55, Bruce Momjian br...@momjian.us wrote: On Mon, Jan 27, 2014 at 08:57:26PM +, Simon Riggs wrote: We get the new behaviour by default and I expect we'll be very happy with it. A second thought is that if we have problems of some kind in the field as a result of the new lock modes then we will be able to turn them off. I'm happy to fix any problems that occur, but that doesn't mean there won't be any. If everybody is confident that we've foreseen every bug, then no problem, lets remove it. I recall being asked to add hot_standby = on | off for similar reasons. Addressing a larger issue, I have no problem with systematically adding GUCs to turn off features we add in each major release if we can also systematically remove those GUCs in the next major release. Agreed. I propose 2 releases since the time between release of 9.4 and the feature freeze of 9.5 is only 4 months, not usually enough for subtle bugs to be discovered. This would require putting all these settings in the compatibility section of postgresql.conf. Agreed, that is where I have added the parameter. However, I don't think it makes sense to do this in a one-off manner. It is also possible that there are enough cases where we _can't_ turn the feature off with a GUC that this would be unworkable. So, if we can't do it systematically, that means we will have enough breakage cases that we just need to rush out new versions to fix major breakage and one-off GUCs just don't buy us much, and add confusion. Does that make sense? For me, reducing the strength of DDL locking is a major change in RDBMS behaviour that could both delight and surprise our users. Maybe a few actually depend upon the locking behaviour, maybe. After some years of various people looking at this, I think we've got it right. Experience tells me that while I think this is the outcome, we are well advised to protect against the possibility that it is not correct and that if we have corner case issues, it would be good to easily disable this in the field. In the current case, a simple parameter works very well to disable the feature; in other cases, not. Summary: This is an atypical case. I do not normally propose such things - this is the third time in 10 years, IIRC. I have no problem removing the parameter if required to. In that case, I would like to leave the parameter in until mid beta, to allow greater certainty. In any case, I would wish to retain as a minimum an extern bool variable allowing it to be turned off by C function if desired. -- Simon Riggs http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training 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] Function definition removed but prototype still there
On Tue, Jan 28, 2014 at 09:42:37AM +, Rajeev rastogi wrote: As part of the below commit 36a35c550ac114caa423bcbe339d3515db0cd957 (Compress GIN posting lists, for smaller index size.) Function GinDataPageAddItemPointer definition was removed but corresponding prototype was still there. Attached is the patch to fix the same. Thanks. Applied. -- Bruce Momjian br...@momjian.ushttp://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + -- 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] jsonb and nested hstore
Andrew Dunstan and...@dunslane.net writes: The problem is not the indexterm element, it's the space that might exist outside it. Are we using block level elements like para inside entry elements anywhere else? Probably not, and I wonder why you're trying to. Whole paras inside a table entry (this is a table no?) don't sound like they are going to lead to nice-looking results. 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] Changeset Extraction v7.3
On 27 January 2014 16:20, Andres Freund and...@2ndquadrant.com wrote: Hi, Here's the next version of the patchset. The following changes have been made: * move xmin pegging and more logic responsibility to procarray.c * split all support for changeset extraction from the initial slot patch * always register an before_shmem_exit handler when max_replication_slots is registered, not just while a slot is acquired * move some patch hunks to earlier patches, especially the ReplicationSlotAcquire() call for physical rep that accidentally slipped and the SQL accessible slot manipulation functions * minor stuff 0001 doesn't apply cleanly due to commit ea9df812d8502fff74e7bc37d61bdc7d66d77a7f. The rest are fine. -- Thom -- 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] jsonb and nested hstore
On 01/28/2014 11:29 AM, Tom Lane wrote: Andrew Dunstan and...@dunslane.net writes: The problem is not the indexterm element, it's the space that might exist outside it. Are we using block level elements like para inside entry elements anywhere else? Probably not, and I wonder why you're trying to. Whole paras inside a table entry (this is a table no?) don't sound like they are going to lead to nice-looking results. See http://developer.postgresql.org/~adunstan/functions-json.html cheers andrew -- 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] A better way than tweaking NTUP_PER_BUCKET
On Mon, Jan 27, 2014 at 10:00 AM, Simon Riggs si...@2ndquadrant.com wrote: On 27 January 2014 17:44, Pavel Stehule pavel.steh...@gmail.com wrote: This topic is interesting - we found very bad performance with hashing large tables with high work_mem. MergeJoin with quicksort was significantly faster. I've seen this also. I didn't deeper research - there is a possibility of virtualization overhead. I took measurements and the effect was repeatable and happened for all sizes of work_mem, but nothing more to add. I get similar results if I join on integers. But joining on text, the hash wins by a mile. I use this as a simple test bed: alter table pgbench_accounts drop CONSTRAINT pgbench_accounts_pkey; update pgbench_accounts set filler = md5(aid::text); set work_mem to whatever keeps the join off of disk for the given scale; set enable_hashjoin to whatever; select sum(a1.abalance*a2.abalance) from pgbench_accounts a1 join pgbench_accounts a2 using (aid); select sum(a1.abalance*a2.abalance) from pgbench_accounts a1 join pgbench_accounts a2 using (filler); hash integer: 1832.695 ms merge integer: 1462.913 ms hash text: 2353.115 ms merge text: 11,218.628 ms The cost estimates do not depend on the column used in the join despite a 6 fold difference in run time, so the planner is perhaps missing a trick there. Cheers, Jeff
Re: [HACKERS] Changeset Extraction v7.3
On Tue, Jan 28, 2014 at 11:49 AM, Thom Brown t...@linux.com wrote: On 27 January 2014 16:20, Andres Freund and...@2ndquadrant.com wrote: Hi, Here's the next version of the patchset. The following changes have been made: * move xmin pegging and more logic responsibility to procarray.c * split all support for changeset extraction from the initial slot patch * always register an before_shmem_exit handler when max_replication_slots is registered, not just while a slot is acquired * move some patch hunks to earlier patches, especially the ReplicationSlotAcquire() call for physical rep that accidentally slipped and the SQL accessible slot manipulation functions * minor stuff 0001 doesn't apply cleanly due to commit ea9df812d8502fff74e7bc37d61bdc7d66d77a7f. The rest are fine. I've rebased it here and am hacking on it still. -- 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] A minor correction in comment in heaptuple.c
Andres Freund and...@2ndquadrant.com writes: On 2014-01-28 11:14:49 -0500, Bruce Momjian wrote: OK, so does anyone object to removing this comment line? Let's just not do anything. This is change for changes sake. Not improving anything the slightest. Indeed. I'd actually request that you revert your previous change to the comment, as it didn't improve matters and is only likely to cause pain for future back-patching. 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] Performance Improvement by reducing WAL for Update Operation
On 01/27/2014 07:03 PM, Amit Kapila wrote: I have tried to improve algorithm in another way so that we can get benefit of same chunks during find match (something similar to lz). The main change is to consider chunks at fixed boundary (4 byte) and after finding match, try to find if there is a longer match than current chunk. While finding longer match, it still takes care that next bigger match should be at chunk boundary. I am not completely sure about the chunk boundary may be 8 or 16 can give better results. Since you're only putting a value in the history every 4 bytes, you wouldn't need to calculate the hash in a rolling fashion. You could just take next four bytes, calculate hash, put it in history table. Then next four bytes, calculate hash, and so on. Might save some cycles when building the history table... - Heikki -- 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] ALTER TABLE lock strength reduction patch is unsafe
On Tue, Jan 28, 2014 at 04:36:39PM +, Simon Riggs wrote: For me, reducing the strength of DDL locking is a major change in RDBMS behaviour that could both delight and surprise our users. Maybe a few actually depend upon the locking behaviour, maybe. After some years of various people looking at this, I think we've got it right. Experience tells me that while I think this is the outcome, we are well advised to protect against the possibility that it is not correct and that if we have corner case issues, it would be good to easily disable this in the field. In the current case, a simple parameter works very well to disable the feature; in other cases, not. Summary: This is an atypical case. I do not normally propose such things - this is the third time in 10 years, IIRC. Uh, in my memory, you are the person who is most likely to suggest a GUC of all our developers. I have no problem removing the parameter if required to. In that case, I would like to leave the parameter in until mid beta, to allow greater certainty. In any case, I would wish to retain as a minimum an extern bool variable allowing it to be turned off by C function if desired. Anything changed to postgresql.conf during beta is going to require an initdb. Also, lots of backward-compatibility infrastructure, as you are suggesting above, add complexity to the system. I am basically against a GUC on this. We have far larger problems with 9.3 than backward compatibility, and limited resources. -- Bruce Momjian br...@momjian.ushttp://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + -- 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] A minor correction in comment in heaptuple.c
On Tue, Jan 28, 2014 at 11:20:39AM -0500, Tom Lane wrote: Andres Freund and...@2ndquadrant.com writes: On 2014-01-28 11:14:49 -0500, Bruce Momjian wrote: OK, so does anyone object to removing this comment line? Let's just not do anything. This is change for changes sake. Not improving anything the slightest. Indeed. I'd actually request that you revert your previous change to the comment, as it didn't improve matters and is only likely to cause pain for future back-patching. OK, so we have a don't change anything and a revert. I am thinking the new wording as a super-minor improvement. Anyone else want to vote? -- Bruce Momjian br...@momjian.ushttp://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + -- 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] ALTER TABLE lock strength reduction patch is unsafe
On 01/28/2014 07:15 PM, Bruce Momjian wrote: On Tue, Jan 28, 2014 at 04:36:39PM +, Simon Riggs wrote: For me, reducing the strength of DDL locking is a major change in RDBMS behaviour that could both delight and surprise our users. Maybe a few actually depend upon the locking behaviour, maybe. After some years of various people looking at this, I think we've got it right. Experience tells me that while I think this is the outcome, we are well advised to protect against the possibility that it is not correct and that if we have corner case issues, it would be good to easily disable this in the field. In the current case, a simple parameter works very well to disable the feature; in other cases, not. I don't understand why anyone would want to turn this feature off, ie. require stronger locks than necessary for a DDL change. If we're not confident that the patch is correct, then it should not be applied. If we are confident enough to commit it, and a bug crops up later, we'll fix the bug as usual. A user savvy enough to fiddle with such a GUC can also do their DDL with: BEGIN; LOCK TABLE table DDL COMMIT; I have no problem removing the parameter if required to. In that case, I would like to leave the parameter in until mid beta, to allow greater certainty. In any case, I would wish to retain as a minimum an extern bool variable allowing it to be turned off by C function if desired. Anything changed to postgresql.conf during beta is going to require an initdb. Huh? Surely not. - Heikki -- 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] ALTER TABLE lock strength reduction patch is unsafe
On Tue, Jan 28, 2014 at 07:21:50PM +0200, Heikki Linnakangas wrote: I have no problem removing the parameter if required to. In that case, I would like to leave the parameter in until mid beta, to allow greater certainty. In any case, I would wish to retain as a minimum an extern bool variable allowing it to be turned off by C function if desired. Anything changed to postgresql.conf during beta is going to require an initdb. Huh? Surely not. Uh, if we ship beta1 with a GUC in postgresql.conf, and then we remove support for the GUC in beta2, anyone starting a server initdb-ed with beta1 is going to get an error and the server is not going to start: LOG: unrecognized configuration parameter xxx in file /u/pgsql/data/postgresql.conf line 1 FATAL: configuration file /u/pgsql/data/postgresql.conf contains errors so, yeah, it isn't going to require an initdb, but it is going to require everyone to edit their postgresql.conf. My guess is a lot of people are going to assume the old postgresql.conf is not compatible and are going to initdb and reload. -- Bruce Momjian br...@momjian.ushttp://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + -- 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] alternative back-end block formats
There are a couple of really huge issues that would have to be argued out before any progress could be made. Is this something that people want to spend time on right now? As I mentioned earlier, I'm game. But it doesn't sound like I'll get very far without adult supervision.
Re: [HACKERS] A minor correction in comment in heaptuple.c
On Tue, Jan 28, 2014 at 02:25:51PM -0300, Alvaro Herrera wrote: Bruce Momjian escribió: On Tue, Jan 28, 2014 at 11:20:39AM -0500, Tom Lane wrote: Andres Freund and...@2ndquadrant.com writes: On 2014-01-28 11:14:49 -0500, Bruce Momjian wrote: OK, so does anyone object to removing this comment line? Let's just not do anything. This is change for changes sake. Not improving anything the slightest. Indeed. I'd actually request that you revert your previous change to the comment, as it didn't improve matters and is only likely to cause pain for future back-patching. OK, so we have a don't change anything and a revert. I am thinking the new wording as a super-minor improvement. Anyone else want to vote? I vote to revert to the original and can we please wait for longer than a few hours on a weekend before applying this kind of change that is obviously not without controversy. OK, reverted. I have to question how well-balanced we are when a word change in a C comment can cause so much contention. -- Bruce Momjian br...@momjian.ushttp://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + -- 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] A minor correction in comment in heaptuple.c
On 2014-01-28 12:29:25 -0500, Bruce Momjian wrote: On Tue, Jan 28, 2014 at 02:25:51PM -0300, Alvaro Herrera wrote: Bruce Momjian escribió: On Tue, Jan 28, 2014 at 11:20:39AM -0500, Tom Lane wrote: Andres Freund and...@2ndquadrant.com writes: On 2014-01-28 11:14:49 -0500, Bruce Momjian wrote: OK, so does anyone object to removing this comment line? Let's just not do anything. This is change for changes sake. Not improving anything the slightest. Indeed. I'd actually request that you revert your previous change to the comment, as it didn't improve matters and is only likely to cause pain for future back-patching. OK, so we have a don't change anything and a revert. I am thinking the new wording as a super-minor improvement. Anyone else want to vote? I vote to revert to the original and can we please wait for longer than a few hours on a weekend before applying this kind of change that is obviously not without controversy. OK, reverted. I have to question how well-balanced we are when a word change in a C comment can cause so much contention. The question is rather why to do such busywork changes in the first place imo. Without ever looking at more than one a few lines up/down especially. Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training 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] ALTER TABLE lock strength reduction patch is unsafe
On 01/28/2014 07:26 PM, Bruce Momjian wrote: On Tue, Jan 28, 2014 at 07:21:50PM +0200, Heikki Linnakangas wrote: I have no problem removing the parameter if required to. In that case, I would like to leave the parameter in until mid beta, to allow greater certainty. In any case, I would wish to retain as a minimum an extern bool variable allowing it to be turned off by C function if desired. Anything changed to postgresql.conf during beta is going to require an initdb. Huh? Surely not. Uh, if we ship beta1 with a GUC in postgresql.conf, and then we remove support for the GUC in beta2, anyone starting a server initdb-ed with beta1 is going to get an error and the server is not going to start: LOG: unrecognized configuration parameter xxx in file /u/pgsql/data/postgresql.conf line 1 FATAL: configuration file /u/pgsql/data/postgresql.conf contains errors so, yeah, it isn't going to require an initdb, but it is going to require everyone to edit their postgresql.conf. Only if you uncommented the value in the first place. - Heikki -- 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] KNN-GiST with recheck
On 01/28/2014 04:12 PM, Alexander Korotkov wrote: On Tue, Jan 28, 2014 at 5:54 PM, Heikki Linnakangas hlinnakan...@vmware.com wrote: 4. (as you mentioned in the other thread: ) It's a modularity violation that you peek into the heap tuple from gist. I think the proper way to do this would be to extend the IndexScan executor node to perform the re-shuffling of tuples that come from the index in wrong order, or perhaps add a new node type for it. Of course that's exactly what your partial sort patch does :-). I haven't looked at that in detail, but I don't think the approach the partial sort patch takes will work here as is. In the KNN-GiST case, the index is returning tuples roughly in the right order, but a tuple that it returns might in reality belong somewhere later in the ordering. In the partial sort patch, the input stream of tuples is divided into non-overlapping groups, so that the tuples within the group are not sorted, but the groups are. I think the partial sort case is a special case of the KNN-GiST case, if you consider the lower bound of each tuple to be the leading keys that you don't need to sort. Yes. But, for instance btree accesses heap for unique checking. Is really it so crimilal? :-) Well, it is generally considered an ugly hack in b-tree too. I'm not 100% opposed to doing such a hack in GiST, but would very much prefer not to. This is not only question of a new node or extending existing node. We need to teach planner/executor access method can return value of some expression which is lower bound of another expression. AFICS now access method can return only original indexed datums and TIDs. So, I afraid that enormous infrastructure changes are required. And I can hardly imagine what they should look like. Yeah, I'm not sure either. Maybe a new field in IndexScanDesc, along with xs_itup. Or as an attribute of xs_itup itself. - Heikki -- 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] Performance Improvement by reducing WAL for Update Operation
I think sort by string column is lower during merge join, maybe comparing function in sort need be refined to save some cycle. It’s the hot function when do sort. Heikki Linnakangas hlinnakan...@vmware.com编写: On 01/27/2014 07:03 PM, Amit Kapila wrote: I have tried to improve algorithm in another way so that we can get benefit of same chunks during find match (something similar to lz). The main change is to consider chunks at fixed boundary (4 byte) and after finding match, try to find if there is a longer match than current chunk. While finding longer match, it still takes care that next bigger match should be at chunk boundary. I am not completely sure about the chunk boundary may be 8 or 16 can give better results. Since you're only putting a value in the history every 4 bytes, you wouldn't need to calculate the hash in a rolling fashion. You could just take next four bytes, calculate hash, put it in history table. Then next four bytes, calculate hash, and so on. Might save some cycles when building the history table... - Heikki -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers -- 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] A minor correction in comment in heaptuple.c
Bruce Momjian escribió: On Tue, Jan 28, 2014 at 11:20:39AM -0500, Tom Lane wrote: Andres Freund and...@2ndquadrant.com writes: On 2014-01-28 11:14:49 -0500, Bruce Momjian wrote: OK, so does anyone object to removing this comment line? Let's just not do anything. This is change for changes sake. Not improving anything the slightest. Indeed. I'd actually request that you revert your previous change to the comment, as it didn't improve matters and is only likely to cause pain for future back-patching. OK, so we have a don't change anything and a revert. I am thinking the new wording as a super-minor improvement. Anyone else want to vote? I vote to revert to the original and can we please wait for longer than a few hours on a weekend before applying this kind of change that is obviously not without controversy. -- Álvaro Herrerahttp://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training 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] Storing pg_stat_statements query texts externally, pg_stat_statements in core
Peter Geoghegan p...@heroku.com writes: I noticed a minor omission in the patch as committed. Attached patch corrects this. Duh. Thanks. 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
[HACKERS] GSoC 2014 - mentors, students and admins
Hi all, Application to Google Summer of Code 2014 can be made as of next Monday (3rd Feb), and then there will be a 12 day window in which to submit an application. I'd like to gauge interest from both mentors and students as to whether we'll want to do this. And I'd be fine with being admin again this year, unless there's anyone else who would like to take up the mantle? Who would be up for mentoring this year? And are there any project ideas folk would like to suggest? Thanks Thom -- 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] ALTER TABLE lock strength reduction patch is unsafe
On Tue, Jan 28, 2014 at 07:30:47PM +0200, Heikki Linnakangas wrote: On 01/28/2014 07:26 PM, Bruce Momjian wrote: On Tue, Jan 28, 2014 at 07:21:50PM +0200, Heikki Linnakangas wrote: I have no problem removing the parameter if required to. In that case, I would like to leave the parameter in until mid beta, to allow greater certainty. In any case, I would wish to retain as a minimum an extern bool variable allowing it to be turned off by C function if desired. Anything changed to postgresql.conf during beta is going to require an initdb. Huh? Surely not. Uh, if we ship beta1 with a GUC in postgresql.conf, and then we remove support for the GUC in beta2, anyone starting a server initdb-ed with beta1 is going to get an error and the server is not going to start: LOG: unrecognized configuration parameter xxx in file /u/pgsql/data/postgresql.conf line 1 FATAL: configuration file /u/pgsql/data/postgresql.conf contains errors so, yeah, it isn't going to require an initdb, but it is going to require everyone to edit their postgresql.conf. Only if you uncommented the value in the first place. Oh, I had forgotten that. Right. It would still be odd to have a commented-out line in postgresql.conf that was not support. -- Bruce Momjian br...@momjian.ushttp://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + -- 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] alternative back-end block formats
Christian Convey christian.con...@gmail.com writes: There are a couple of really huge issues that would have to be argued out before any progress could be made. Is this something that people want to spend time on right now? As I mentioned earlier, I'm game. But it doesn't sound like I'll get very far without adult supervision. TBH, I'd rather we waited till the commitfest is over. This is certainly material for 9.5, if not even further out, so there's no pressing need for a debate right now; and we have plenty of stuff we do need to deal with right now. 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] A minor correction in comment in heaptuple.c
On Tue, Jan 28, 2014 at 06:30:40PM +0100, Andres Freund wrote: OK, reverted. I have to question how well-balanced we are when a word change in a C comment can cause so much contention. The question is rather why to do such busywork changes in the first place imo. Without ever looking at more than one a few lines up/down especially. I see what you mean that the identical comment appears in the same C file. :-( -- Bruce Momjian br...@momjian.ushttp://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + -- 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] ALTER TABLE lock strength reduction patch is unsafe
Alvaro Herrera alvhe...@2ndquadrant.com writes: Honestly, I would prefer that we push a patch that has been thoroughly reviewed and in which we have more confidence, so that we can push without a GUC. This means mark in CF as needs-review, then some other developer reviews it and marks it as ready-for-committer. FWIW, that was the point I was trying to make as well ;-) 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] ALTER TABLE lock strength reduction patch is unsafe
Bruce Momjian escribió: I have no problem removing the parameter if required to. In that case, I would like to leave the parameter in until mid beta, to allow greater certainty. Uhm. If we remove a GUC during beta we don't need to force an initdb. At worst we will need to keep a no-op GUC variable that is removed in the next devel cycle. That said, if we're going to have a GUC that's going to disappear later, I think it's better to wait for 2 releases as proposed, not remove mid-beta. In any case, I would wish to retain as a minimum an extern bool variable allowing it to be turned off by C function if desired. I think this amounts to having an undocumented GUC that is hard to change. I prefer the GUC, myself. Anything changed to postgresql.conf during beta is going to require an initdb. Also, lots of backward-compatibility infrastructure, as you are suggesting above, add complexity to the system. I am basically against a GUC on this. We have far larger problems with 9.3 than backward compatibility, and limited resources. If we have a clear plan on removing the parameter, it's easy enough to follow through. I don't think lack of resources is a good argument, because at that point there will be little to discuss and it's an easy change to make. And I think the plan is clear: if no bug is found the parameter is removed. If a bug is found, it is fixed and the parameter is removed anyway. Honestly, I would prefer that we push a patch that has been thoroughly reviewed and in which we have more confidence, so that we can push without a GUC. This means mark in CF as needs-review, then some other developer reviews it and marks it as ready-for-committer. -- Álvaro Herrerahttp://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training 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] ALTER TABLE lock strength reduction patch is unsafe
On 28 January 2014 17:15, Bruce Momjian br...@momjian.us wrote: On Tue, Jan 28, 2014 at 04:36:39PM +, Simon Riggs wrote: For me, reducing the strength of DDL locking is a major change in RDBMS behaviour that could both delight and surprise our users. Maybe a few actually depend upon the locking behaviour, maybe. After some years of various people looking at this, I think we've got it right. Experience tells me that while I think this is the outcome, we are well advised to protect against the possibility that it is not correct and that if we have corner case issues, it would be good to easily disable this in the field. In the current case, a simple parameter works very well to disable the feature; in other cases, not. Summary: This is an atypical case. I do not normally propose such things - this is the third time in 10 years, IIRC. Uh, in my memory, you are the person who is most likely to suggest a GUC of all our developers. (smiles) I have suggested parameters for many features, mostly in the early days of my developments before I saw the light if autotuning. But those were control parameters for tuning features. So yes, I have probably introduced more parameters than most, amongst the many things I've done. I'm guessing you don't recall how much trouble I went to in order to allow sync rep to have only 1 parameter, c'est la vie. What I'm discussing here is a compatibility parameter to allow new features to be disabled. This would be the third time in 10 years I suggested a parameter for that reason, i.e. one that the user would hardly ever wish to set. -- Simon Riggs http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training 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] [pgsql-advocacy] GSoC 2014 - mentors, students and admins
On Tue, Jan 28, 2014 at 11:04 PM, Thom Brown t...@linux.com wrote: Hi all, Application to Google Summer of Code 2014 can be made as of next Monday (3rd Feb), and then there will be a 12 day window in which to submit an application. I'd like to gauge interest from both mentors and students as to whether we'll want to do this. And I'd be fine with being admin again this year, unless there's anyone else who would like to take up the mantle? Who would be up for mentoring this year? And are there any project ideas folk would like to suggest? Hi, I would like to bring up the addition to MADLIB algorithms again this year. Also, some work on the foreign table constraints could be helpful. Regards, Atri -- Regards, Atri *l'apprenant*
Re: [HACKERS] [pgsql-advocacy] GSoC 2014 - mentors, students and admins
On Tue, Jan 28, 2014 at 11:16 PM, Atri Sharma atri.j...@gmail.com wrote: On Tue, Jan 28, 2014 at 11:04 PM, Thom Brown t...@linux.com wrote: Hi all, Application to Google Summer of Code 2014 can be made as of next Monday (3rd Feb), and then there will be a 12 day window in which to submit an application. I'd like to gauge interest from both mentors and students as to whether we'll want to do this. And I'd be fine with being admin again this year, unless there's anyone else who would like to take up the mantle? Who would be up for mentoring this year? And are there any project ideas folk would like to suggest? Hi, I would like to bring up the addition to MADLIB algorithms again this year. Also, some work on the foreign table constraints could be helpful. Hi, Also, can we consider a project in an extension to be a project in GSoC 2014 as GSoC 2014 under PostgreSQL? I was thinking of having some support for writable FDW in JDBC_FDW, if possible. Regards, Atri -- Regards, Atri *l'apprenant*
Re: [HACKERS] ALTER TABLE lock strength reduction patch is unsafe
On 2014-01-27 15:25:22 -0500, Robert Haas wrote: On Mon, Jan 27, 2014 at 12:58 PM, Simon Riggs si...@2ndquadrant.com wrote: This version adds a GUC called ddl_exclusive_locks which allows us to keep the 9.3 behaviour if we wish it. Some people may be surprised that their programs don't wait in the same places they used to. We hope that is a positive and useful behaviour, but it may not always be so. I'll commit this on Thurs 30 Jan unless I hear objections. I haven't reviewed the patch, but -1 for adding a GUC. Dito. I don't think the patch in a bad shape otherwise. I'd very quickly looked at a previous version and it did look rather sane, and several other people had looked at earlier versions as well. IIRC Noah had a fairly extensive look at some intricate race conditions... Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training 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] ALTER TABLE lock strength reduction patch is unsafe
On 28 January 2014 17:21, Heikki Linnakangas hlinnakan...@vmware.com wrote: I don't understand why anyone would want to turn this feature off, ie. require stronger locks than necessary for a DDL change. Nobody would *want* to turn it off. They might need to, as explained. If we're not confident that the patch is correct, then it should not be applied. If we are confident enough to commit it, and a bug crops up later, we'll fix the bug as usual. I'd like to point out here that my own customers are already well covered by the support services we offer. They will receive any such fix very quickly. My proposal was of assistance only to those without such contracts in place, as are many of my proposals. It doesn't bother me at all if you insist it should not be added. Just choose v16 of the patch for review rather than v17. -- Simon Riggs http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training 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] jsonb and nested hstore
On Tue, Jan 28, 2014 at 10:46 AM, Andrew Dunstan and...@dunslane.net wrote: On 01/28/2014 11:29 AM, Tom Lane wrote: Andrew Dunstan and...@dunslane.net writes: The problem is not the indexterm element, it's the space that might exist outside it. Are we using block level elements like para inside entry elements anywhere else? Probably not, and I wonder why you're trying to. Whole paras inside a table entry (this is a table no?) don't sound like they are going to lead to nice-looking results. See http://developer.postgresql.org/~adunstan/functions-json.html yeah. note: I think the json documentation needs *major* overhaul. too much is going in inside the function listings where there really should be a big breakout discussing the big picture of json/jsonb with examples of various use cases. I want to give it a shot but unfortunately can not commit to do that by the end of the 'fest. merlin -- 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] Support for pg_stat_archiver view
On Tue, Jan 28, 2014 at 3:42 AM, Fujii Masao masao.fu...@gmail.com wrote: On Sat, Jan 25, 2014 at 3:19 PM, Michael Paquier michael.paqu...@gmail.com wrote: On Sat, Jan 25, 2014 at 5:41 AM, Fujii Masao masao.fu...@gmail.com wrote: On Thu, Jan 23, 2014 at 4:10 PM, Michael Paquier michael.paqu...@gmail.com wrote: On Thu, Jan 9, 2014 at 6:36 AM, Gabriele Bartolini gabriele.bartol...@2ndquadrant.it wrote: Il 08/01/14 18:42, Simon Riggs ha scritto: Not sure I see why it needs to be an SRF. It only returns one row. Attached is version 4, which removes management of SRF stages. I have been looking at v4 a bit more, and found a couple of small things: - a warning in pgstatfuncs.c - some typos and format fixing in the sgml docs - some corrections in a couple of comments - Fixed an error message related to pg_stat_reset_shared referring only to bgwriter and not the new option archiver. Here is how the new message looks: =# select pg_stat_reset_shared('popo'); ERROR: 22023: unrecognized reset target: popo HINT: Target must be bgwriter or archiver A new version is attached containing those fixes. I played also with the patch and pgbench, simulating some archive failures and successes while running pgbench and the reports given by pg_stat_archiver were correct, so I am marking this patch as Ready for committer. I refactored the patch further. * Remove ArchiverStats global variable to simplify pgarch.c. * Remove stats_timestamp field from PgStat_ArchiverStats struct because it's not required. Thanks, pgstat_send_archiver is cleaner now. I have some review comments: +s.archived_wals, +s.last_archived_wal, +s.last_archived_wal_time, +s.failed_attempts, +s.last_failed_wal, +s.last_failed_wal_time, The column names of pg_stat_archiver look not consistent at least to me. What about the followings? archive_count last_archived_wal last_archived_time fail_count last_failed_wal last_failed_time And what about archived_count and failed_count instead of respectively archive_count and failed_count? The rest of the names are better now indeed. I think that it's time to rename all the variables related to pg_stat_bgwriter. For example, it's better to change PgStat_GlobalStats to PgStat_Bgwriter. I think that it's okay to make this change as separate patch, though. Yep, this is definitely a different patch. +char last_archived_wal[MAXFNAMELEN];/* last WAL file archived */ +TimestampTz last_archived_wal_timestamp;/* last archival success */ +PgStat_Counter failed_attempts; +char last_failed_wal[MAXFNAMELEN];/* last WAL file involved in failure */ Some hackers don't like the increase of the size of the statsfile. In order to reduce the size as much as possible, we should use the exact size of WAL file here instead of MAXFNAMELEN? The first versions of the patch used a more limited size length more inline with what you say: +#define MAX_XFN_CHARS40 But this is inconsistent with xlog_internal.h. Using MAX_XFN_CHARS instead of MAXFNAMELEN has a clear advantage to reduce the size of the statistics file. Though I'm not sure how much this change improve the performance of the statistics collector, basically I'd like to use MAX_XFN_CHARS here. I changed the patch in this way, fixed some existing bugs (e.g., correct the column names of pg_stat_archiver in rules.out), and then just committed it. Regards, -- Fujii Masao -- 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] Support for pg_stat_archiver view
Anybody knows about this patch? http://www.postgresql.org/message-id/508dfec9.4020...@uptime.jp -- Álvaro Herrerahttp://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training 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] jsonb and nested hstore
On 01/28/2014 09:58 AM, Merlin Moncure wrote: yeah. note: I think the json documentation needs *major* overhaul. too much is going in inside the function listings where there really should be a big breakout discussing the big picture of json/jsonb with examples of various use cases. I want to give it a shot but unfortunately can not commit to do that by the end of the 'fest. FWIW, I've promised Andrew that I'll overhaul this by the end of beta. Given that we have all of beta for doc refinements. In addition to this, the JSON vs JSONB datatype page really needs expansion and clarification. -- 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] new json funcs
On 01/27/2014 01:06 PM, Alvaro Herrera wrote: Andrew Dunstan escribió: I'm not sure I understand the need. This is the difference between the _text variants and their parents. Why would you call json_object_field when you want the dequoted text? Because I first need to know its type. Sometimes it's an array, or an object, or a boolean, and for those I won't call the _text version afterwards but just use the original. It would make more sense to extract them as JSON, check the type, and convert. -- 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
[HACKERS] Weird error messages from Windows upon client death
On windows, if the client gets terminated while sending data to the server, in a COPY for example, it results in some rather head-scratcher messages in the server log, for example: LOG: could not receive data from client: No connection could be made because the target machine actively refused it. Since the server was reading from the client and never tries to initiate a connection, the %m part of the message is a bit baffling. The errno at this point is 10061. Googling for No connection could be made because the target machine actively refused it, I can't find any mentions for it that occur in a context in which a connection is not being attempted, except for from PostgreSQL. So I think we must be doing something wrong but I can't figure out what that would be (no strace, not gdb). Any tips on how to figure out why this is happening? I run the below, and then terminated it with a ctrl-C. This is with 9.4dev compiled with MinGW, but I've seen (unconfirmed by me) reports of the same %m from the Windows binary distribution for a production version. perl -le 'print rand() foreach 1..1000' | psql -c 'copy foo from stdin' Cheers, Jeff
Re: [HACKERS] new json funcs
Josh Berkus wrote: On 01/27/2014 01:06 PM, Alvaro Herrera wrote: Andrew Dunstan escribió: I'm not sure I understand the need. This is the difference between the _text variants and their parents. Why would you call json_object_field when you want the dequoted text? Because I first need to know its type. Sometimes it's an array, or an object, or a boolean, and for those I won't call the _text version afterwards but just use the original. It would make more sense to extract them as JSON, check the type, and convert. That's what I'm already doing. My question is how do I convert it? I have this, but would like to get rid of it: /* * dequote_jsonval * Take a string value extracted from a JSON object, and return a copy of it * with the quoting removed. * * Another alternative to this would be to run the extraction routine again, * using the _text variant which returns the value without quotes; but this * complicates the logic a lot because not all values are extracted in * the same way (some are extracted using json_object_field, others * using json_array_element). Dequoting the object already at hand is a * lot easier. */ static char * dequote_jsonval(char *jsonval) { char *result; int inputlen = strlen(jsonval); int i; int j = 0; result = palloc(strlen(jsonval) + 1); /* skip the start and end quotes right away */ for (i = 1; i inputlen - 1; i++) { /* * XXX this skips the \ in a \ sequence but leaves other escaped * sequences in place. Are there other cases we need to handle * specially? */ if (jsonval[i] == '\\' jsonval[i + 1] == '') { i++; continue; } result[j++] = jsonval[i]; } result[j] = '\0'; return result; } -- Álvaro Herrerahttp://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training 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] jsonb and nested hstore
On Tue, Jan 28, 2014 at 12:09 PM, Josh Berkus j...@agliodbs.com wrote: On 01/28/2014 09:58 AM, Merlin Moncure wrote: yeah. note: I think the json documentation needs *major* overhaul. too much is going in inside the function listings where there really should be a big breakout discussing the big picture of json/jsonb with examples of various use cases. I want to give it a shot but unfortunately can not commit to do that by the end of the 'fest. FWIW, I've promised Andrew that I'll overhaul this by the end of beta. Given that we have all of beta for doc refinements. In addition to this, the JSON vs JSONB datatype page really needs expansion and clarification. right: exactly. I'd be happy to help (such as I can) ...I wanted to see if jsonb to make it in on this 'fest (doc issues notwithstanding); it hasn't been formally reviewed yet AFAICT. So my thinking here is to get docs to minimum acceptable standards in the short term and focus on the structural code issues for the 'fest (if jsonb slips then it's moot obviously). merlin -- 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] alternative back-end block formats
On Tue, Jan 28, 2014 at 12:39 PM, Tom Lane t...@sss.pgh.pa.us wrote: TBH, I'd rather we waited till the commitfest is over. This is certainly material for 9.5, if not even further out, so there's no pressing need for a debate right now; and we have plenty of stuff we do need to deal with right now. Works for me. I'll just lurk in the meantime, and see what I can figure out. Thanks. - Christian
Re: [HACKERS] [pgsql-advocacy] GSoC 2014 - mentors, students and admins
On 01/28/2014 09:46 AM, Atri Sharma wrote: I would like to bring up the addition to MADLIB algorithms again this year. Also, some work on the foreign table constraints could be helpful. We can only take MADLIB this year if we have confirmed mentors who are MADLIB committers before the end of the application period (Feb 15). We can't have a repeat of last year. -- 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