subtransaction performance

2022-10-07 Thread Zhihong Yu
Hi, I stumbled over: https://about.gitlab.com/blog/2021/09/29/why-we-spent-the-last-month-eliminating-postgresql-subtransactions/ I wonder if SAVEPOINT / subtransaction performance has been boosted since the blog was written. Cheers

Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2022-10-11 Thread Zhihong Yu
On Tue, Oct 11, 2022 at 9:22 AM Dmitry Koval wrote: > Hi! > > Fixed couple warnings (for cfbot). > > -- > With best regards, > Dmitry Koval > > Postgres Professional: http://postgrespro.com Hi, For v12-0001-PGPRO-ALTER-TABLE-MERGE-PARTITIONS-command.patch: + if (equal(name, cmd->name)) +

Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2022-10-11 Thread Zhihong Yu
On Tue, Oct 11, 2022 at 9:58 AM Zhihong Yu wrote: > > > On Tue, Oct 11, 2022 at 9:22 AM Dmitry Koval > wrote: > >> Hi! >> >> Fixed couple warnings (for cfbot). >> >> -- >> With best regards, >> Dmitry Koval >> >> Postgres Pr

Re: Bloom filter Pushdown Optimization for Merge Join

2022-10-12 Thread Zhihong Yu
On Wed, Oct 12, 2022 at 3:36 PM Lyu Pan wrote: > Hello Zhihong Yu & Tomas Vondra, > > Thank you so much for your review and feedback! > > We made some updates based on previous feedback and attached the new > patch set. Due to time constraints, we didn't get to reso

Re: Bloom filter Pushdown Optimization for Merge Join

2022-10-13 Thread Zhihong Yu
On Wed, Oct 12, 2022 at 4:35 PM Zhihong Yu wrote: > > > On Wed, Oct 12, 2022 at 3:36 PM Lyu Pan wrote: > >> Hello Zhihong Yu & Tomas Vondra, >> >> Thank you so much for your review and feedback! >> >> We made some updates based on previous feedback

Re: Bloom filter Pushdown Optimization for Merge Join

2022-10-13 Thread Zhihong Yu
On Thu, Oct 13, 2022 at 7:30 AM Zhihong Yu wrote: > > > On Wed, Oct 12, 2022 at 4:35 PM Zhihong Yu wrote: > >> >> >> On Wed, Oct 12, 2022 at 3:36 PM Lyu Pan wrote: >> >>> Hello Zhihong Yu & Tomas Vondra, >>> >>> Thank you so mu

remove redundant memset() call

2022-10-13 Thread Zhihong Yu
Hi, I was looking at combo_init in contrib/pgcrypto/px.c . There is a memset() call following palloc0() - the call is redundant. Please see the patch for the proposed change. Thanks remove-redundant-memset-call.patch Description: Binary data

Re: remove redundant memset() call

2022-10-13 Thread Zhihong Yu
On Thu, Oct 13, 2022 at 12:10 PM Bruce Momjian wrote: > On Thu, Oct 13, 2022 at 10:55:08AM -0700, Zhihong Yu wrote: > > Hi, > > I was looking at combo_init in contrib/pgcrypto/px.c . > > > > There is a memset() call following palloc0() - the call is redundant. >

Re: Allow WindowFuncs prosupport function to use more optimal WindowClause options

2022-10-13 Thread Zhihong Yu
On Wed, Oct 12, 2022 at 5:35 PM David Rowley wrote: > On Wed, 12 Oct 2022 at 16:33, Vik Fearing wrote: > > Per spec, the ROW_NUMBER() window function is not even allowed to have a > > frame specified. > > > > b) The window framing clause of WDX shall not be present. > > > > Also, the specif

Re: PATCH: Using BRIN indexes for sorted output

2022-10-15 Thread Zhihong Yu
On Sat, Oct 15, 2022 at 5:34 AM Tomas Vondra wrote: > Hi, > > There have been a couple discussions about using BRIN indexes for > sorting - in fact this was mentioned even in the "Improving Indexing > Performance" unconference session this year (don't remember by whom). > But I haven't seen any p

Re: PATCH: Using BRIN indexes for sorted output

2022-10-15 Thread Zhihong Yu
On Sat, Oct 15, 2022 at 8:23 AM Tomas Vondra wrote: > On 10/15/22 15:46, Zhihong Yu wrote: > >... > > 8) Parallel version is not supported, but I think it shouldn't be > > possible. Just make the leader build the range info, and then let the > > wo

Re: PATCH: Using BRIN indexes for sorted output

2022-10-16 Thread Zhihong Yu
On Sun, Oct 16, 2022 at 6:51 AM Tomas Vondra wrote: > On 10/15/22 14:33, Tomas Vondra wrote: > > Hi, > > > > ... > > > > There's a bunch of issues with this initial version of the patch, > > usually described in XXX comments in the relevant places.6) > > > > ... > > I forgot to mention one import

Re: PATCH: Using BRIN indexes for sorted output

2022-10-16 Thread Zhihong Yu
On Sun, Oct 16, 2022 at 7:33 AM Tomas Vondra wrote: > > > On 10/16/22 16:01, Zhihong Yu wrote: > > > > > > On Sun, Oct 16, 2022 at 6:51 AM Tomas Vondra > > mailto:tomas.von...@enterprisedb.com>> > > wrote: > > > >

