Skip to content

Conversation

@hatyo
Copy link
Contributor

@hatyo hatyo commented Sep 12, 2025

This restores the memoization of plan generation of both temporary and non-temporary invoked routines.

This fixes #3394.

- this works for both temporary and non-temporary functions.
@hatyo hatyo added performance Performance issues relational issues related to relational FDB labels Sep 12, 2025
@hatyo hatyo added the DO NOT MERGE do not merge label Sep 15, 2025
@hatyo hatyo force-pushed the amortize-function-pg branch from 2291afa to b6fde65 Compare October 29, 2025 14:22
@hatyo hatyo removed the DO NOT MERGE do not merge label Oct 29, 2025
@hatyo hatyo requested a review from normen662 October 29, 2025 19:10
@hatyo hatyo force-pushed the amortize-function-pg branch from 10f0ad2 to 85ec6bd Compare October 30, 2025 11:58
@github-actions
Copy link

📊 Metrics Diff Analysis Report

Summary

  • New queries: 0
  • Dropped queries: 0
  • Plan changed + metrics changed: 0
  • Plan unchanged + metrics changed: 2
ℹ️ About this analysis

This automated analysis compares query planner metrics between the base branch and this PR. It categorizes changes into:

  • New queries: Queries added in this PR
  • Dropped queries: Queries removed in this PR. These should be reviewed to ensure we are not losing coverage.
  • Plan changed + metrics changed: The query plan has changed along with planner metrics.
  • Metrics only changed: Same plan but different metrics

The last category in particular may indicate planner regressions that should be investigated.

Only Metrics Changed

These queries experienced only metrics changes without any plan changes. If these metrics have substantially changed,
then a planner change has been made which affects planner performance but does not correlate with any new outcomes,
which could indicate a regression.

Total: 2 queries

Statistical Summary (Only Metrics Changed)

task_count:

  • Average change: -6.0
  • Median change: -6
  • Standard deviation: 0.0
  • Range: -6 to -6
  • Queries changed: 2
  • No regressions! 🎉

transform_count:

  • Average change: -1.0
  • Median change: -1
  • Standard deviation: 0.0
  • Range: -1 to -1
  • Queries changed: 2
  • No regressions! 🎉

transform_yield_count:

  • Average change: -1.0
  • Median change: -1
  • Standard deviation: 0.0
  • Range: -1 to -1
  • Queries changed: 2
  • No regressions! 🎉

insert_new_count:

  • Average change: -1.0
  • Median change: -1
  • Standard deviation: 0.0
  • Range: -1 to -1
  • Queries changed: 2
  • No regressions! 🎉

Significant Regressions (Only Metrics Changed)

There were 2 outliers detected. Outlier queries have a significant regression in at least one field. Statistically, this represents either an increase of more than two standard deviations above the mean or a large absolute increase (e.g., 100).

  • yaml-tests/src/test/resources/sql-functions.metrics.yaml:98: EXPLAIN select A.col1 AS W, A.col2 AS X, B.col1 AS Y, B.col2 AS Z from f1(103, 'b') A, f1(103, 'b') B where A.col1 = B.col1
    • explain: ISCAN(T1_IDX1 <,>) | FLATMAP q0 -> { COVERING(T1_IDX1 [EQUALS promote(@c30 AS STRING), EQUALS q0.COL1] -> [COL1: KEY[1], COL2: KEY[0], COL3: KEY[2]]) | FILTER q0.COL1 LESS_THAN promote(@c28 AS LONG) AND q0.COL2 EQUALS promote(@c30 AS STRING) | FETCH AS q1 RETURN (q1.COL1 AS W, q1.COL2 AS X, q0.COL1 AS Y, q0.COL2 AS Z) }
    • task_count: 1648 -> 1642 (-6)
    • transform_count: 370 -> 369 (-1)
    • transform_yield_count: 141 -> 140 (-1)
    • insert_new_count: 252 -> 251 (-1)
  • yaml-tests/src/test/resources/sql-functions.metrics.yaml:113: EXPLAIN select A.col1 AS W, A.col2 AS X, B.col1 AS Y, B.col2 AS Z from f1(a => 103, b => 'b') A, f1(a => 103, b => 'b') B where A.col1 = B.col1
    • explain: ISCAN(T1_IDX1 <,>) | FLATMAP q0 -> { COVERING(T1_IDX1 [EQUALS promote(@c34 AS STRING), EQUALS q0.COL1] -> [COL1: KEY[1], COL2: KEY[0], COL3: KEY[2]]) | FILTER q0.COL1 LESS_THAN promote(@c30 AS LONG) AND q0.COL2 EQUALS promote(@c34 AS STRING) | FETCH AS q1 RETURN (q1.COL1 AS W, q1.COL2 AS X, q0.COL1 AS Y, q0.COL2 AS Z) }
    • task_count: 1648 -> 1642 (-6)
    • transform_count: 370 -> 369 (-1)
    • transform_yield_count: 141 -> 140 (-1)
    • insert_new_count: 252 -> 251 (-1)

@normen662 normen662 merged commit 8c089e6 into FoundationDB:main Oct 30, 2025
9 checks passed
@hatyo hatyo deleted the amortize-function-pg branch October 30, 2025 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Performance issues relational issues related to relational FDB

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reuse generated SQL functions plans

2 participants