yugabyte / yugabyte-db

YugabyteDB - the cloud native distributed SQL database for mission-critical applications.
https://www.yugabyte.com
Other
8.99k stars 1.07k forks source link

[YSQL] Explain Analyze: Display Flush Requests Only in Summary #19493

Open karthik-ramanathan-3006 opened 1 year ago

karthik-ramanathan-3006 commented 1 year ago

Jira Link: DB-8288

Description

A sample EXPLAIN output is as follows:

EXPLAIN (ANALYZE ON, DIST ON, TIMING OFF) UPDATE pkey_table SET v2 = 1 WHERE h = 1;
                                                   QUERY PLAN
-----------------------------------------------------------------------------------------------------------------
 Update on pkey_table  (cost=0.00..4.11 rows=1 width=80) (actual rows=0 loops=1)
   ->  Index Scan using pkey_table_pkey on pkey_table  (cost=0.00..4.11 rows=1 width=80) (actual rows=1 loops=1)
         Index Cond: (h = 1)
         Storage Table Read Requests: 1
         Storage Table Write Requests: 1.000
         [Storage Flush Requests: 1]                   <----- variable
 Planning Time: 0.111 ms
 Execution Time: 6.485 ms
 Storage Read Requests: 1
 Storage Write Requests: 1.000
 Catalog Read Requests: 1                             
 Catalog Write Requests: 0.000                        
 Storage Flush Requests: 1                            <------ not variable
 Peak Memory Usage: 24 kB
(13 rows)

This issue seeks to display "Flush Requests" only as part of the Explain Summary for the following two reasons:

  1. Debugging: Since write flushes are asynchronous to the control flow of query execution, sometimes the flushes are displayed as part of an execution node, while at other times, they are not. This leads to unnecessary variability while debugging.
  2. pg_regress tests: The variability of when the flushing happens leads to differences between the expected/actual output.

Related issue: #19492

Issue Type

kind/enhancement

Warning: Please confirm that this issue does not contain any sensitive information

sushantrmishra commented 1 year ago

Before making this change, It would be good to understand why Storage Flush Requests is variable.

         Storage Table Read Requests: 1
         Storage Table Write Requests: 1.000
         [Storage Flush Requests: 1]                   <----- variable