Re: Allow WindowFuncs prosupport function to use more optimal WindowClause options

2022-10-17 Thread Zhihong Yu
On Mon, Oct 17, 2022 at 5:05 PM David Rowley wrote: > Thanks for having a look at this. > > On Fri, 14 Oct 2022 at 10:52, Zhihong Yu wrote: > > + req->frameOptions = (FRAMEOPTION_ROWS | > > +FRAMEOPTION_S

Re: Missing update of all_hasnulls in BRIN opclasses

2022-10-22 Thread Zhihong Yu
Hi, Tomas: For 0002-fixup-brin-has_nulls-20221022.patch : + first_row = (bval->bv_hasnulls && bval->bv_allnulls); + + if (bval->bv_hasnulls && bval->bv_allnulls) It seems the if condition can be changed to `if (first_row)` which is more readable. Chhers

fixing typo in comment for restriction_is_or_clause

2022-10-24 Thread Zhihong Yu
Hi, When I was looking at src/backend/optimizer/util/restrictinfo.c, I found a typo in one of the comments. I also took the chance to simplify the code a little bit. Please take a look at the patch. Thanks is-or.patch Description: Binary data

Re: fixing typo in comment for restriction_is_or_clause

2022-10-24 Thread Zhihong Yu
On Mon, Oct 24, 2022 at 7:58 PM Japin Li wrote: > > On Tue, 25 Oct 2022 at 10:48, Richard Guo wrote: > > On Tue, Oct 25, 2022 at 10:05 AM John Naylor < > john.nay...@enterprisedb.com> > > wrote: > > > >> > >> On Tue, Oct 25, 2022 at 12:19 AM

Reusing return value from planner_rt_fetch

2022-10-31 Thread Zhihong Yu
Hi, I was reading examine_variable in src/backend/utils/adt/selfuncs.c It seems we already have the rte coming out of the loop which starts on line 5181. Here is a patch which reuses the return value from `planner_rt_fetch`. Please take a look. Thanks parent-rel-rte.patch Description: Binary

Re: heavily contended lwlocks with long wait queues scale badly

2022-10-31 Thread Zhihong Yu
On Mon, Oct 31, 2022 at 4:51 PM Andres Freund wrote: > Hi, > > On 2022-10-31 16:21:06 +0530, Bharath Rupireddy wrote: > > BTW, I've seen a sporadic crash (SEGV) with the patch in bg writer > > with the same set up [1], I'm not sure if it's really because of the > > patch. I'm unable to reproduce

Re: heavily contended lwlocks with long wait queues scale badly

2022-10-31 Thread Zhihong Yu
On Mon, Oct 31, 2022 at 5:19 PM Andres Freund wrote: > Hi, > > On 2022-10-31 17:17:03 -0700, Zhihong Yu wrote: > > On Mon, Oct 31, 2022 at 4:51 PM Andres Freund > wrote: > > > > > Hi, > > > > > > On 2022-10-31 16:21:06 +0530, Bharath Rupir

restoring user id and SecContext before logging error in ri_PlanCheck

2022-11-02 Thread Zhihong Yu
Hi, I was looking at the code in ri_PlanCheck of src/backend/utils/adt/ri_triggers.c starting at line 2289. When qplan is NULL, we log an error. This would skip calling SetUserIdAndSecContext(). I think the intention of the code should be restoring user id and SecContext regardless of the outcome

Re: restoring user id and SecContext before logging error in ri_PlanCheck

2022-11-02 Thread Zhihong Yu
Looking down in ri_PerformCheck(), I see there may be case where error from SPI_execute_snapshot() would skip restoring UID. Please look at patch v2 which tried to handle such case. Thanks v2-restore-uid-trigger.patch Description: Binary data

remove unnecessary assignment to tmask in DecodeDateTime

2022-11-03 Thread Zhihong Yu
Hi, I was looking at the code in DecodeDateTime() around line 1382: tmask = DTK_M(type); In case type is UNKNOWN_FIELD, the above macro would shift 1 left 31 bits which cannot be represented in type 'int'. Looking down in the same function, we can see that tmask is assigned for ev

return correct error code from pgtls_init

2021-06-01 Thread Zhihong Yu
Hi, It seems error code checking in pgtls_init() should follow the same convention as PG codebase adopts - i.e. the non-zero error code should be returned (instead of hard coded -1). Please see the attached patch. Thanks tls-init-error-handling.patch Description: Binary data

Re: return correct error code from pgtls_init

2021-06-01 Thread Zhihong Yu
On Tue, Jun 1, 2021 at 6:14 PM Michael Paquier wrote: > On Tue, Jun 01, 2021 at 10:32:59AM -0700, Zhihong Yu wrote: > > It seems error code checking in pgtls_init() should follow the same > > convention as PG codebase adopts - i.e. the non-zero error code should be > > retu

Re: PATCH: generate fractional cheapest paths in generate_orderedappend_path

2021-06-03 Thread Zhihong Yu
On Thu, Jun 3, 2021 at 11:12 AM Tomas Vondra wrote: > Hi, > > On 6/3/21 7:17 PM, Arne Roland wrote: > > Hi, > > > > > > I haven't tested the parallel case, but I think we should sort out (3) > > get_cheapest_fractional_path_for_pathkeys as mentioned above. > > > > Not sure what you refer to by "a

Re: PATCH: generate fractional cheapest paths in generate_orderedappend_path

2021-06-03 Thread Zhihong Yu
On Thu, Jun 3, 2021 at 1:50 PM Zhihong Yu wrote: > > > On Thu, Jun 3, 2021 at 11:12 AM Tomas Vondra < > tomas.von...@enterprisedb.com> wrote: > >> Hi, >> >> On 6/3/21 7:17 PM, Arne Roland wrote: >> > Hi, >> > >> > >>

checking return value from unlink in write_relcache_init_file

2021-06-03 Thread Zhihong Yu
Hi, I was looking at write_relcache_init_file() where an attempt is made to unlink the tempfilename. However, the return value is not checked. If the tempfilename is not removed (the file exists), I think we should log a warning and proceed. Please comment on the proposed patch. Thanks check-u

Re: checking return value from unlink in write_relcache_init_file

2021-06-03 Thread Zhihong Yu
On Thu, Jun 3, 2021 at 6:16 PM Tom Lane wrote: > Alvaro Herrera writes: > > On 2021-Jun-03, Tom Lane wrote: > >> If the unlink fails, there's only really a problem if the subsequent > >> open() fails to overwrite the file --- and that stanza is perfectly > >> capable of complaining for itself.

Re: Table AM modifications to accept column projection lists

2021-06-05 Thread Zhihong Yu
On Fri, Jun 4, 2021 at 4:14 PM Jacob Champion wrote: > On Tue, 2021-06-01 at 15:38 +0300, Aleksander Alekseev wrote: > > I came across this patch and noticed that it rotted a little, > > especially after removing inheritance_planner() in 86dc9005. I > > managed to resolve the conflicts on current

Re: alter table set TABLE ACCESS METHOD

2021-06-09 Thread Zhihong Yu
On Wed, Jun 9, 2021 at 12:31 PM Jeff Davis wrote: > On Wed, 2021-06-09 at 13:47 +0900, Michael Paquier wrote: > > There is a mix of upper and lower-case characters here. It could be > > more consistent. It seems to me that this test should actually check > > that pg_class.relam reflects the new

Re: Multi-Column List Partitioning

2021-06-11 Thread Zhihong Yu
On Thu, Jun 10, 2021 at 8:38 PM Amit Langote wrote: > Hi Nitin, > > On Thu, Jun 3, 2021 at 11:45 PM Nitin Jadhav > wrote: > > > I'll wait for you to post a new patch addressing at least the comments > > > in my earlier email. Also, please make sure to run `make check` > > > successfully before

Re: Add client connection check during the execution of the query

2021-06-12 Thread Zhihong Yu
On Fri, Jun 11, 2021 at 9:24 PM Thomas Munro wrote: > On Fri, Apr 30, 2021 at 2:23 PM Thomas Munro > wrote: > > Here's something I wanted to park here to look into for the next > > cycle: it turns out that kqueue's EV_EOF flag also has the right > > semantics for this. That leads to the idea o

Re: Use pg_nextpower2_* in a few more places

2021-06-12 Thread Zhihong Yu
On Sat, Jun 12, 2021 at 5:32 AM David Rowley wrote: > Back in f0705bb62, we added pg_nextpower2_32 and pg_nextpower2_64 to > efficiently obtain the next power of 2 of a given number using an > intrinsic function to find the left-most 1 bit. > > In d025cf88b and 02a2e8b44, I added some usages of t

Re: Use pg_nextpower2_* in a few more places

2021-06-12 Thread Zhihong Yu
On Sat, Jun 12, 2021 at 6:40 AM David Rowley wrote: > Thanks for having a look. > > On Sun, 13 Jun 2021 at 00:50, Zhihong Yu wrote: > > - newalloc = Max(LWLockTrancheNamesAllocated, 8); > > - while (newalloc <= tranche_id) > > - newal

Re: Use pg_nextpower2_* in a few more places

2021-06-12 Thread Zhihong Yu
On Sat, Jun 12, 2021 at 7:35 AM David Rowley wrote: > On Sun, 13 Jun 2021 at 02:08, Zhihong Yu wrote: > > Maybe add an assertion after the assignment, that newalloc >= > LWLockTrancheNamesAllocated. > > I don't quite see how it would be possible for that to ever f

Re: unnesting multirange data types

2021-06-13 Thread Zhihong Yu
On Sat, Jun 12, 2021 at 4:58 PM Alexander Korotkov wrote: > On Sun, Jun 13, 2021 at 1:16 AM Jonathan S. Katz > wrote: > > On 6/12/21 5:57 PM, Alexander Korotkov wrote: > > > On Sat, Jun 12, 2021 at 2:44 AM Alexander Korotkov < > aekorot...@gmail.com> wrote: > > >> ()On Sat, Jun 12, 2021 at 2:30

Re: unnesting multirange data types

2021-06-13 Thread Zhihong Yu
On Sun, Jun 13, 2021 at 2:10 PM Alexander Korotkov wrote: > On Sun, Jun 13, 2021 at 5:53 PM Zhihong Yu wrote: > > + ObjectAddress myself, > > > > nit: myself -> self > > Probably "self" is a better name than "myself" in this context. > H

Re: Use extended statistics to estimate (Var op Var) clauses

2021-06-13 Thread Zhihong Yu
On Sun, Jun 13, 2021 at 1:29 PM Tomas Vondra wrote: > Hi, > > Here is a slightly updated version of the patch - rebased to current > master and fixing some minor issues to handle expressions (and not just > the Var nodes as before). > > The changes needed to support (Expr op Expr) are mostly mech

Re: A qsort template

2021-06-16 Thread Zhihong Yu
On Tue, Jun 15, 2021 at 10:55 PM Thomas Munro wrote: > On Mon, Mar 15, 2021 at 1:09 PM Thomas Munro > wrote: > > On Sun, Mar 14, 2021 at 5:03 PM Zhihong Yu wrote: > > > + * Remove duplicates from an array. Return the new size. > > > + */ > > > +ST_SCOPE

Re: A qsort template

2021-06-16 Thread Zhihong Yu
On Wed, Jun 16, 2021 at 2:54 PM Thomas Munro wrote: > Hi Zhihong, > > On Thu, Jun 17, 2021 at 8:13 AM Zhihong Yu wrote: > > In 0001-Add-bsearch-and-unique-templates-to-sort_template.h.patch : > > > > - const ST_ELEMENT

Re: Centralizing protective copying of utility statements

2021-06-16 Thread Zhihong Yu
On Wed, Jun 16, 2021 at 6:40 PM Tom Lane wrote: > I haven't pushed my quick-hack fix for bug #17053 ([1]) because > I wasn't really satisfied with band-aiding that problem in one > more place. I took a look around to see if we could protect > against the whole class of scribble-on-a-utility-stat

Re: Skip partition tuple routing with constant partition key

2021-06-16 Thread Zhihong Yu
On Wed, Jun 16, 2021 at 9:29 PM Amit Langote wrote: > On Wed, Jun 16, 2021 at 4:27 PM Amit Langote > wrote: > > On Mon, Jun 7, 2021 at 8:38 PM houzj.f...@fujitsu.com > > wrote: > > > The rough idea is to check the average batch number every 1000 rows. > > > If the average batch num is greater t

Re: Skip partition tuple routing with constant partition key

2021-06-17 Thread Zhihong Yu
On Wed, Jun 16, 2021 at 10:37 PM Amit Langote wrote: > Hi, > > Thanks for reading the patch. > > On Thu, Jun 17, 2021 at 1:46 PM Zhihong Yu wrote: > > On Wed, Jun 16, 2021 at 9:29 PM Amit Langote > wrote: > >> Attached a slightly revised version of that patch

Re: Speed up transaction completion faster after many relations are accessed in a transaction

2021-06-20 Thread Zhihong Yu
On Sun, Jun 20, 2021 at 6:56 AM David Rowley wrote: > On Wed, 14 Aug 2019 at 19:25, David Rowley > wrote: > > For now, I'm out of ideas. If anyone else feels like suggesting > > something of picking this up, feel free. > > This is a pretty old thread, so we might need a recap: > > # Recap > > Ba

Re: [bug?] Missed parallel safety checks, and wrong parallel safety

2021-06-23 Thread Zhihong Yu
On Wed, Jun 23, 2021 at 8:10 PM Amit Kapila wrote: > On Wed, Jun 16, 2021 at 6:10 PM houzj.f...@fujitsu.com > wrote: > > > > On Tuesday, June 15, 2021 10:01 PM Robert Haas > wrote: > > > > > > Now, maybe it could be done, and I think that's worth a little more > thought. For > > > example, perh

Re: Rename of triggers for partitioned tables

2021-06-26 Thread Zhihong Yu
On Sat, Jun 26, 2021 at 10:08 AM Arne Roland wrote: > *From:* Alvaro Herrera > *Sent:* Saturday, June 26, 2021 18:36 > *Subject:* Re: Rename of triggers for partitioned tables > > > I'll have a look during the commitfest which starts late next week. > > Thank you! > > > (However, I'm fairly sure

Re: Rename of triggers for partitioned tables

2021-06-28 Thread Zhihong Yu
On Mon, Jun 28, 2021 at 11:45 AM Arne Roland wrote: > Hi, > > *From:* Zhihong Yu > *Sent:* Monday, June 28, 2021 15:28 > *Subject:* Re: Rename of triggers for partitioned tables > > > -void *arg) > > +callbackForRenameTr

