Skip to content

Commit 4720759

Browse files
committed
fix: PostgreSQL 18 fractional row counts in EXPLAIN output
Due to > Modify EXPLAIN to output fractional row counts
1 parent 8be7949 commit 4720759

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

regresql/analyze_types.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ type (
6363
SubplansRemoved int `json:"Subplans Removed,omitempty"`
6464

6565
// Row removal stats
66-
RowsRemovedByFilter int64 `json:"Rows Removed by Filter,omitempty"`
67-
RowsRemovedByIndexRecheck int64 `json:"Rows Removed by Index Recheck,omitempty"`
66+
RowsRemovedByFilter float64 `json:"Rows Removed by Filter,omitempty"`
67+
RowsRemovedByIndexRecheck float64 `json:"Rows Removed by Index Recheck,omitempty"`
6868

6969
// ANALYZE fields (only present with ANALYZE true)
7070
ActualStartupTime float64 `json:"Actual Startup Time,omitempty"`
7171
ActualTotalTime float64 `json:"Actual Total Time,omitempty"`
72-
ActualRows int64 `json:"Actual Rows,omitempty"`
73-
ActualLoops int64 `json:"Actual Loops,omitempty"`
72+
ActualRows float64 `json:"Actual Rows,omitempty"`
73+
ActualLoops float64 `json:"Actual Loops,omitempty"`
7474

7575
// BUFFERS fields (only present with BUFFERS true)
7676
SharedHitBlocks int64 `json:"Shared Hit Blocks,omitempty"`
@@ -115,8 +115,8 @@ type (
115115
NodeType string `json:"node_type"`
116116
RelationName string `json:"relation_name,omitempty"`
117117
PlanRows float64 `json:"plan_rows"`
118-
ActualRows int64 `json:"actual_rows"`
119-
ActualLoops int64 `json:"actual_loops"`
118+
ActualRows float64 `json:"actual_rows"`
119+
ActualLoops float64 `json:"actual_loops"`
120120
Ratio float64 `json:"ratio"`
121121
}
122122

@@ -133,7 +133,7 @@ type (
133133
TotalCost float64 `json:"total_cost"`
134134
ExecutionTimeMs float64 `json:"execution_time_ms"`
135135
PlanningTimeMs float64 `json:"planning_time_ms"`
136-
ActualRows int64 `json:"actual_rows"`
136+
ActualRows float64 `json:"actual_rows"`
137137

138138
// Buffer stats (root node only)
139139
SharedHitBlocks int64 `json:"shared_hit_blocks"`
@@ -212,7 +212,7 @@ func collectNodeRowEstimates(node *PlanNode, analysis *RowEstimateAnalysis) {
212212
if node.ActualLoops > 0 {
213213
ratio := 0.0
214214
if node.PlanRows > 0 {
215-
ratio = float64(node.ActualRows) / node.PlanRows
215+
ratio = node.ActualRows / node.PlanRows
216216
} else if node.ActualRows > 0 {
217217
ratio = math.Inf(1)
218218
}

0 commit comments

Comments
 (0)