Re: MERGE SQL statement for PG12 - Mailing list pgsql-hackers

From Pavan Deolasee
Subject Re: MERGE SQL statement for PG12
Date
Msg-id CABOikdPfySjjtw8aCJU=ittnmx9Co13n=XN9Da73yZX8=Bo24w@mail.gmail.com
Whole thread Raw
In response to Re: MERGE SQL statement for PG12  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: MERGE SQL statement for PG12
List pgsql-hackers

I've rebased the patch against the current master. The patch hasn't changed much since the last time.

I hope that the patch gets some review this CF so that we're left with enough time to address those reviews and get the patch committed early in the cycle. Copying Tom and Andres since they had expressed willingness to review the patch in detail when the new development cycle opens. But fresh reviews from Peter G, others is welcome too.

On Mon, Jun 25, 2018 at 11:13 PM Alvaro Herrera <alvherre@2ndquadrant.com> wrote:

Hello.  A very minor thing, please see commit 15a8f8caad14 and the
discussion that led to it.


Alvaro, thanks for the reminder. I've fixed that in the rebased patch. While working on it, I thought we should just consolidate these different counters in an array. Something like this:

+typedef enum TupleCounterType
+{
+ TUPLE_COUNTER_PROCESSED = 0,
+ TUPLE_COUNTER_CONFLICTING,
+ TUPLE_COUNTER_IOS_HEAP_FETCHES,
+ TUPLE_COUNTER_MERGE_INSERTED,
+ TUPLE_COUNTER_MERGE_UPDATED,
+ TUPLE_COUNTER_MERGE_DELETED,
+ TUPLE_COUNTER_FILTERED_BY_JOIN_QUALS,
+ TUPLE_COUNTER_FILTERED_BY_OTHER_QUALS,
+ TUPLE_COUNTER_MAX_COUNT /* should be last */
+} TupleCounterType;
+
 typedef struct Instrumentation
 {
  /* Parameters set at node creation: */
@@ -56,14 +69,9 @@ typedef struct Instrumentation
  /* Accumulated statistics across all completed cycles: */
  double startup; /* Total startup time (in seconds) */
  double total; /* Total total time (in seconds) */
- double ntuples; /* Total tuples produced */
- /* Additional node-specific tuple counters */
- double node_ntuples1;
- double node_ntuples2;
- double node_ntuples3;
+ /* Tuple counters */
+ double ntuples[TUPLE_COUNTER_MAX_COUNT];
  double nloops; /* # of run cycles for this node */
- double nfiltered1; /* # tuples removed by scanqual or joinqual */
- double nfiltered2; /* # tuples removed by "other" quals */
  BufferUsage bufusage; /* Total buffer usage */
 } Instrumentation;
 
And then have matching macros to get/set/manage those counters per type. Do you see a value in doing so?

Thanks,
Pavan

--
 Pavan Deolasee                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services
Attachment

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: pg_verify_checksums failure with hash indexes
Next
From: Pavan Deolasee
Date:
Subject: Re: Accidental removal of a file causing various problems