Re: Have I found an interval arithmetic bug?

2021-06-29 Thread Zhihong Yu
On Fri, May 7, 2021 at 7:42 PM Bruce Momjian wrote: > On Fri, May 7, 2021 at 07:39:31PM -0700, Zhihong Yu wrote: > > > > > > On Fri, May 7, 2021 at 7:23 PM Bruce Momjian wrote: > > > > On Fri, May 7, 2021 at 07:23:42PM -0700, Zhihong Yu wrote: > >

Re: Partitioned index can be not dumped

2021-06-30 Thread Zhihong Yu
On Wed, Jun 30, 2021 at 11:54 AM Álvaro Herrera wrote: > On 2021-Jun-30, Alexander Pyhalov wrote: > > > I've seen the following effect on PostgreSQL 14 stable branch. > > Index, created on partitioned table, disappears from pg_dump or psql \d > > output. > > This seems to begin after analyze. Par

Re: Partitioned index can be not dumped

2021-06-30 Thread Zhihong Yu
On Wed, Jun 30, 2021 at 2:32 PM Álvaro Herrera wrote: > On 2021-Jun-30, Zhihong Yu wrote: > > > Hi, > > nit: > > - if (hasindex) > > + if (nindexes > 0) > > > > It seems hasindex is no longer needed since nindexes is checked. > >

Re: Using each rel as both outer and inner for JOIN_ANTI

2021-07-01 Thread Zhihong Yu
On Thu, Jul 1, 2021 at 8:24 PM Richard Guo wrote: > > On Thu, Jul 1, 2021 at 3:18 PM Ronan Dunklau > wrote: > >> Le jeudi 1 juillet 2021, 09:09:38 CEST Ronan Dunklau a écrit : >> > > Yes, thanks! I was making a big mistake here thinking the executor can >> > > stop after the first match. That's

Removing redundant check for transaction in progress in check_safe_enum_use

2021-07-03 Thread Zhihong Yu
Hi, I was looking at : Relax transactional restrictions on ALTER TYPE ... ADD VALUE (redux). In check_safe_enum_use(): + if (!TransactionIdIsInProgress(xmin) && + TransactionIdDidCommit(xmin)) + return; Since the condition would be true only when TransactionIdDidCommit() returns tr

Re: Asymmetric partition-wise JOIN

2021-07-05 Thread Zhihong Yu
On Mon, Jul 5, 2021 at 2:57 AM Andrey Lepikhov wrote: > On 18/6/21 15:02, Alexander Pyhalov wrote: > > Andrey Lepikhov писал 2021-05-27 07:27: > >> Next version of the patch. > >> For searching any problems I forced this patch during 'make check' > >> tests. Some bugs were found and fixed. > > >

Re: Numeric x^y for negative x

2021-07-07 Thread Zhihong Yu
On Wed, Jul 7, 2021 at 10:37 AM Dean Rasheed wrote: > On Thu, 1 Jul 2021 at 14:17, Dean Rasheed > wrote: > > > > On Tue, 29 Jun 2021 at 12:08, Dean Rasheed > wrote: > > > > > > Numeric x^y is supported for x < 0 if y is an integer, but this > > > currently fails if y is outside the range of an

Re: Have I found an interval arithmetic bug?

2021-07-08 Thread Zhihong Yu
On Wed, Jun 30, 2021 at 9:35 AM Bruce Momjian wrote: > On Tue, Jun 29, 2021 at 06:49:45PM +0200, Daniel Gustafsson wrote: > > > On 29 Jun 2021, at 18:50, Zhihong Yu wrote: > > > > > Now that PG 15 is open for commit, do you think the patch can land ? > > >

short circuit suggestion in find_hash_columns()

2021-07-09 Thread Zhihong Yu
Hi, I was looking at find_hash_columns() in nodeAgg.c It seems the first loop tries to determine the max column number needed, along with whether all columns are needed. The loop can be re-written as shown in the patch. In normal cases, we don't need to perform scanDesc->natts iterations. In bes

Re: short circuit suggestion in find_hash_columns()

2021-07-09 Thread Zhihong Yu
On Fri, Jul 9, 2021 at 8:28 AM David Rowley wrote: > On Sat, 10 Jul 2021 at 03:15, Zhihong Yu wrote: > > I was looking at find_hash_columns() in nodeAgg.c > > > > It seems the first loop tries to determine the max column number needed, > along with whether all columns

Re: Removing unneeded self joins

2022-05-13 Thread Zhihong Yu
Hi, w.r.t. v33-0001-Remove-self-joins.patch : removes inner join of plane table -> removes inner join of plain table in an query plan -> in a query plan + * Used as the relation_has_unique_index_for, Since relation_has_unique_index_for() becomes a wrapper of relation_has_unique_index_ext, the ab

Re: ALTER TABLE SET ACCESS METHOD on partitioned tables

2022-05-18 Thread Zhihong Yu
Hi, + tup = SearchSysCache1(RELOID, ObjectIdGetDatum(relid)); + accessMethodId = ((Form_pg_class) GETSTRUCT(tup))->relam; - /* look up the access method, verify it is for a table */ - if (accessMethod != NULL) - accessMethodId = get_table_am_oid(accessMethod, false); +

Re: ALTER TABLE SET ACCESS METHOD on partitioned tables

2022-05-18 Thread Zhihong Yu
On Wed, May 18, 2022 at 5:49 PM Soumyadeep Chakraborty < soumyadeep2...@gmail.com> wrote: > > On Wed, May 18, 2022 at 4:14 PM Justin Pryzby > wrote: > > > I didn't look closely yet, but this comment is wrong: > > > > + * Since these have no storage the tablespace can be updated with a > simple >

check for null value before looking up the hash function

2022-05-20 Thread Zhihong Yu
Hi, I was looking at the code in hash_record() of src/backend/utils/adt/rowtypes.c It seems if nulls[i] is true, we don't need to look up the hash function. Please take a look at the patch. Thanks hash-record-check-null-first.patch Description: Binary data

adding status for COPY progress report

2022-05-24 Thread Zhihong Yu
Hi, Please see attached for enhancement to COPY command progress. The added status column would allow users to get the status of the most recent COPY command. Below is sample output. Thanks yugabyte=# SELECT relid::regclass, command, status, yugabyte-# type, bytes_processed, bytes_tot

Re: adding status for COPY progress report

2022-05-24 Thread Zhihong Yu
Hi, Here is the updated patch. Cheers On Tue, May 24, 2022 at 10:18 AM Zhihong Yu wrote: > Hi, > Please see attached for enhancement to COPY command progress. > > The added status column would allow users to get the status of the most > recent COPY command. > > B

Re: adding status for COPY progress report

2022-05-24 Thread Zhihong Yu
On Tue, May 24, 2022 at 12:37 PM Matthias van de Meent < boekewurm+postg...@gmail.com> wrote: > On Tue, 24 May 2022 at 19:13, Zhihong Yu wrote: > > > > Hi, > > Please see attached for enhancement to COPY command progress. > > > > The added status column wou

Re: enable/disable broken for statement triggers on partitioned tables

2022-05-24 Thread Zhihong Yu
Hi, AT_EnableTrig, /* ENABLE TRIGGER name */ + AT_EnableTrigRecurse, /* internal to commands/tablecmds.c */ AT_EnableAlwaysTrig,/* ENABLE ALWAYS TRIGGER name */ + AT_EnableAlwaysTrigRecurse, /* internal to commands/tablecmds.c */ Is it better to put the new

Re: adding status for COPY progress report

2022-05-24 Thread Zhihong Yu
On Tue, May 24, 2022 at 2:12 PM Matthias van de Meent < boekewurm+postg...@gmail.com> wrote: > On Tue, 24 May 2022 at 22:12, Zhihong Yu wrote: > > > > On Tue, May 24, 2022 at 12:37 PM Matthias van de Meent < > boekewurm+postg...@gmail.com> wrote: > >> >

Re: adding status for COPY progress report

2022-05-25 Thread Zhihong Yu
On Tue, May 24, 2022 at 3:02 PM Zhihong Yu wrote: > > > On Tue, May 24, 2022 at 2:12 PM Matthias van de Meent < > boekewurm+postg...@gmail.com> wrote: > >> On Tue, 24 May 2022 at 22:12, Zhihong Yu wrote: >> > >> > On Tue, May 24, 2022 at 12:37

Re: adding status for COPY progress report

2022-05-25 Thread Zhihong Yu
On Wed, May 25, 2022 at 3:55 AM Matthias van de Meent < boekewurm+postg...@gmail.com> wrote: > On Wed, 25 May 2022 at 10:15, Zhihong Yu wrote: > > > > Hi, > > Patch v3 follows advice from Matthias (status field has been dropped). > > Could you argue why you think

Re: adding status for COPY progress report

2022-05-25 Thread Zhihong Yu
On Wed, May 25, 2022 at 8:20 AM Matthias van de Meent < boekewurm+postg...@gmail.com> wrote: > On Wed, 25 May 2022 at 16:32, Zhihong Yu wrote: > > > > On Wed, May 25, 2022 at 3:55 AM Matthias van de Meent < > boekewurm+postg...@gmail.com> wrote: > >> > &

Re: adding status for COPY progress report

2022-05-25 Thread Zhihong Yu
On Wed, May 25, 2022 at 5:51 PM Michael Paquier wrote: > On Wed, May 25, 2022 at 09:34:51AM -0700, Zhihong Yu wrote: > > Let's look at the sequences of user activity for long running COPY > command. > > The user would likely issue queries to pg_stat_progress_copy over tim

Re: generic plans and "initial" pruning

2022-05-27 Thread Zhihong Yu
On Fri, May 27, 2022 at 1:10 AM Amit Langote wrote: > On Mon, Apr 11, 2022 at 12:53 PM Zhihong Yu wrote: > > On Sun, Apr 10, 2022 at 8:05 PM Amit Langote > wrote: > >> Sending v15 that fixes that to keep the cfbot green for now. > > > > Hi, > > > >

Re: adding status for COPY progress report

2022-05-31 Thread Zhihong Yu
On Tue, May 31, 2022 at 1:20 AM Amit Langote wrote: > Hi, > > On Thu, May 26, 2022 at 11:35 AM Zhihong Yu wrote: > >> The changes in pgstat_progress_end_command() and > >> pg_stat_get_progress_info() update st_progress_command_target > >> depending on the

Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2022-05-31 Thread Zhihong Yu
On Tue, May 31, 2022 at 12:43 PM Dmitry Koval wrote: > >Just out of curiosity, why is SPLIT / MERGE support not included for > >HASH partitions? Because sibling partitions can have a different > >modulus, you should be able to e.g. split a partition with (modulus, > >remainder) of (3, 1) into

Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2022-05-31 Thread Zhihong Yu
On Tue, May 31, 2022 at 1:43 PM Zhihong Yu wrote: > > > On Tue, May 31, 2022 at 12:43 PM Dmitry Koval > wrote: > >> >Just out of curiosity, why is SPLIT / MERGE support not included for >> >HASH partitions? Because sibling partitions can have a different &g

Re: silence compiler warning in brin.c

2022-06-01 Thread Zhihong Yu
On Wed, Jun 1, 2022 at 9:35 AM Nathan Bossart wrote: > Hi hackers, > > I'm seeing a compiler warning in brin.c with an older version of gcc. > Specifically, it seems worried that a variable might not be initialized. > AFAICT there is no real risk, so I've attached a small patch to silence the > w

Re: silence compiler warning in brin.c

2022-06-01 Thread Zhihong Yu
On Wed, Jun 1, 2022 at 10:06 AM Tom Lane wrote: > Zhihong Yu writes: > > On Wed, Jun 1, 2022 at 9:35 AM Nathan Bossart > > wrote: > >> I'm seeing a compiler warning in brin.c with an older version of gcc. > >> Specifically, it seems worried that a variable

Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2022-06-01 Thread Zhihong Yu
On Wed, Jun 1, 2022 at 11:58 AM Dmitry Koval wrote: > Hi, > > 1) > > For attachPartTable, the parameter wqueue is missing from comment. > > The parameters of CloneRowTriggersToPartition are called parent and > partition. > > I think it is better to name the parameters to attachPartTable in a > si

showing effective max_connections

2022-06-01 Thread Zhihong Yu
Hi, For non superusers, the max connections would be lower than what max_connections specifies. Should we display the effective value when non superuser issues `SHOW max_connections` ? Thanks

Re: Defer selection of asynchronous subplans until the executor initialization stage

2022-06-02 Thread Zhihong Yu
On Thu, Jun 2, 2022 at 5:08 AM Etsuro Fujita wrote: > On Wed, Apr 6, 2022 at 3:58 PM Etsuro Fujita > wrote: > > I have committed the patch after modifying it as such. > > The patch calls trivial_subqueryscan() during create_append_plan() to > determine the triviality of a SubqueryScan that is a

Re: [PATCH] Optimize json_lex_string by batching character copying

2022-06-24 Thread Zhihong Yu
Hi, Looking at the patch, + if (copyable_characters_length) + { + /* flush copyable characters */ + appendBinaryStringInfo( + lex->strval, + s - copyable_characters_length, +

Re: pgsql: dshash: Add sequential scan support.

2022-07-04 Thread Zhihong Yu
On Sun, Jul 3, 2022 at 7:56 PM Thomas Munro wrote: > [Re-directing to -hackers] > > On Fri, Mar 11, 2022 at 2:27 PM Andres Freund wrote: > > On 2022-03-10 20:09:56 -0500, Tom Lane wrote: > > > Andres Freund writes: > > > > dshash: Add sequential scan support. > > > > Add ability to scan all ent

Re: Patch proposal: New hooks in the connection path

2022-07-04 Thread Zhihong Yu
On Mon, Jul 4, 2022 at 5:54 AM Drouvot, Bertrand wrote: > Hi, > > On 7/2/22 1:00 AM, Nathan Bossart wrote: > > Could we model this after fmgr_hook? The first argument in that hook > > indicates where it is being called from. This doesn't alleviate the need > > for several calls to the hook in t

Re: Removing unneeded self joins

2022-07-04 Thread Zhihong Yu
On Mon, Jul 4, 2022 at 6:52 AM Ronan Dunklau wrote: > Le jeudi 30 juin 2022, 16:11:51 CEST Andrey Lepikhov a écrit : > > On 19/5/2022 16:47, Ronan Dunklau wrote: > > > I'll take a look at that one. > > > > New version of the patch, rebased on current master: > > 1. pgindent over the patch have pa

Re: Bugs in copyfuncs/equalfuncs support for JSON node types

2022-07-04 Thread Zhihong Yu
On Mon, Jul 4, 2022 at 6:23 PM Tom Lane wrote: > In reviewing Peter's patch to auto-generate the backend/nodes > support files, I compared what the patch's script produces to > what is in the code now. I found several discrepancies in the > recently-added parse node types for JSON functions, and

index for inet column

2022-07-07 Thread Zhihong Yu
Hi, I was able to create gin index on inet column in PG. GIN is good with points/elements in sets. Is gin a good index for inet column ? It seems gist index would be better. Comments are welcome.

Aggregate leads to superfluous projection from the scan

2022-07-08 Thread Zhihong Yu
Hi, Here is the query which involves aggregate on a single column: https://dbfiddle.uk/?rdbms=postgres_13&fiddle=44bfd8f6b6b5aad34d00d449c04c5a96 As you can see from `Output:`, there are many columns added which are not needed by the query executor. I wonder if someone has noticed this in the pa

Re: Aggregate leads to superfluous projection from the scan

2022-07-08 Thread Zhihong Yu
On Fri, Jul 8, 2022 at 9:40 AM Zhihong Yu wrote: > Hi, > Here is the query which involves aggregate on a single column: > > > https://dbfiddle.uk/?rdbms=postgres_13&fiddle=44bfd8f6b6b5aad34d00d449c04c5a96 > > As you can see from `Output:`, there are many columns added

Re: Aggregate leads to superfluous projection from the scan

2022-07-08 Thread Zhihong Yu
On Fri, Jul 8, 2022 at 12:30 PM Tom Lane wrote: > Ibrar Ahmed writes: > > I give a quick look and I think in case whenever data is extracted from > the > > heap it shows all the columns. Therefore when columns are extracted from > > the index only it shows the indexed column only. > > This is op

Re: Aggregate leads to superfluous projection from the scan

2022-07-08 Thread Zhihong Yu
On Fri, Jul 8, 2022 at 12:48 PM Zhihong Yu wrote: > > > On Fri, Jul 8, 2022 at 12:30 PM Tom Lane wrote: > >> Ibrar Ahmed writes: >> > I give a quick look and I think in case whenever data is extracted from >> the >> > heap it shows all the columns.

Re: Making the subquery alias optional in the FROM clause

2022-07-09 Thread Zhihong Yu
On Sat, Jul 9, 2022 at 3:28 AM Dean Rasheed wrote: > On Wed, 6 Jul 2022 at 15:09, Dean Rasheed > wrote: > > > > I'll post an update in a little while, but first, I found a bug, which > > revealed a pre-existing bug in transformLockingClause(). I'll start a > > new thread for that, since it'd be

Re: Making the subquery alias optional in the FROM clause

2022-07-09 Thread Zhihong Yu
On Sat, Jul 9, 2022 at 5:18 AM Dean Rasheed wrote: > On Sat, 9 Jul 2022 at 12:24, Zhihong Yu wrote: > > > > It seems the code would be more readable if you keep the assignment in > else block below: > > > > + else if

Re: Making Vars outer-join aware

2022-07-10 Thread Zhihong Yu
On Sun, Jul 10, 2022 at 12:39 PM Tom Lane wrote: > Here's v2 of this patch series. It's functionally identical to v1, > but I've rebased it over the recent auto-node-support-generation > changes, and also extracted a few separable bits in hopes of making > the main planner patch smaller. (It's

Re: should check interrupts in BuildRelationExtStatistics ?

2022-07-12 Thread Zhihong Yu
On Tue, Jul 12, 2022 at 1:31 PM Tom Lane wrote: > I wrote: > > Thomas Munro writes: > >> On Wed, Jul 6, 2022 at 11:37 AM Tom Lane wrote: > >>> qsort_interruptible > > >> +1 > > > So here's a patch that does it that way. > > Hearing no comments, pushed. > > regards, tom l

Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2022-07-13 Thread Zhihong Yu
On Wed, Jul 13, 2022 at 11:28 AM Dmitry Koval wrote: > Hi! > > Patch stop applying due to changes in upstream. > Here is a rebased version. > > -- > With best regards, > Dmitry Koval > > Postgres Professional: http://postgrespro.com Hi, +attachPartTable(List **wqueue, Relation rel, Relation par

Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2022-07-13 Thread Zhihong Yu
On Wed, Jul 13, 2022 at 1:05 PM Dmitry Koval wrote: > Thanks you! > I've fixed all things mentioned. > > -- > With best regards, > Dmitry Koval > > Postgres Professional: http://postgrespro.com Hi, Toward the end of ATExecSplitPartition(): + /* Unlock new partition. */ + table_close

Freeing sortgroupatts in use_physical_tlist

2022-07-15 Thread Zhihong Yu
Hi, I was looking at the code in use_physical_tlist(). In the code block checking CP_LABEL_TLIST, I noticed that the Bitmapset sortgroupatts is not freed before returning from the method. Looking at create_foreignscan_plan() (in the same file): bms_free(attrs_used); It seems the interme

Re: Freeing sortgroupatts in use_physical_tlist

2022-07-15 Thread Zhihong Yu
On Fri, Jul 15, 2022 at 8:33 PM Tom Lane wrote: > Zhihong Yu writes: > > I was looking at the code in use_physical_tlist(). > > In the code block checking CP_LABEL_TLIST, I noticed that > > the Bitmapset sortgroupatts is not freed before returning from the >

potential memory leak in pg_regcomp()

2022-07-22 Thread Zhihong Yu
Hi, I was looking at pg_regcomp(): re->re_guts = VS(MALLOC(sizeof(struct guts))); I did some search trying to find where re_guts is freed but haven't found it. Can someone enlighten me? Thanks

redacting password in SQL statement in server log

2022-07-23 Thread Zhihong Yu
Hi, Currently, in situation such as duplicate role creation, the server log would show something such as the following: 2022-07-22 13:48:18.251 UTC [330] STATEMENT: CREATE ROLE test WITH LOGIN PASSWORD 'foobar'; The password itself should be redacted before logging the statement. Here is sample

<    1   2   3   4   5   6   >