{
  "version": 1,
  "source": "ExoBench dev (server 1.4.27), recorded direct calls, 2026-11-19: pitch-finder udf-roundup runs 20261119_212614_udf-post-dev (the main run, 28 blocks) and 20261119_221750_udf-post-ss-dev (the repeat of the inlining-off call, 1 block), each read from runs/<run>/calls/exobench_calls.jsonl. Added on 2026-11-20 at the author's request, from two runs that day: 20261120_161840_pg-scale-dev (2 blocks) and 20261120_162747_pg-scale-union-dev (1 block), each read the same way. Added later on 2026-11-20 at the author's request, from three more runs that day: 20261120_165401_ss-scale-timed-dev, 20261120_170109_ss-scale-timed-dev, 20261120_170218_ss-scale-timed-dev (1 block each), each read the same way. The chart ssGrowthChart80k's 40,000-line points are from a later run that day, 20261120_181410_ss-fill-dev (seq 1, 5 and 10), read the same way.",
  "note": "Supplemental data for never-ever-ever-use-udfs.mdx. Each mcp-call block is one recorded call to ExoBench dev (https://connect-dev.exobench.ai/mcp, server version 1.4.27) made on 2026-11-19 UTC by a script, with no agent in the loop, against Azure SQL Database (compatibility level 170, scalar UDF inlining on), PostgreSQL 18.7, PostgreSQL 17.12 and MySQL 8.0.39 (Aurora 3.08.0), all at their default settings. name, input and result are the recorded tool, arguments and response text, byte for byte, correlationId included; plans and timings are unedited, and the captions are authored. Each scale point ran once. SQL Server times are the Execution Time and CPU Time lines of each scale point's sqlserver_plan addition, the Execution Time being what the SQL Server cards' TIME column shows; PostgreSQL times are the plan's Execution Time; MySQL times are the second number of actual time on the EXPLAIN ANALYZE root line, while the MySQL cards' TIME column shows the call's runtimeDurationMs. The SQL Server queries call their UDFs as ${SCHEMA}.dateOr99 and ${SCHEMA}.norm_email because SQL Server requires a scalar UDF's two-part name and every ExoBench run gets a fresh schema. The chart's points are the Execution Time lines of cards ssUdfNoInline, ssUdfInlined, ssHandWritten and ssComputedColumn. Blocks by key, as run (main = 20261119_212614_udf-post-dev, repeat = 20261119_221750_udf-post-ss-dev) and seq: ssUdfNoInline repeat seq 1; ssHandWritten main seq 10; ssComputedColumn main seq 11; pg18HandWritten main seq 20; pg18ExpressionIndex main seq 21; mysqlHandWritten main seq 14; pg18EqualityPlpgsql main seq 28; ssUdfNoInlineEarlierRun main seq 5; ssUdfNoInline8kOtherDatabase main seq 6; ssCompat140 main seq 7; ssCompat140At8k main seq 8; ssUdfInlined main seq 9; pg18Plpgsql main seq 18; pg18SqlFunction main seq 19; pg18UnionAll main seq 17; pg17Plpgsql main seq 22; pg17SqlFunction main seq 23; pg17HandWritten main seq 24; pg17ExpressionIndex main seq 25; mysqlNotDeterministic main seq 12; mysqlDeterministic main seq 13; mysqlFunctionalIndex main seq 15; mysqlUnionAll main seq 16; pg18EqualityInline main seq 26; pg18EqualitySql main seq 27; pg18EqualityImmutable main seq 29; ssEqualityNoInline main seq 30; ssEqualityInlined main seq 31; mysqlEquality main seq 32. Added on 2026-11-20: three cards from recorded calls made that day the same way, with the main run's PG18 templates and queries byte for byte at new sizes (pg18HandWritten80k 20261120_161840_pg-scale-dev seq 2; pg18UnionAll80k 20261120_162747_pg-scale-union-dev seq 2; pg18ExpressionIndex800k 20261120_161840_pg-scale-dev seq 3), and the chart pgGrowthChart, whose points are the Execution Time lines of cards pg18HandWritten, pg18UnionAll and pg18ExpressionIndex up to 8,000 lines and of pg18HandWritten80k, pg18UnionAll80k and pg18ExpressionIndex800k at 80,000. Added later on 2026-11-20: three SQL Server cards from recorded calls made that day the same way, with the main run's SQL Server templates and queries byte for byte at new sizes (ssHandWritten800k 20261120_165401_ss-scale-timed-dev seq 1; ssComputedColumn800k 20261120_170109_ss-scale-timed-dev seq 1; ssUdfInlined80k 20261120_170218_ss-scale-timed-dev seq 1), and the chart ssGrowthChart80k, whose points are the Execution Time lines of cards ssUdfInlined80k, ssHandWritten800k and ssComputedColumn800k at 8,000 and 80,000 lines. Later on 2026-11-20 ssGrowthChart80k got a 40,000-line point on each line, from 20261120_181410_ss-fill-dev seq 1, 5 and 10, each on the same SQL Server database as its line's card call. Later on 2026-11-20 pgGrowthChart's x-axis went on a log scale (xScale log), with ticks at its five x values, at the author's request; its points are unchanged.",
  "blocks": {
    "ssUdfNoInline": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "SQLSERVER",
        "schemaTemplate": "CREATE TABLE contracts (id INT PRIMARY KEY, product CHAR(2) NOT NULL, expiration_date DATE NULL);\nINSERT INTO contracts (id, product, expiration_date)\nSELECT gs.value,\n       CHOOSE(gs.value % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       CASE WHEN gs.value <= 24 THEN NULL ELSE DATEADD(DAY, (gs.value - 1) / 8, CAST('2026-01-02' AS DATE)) END\nFROM GENERATE_SERIES(1, ${N}) gs;\nCREATE INDEX contracts_product_expiration ON contracts (product, expiration_date);\nCREATE TABLE contract_sheet (line_id INT PRIMARY KEY, product CHAR(2) NOT NULL, max_year DATE NOT NULL);\nINSERT INTO contract_sheet (line_id, product, max_year)\nSELECT gs.value,\n       CHOOSE(gs.value % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       DATEADD(DAY, ${N} / 8 + gs.value, CAST('2026-01-02' AS DATE))\nFROM GENERATE_SERIES(1, ${N}) gs;\nUPDATE STATISTICS contracts; UPDATE STATISTICS contract_sheet;\nCREATE FUNCTION dateOr99(@d DATE) RETURNS DATE WITH INLINE = OFF AS\nBEGIN\n    RETURN ISNULL(@d, DATEFROMPARTS(9999, 1, 1));\nEND;",
        "scalePoints": [
          {
            "N": 1000
          },
          {
            "N": 2000
          },
          {
            "N": 4000
          },
          {
            "N": 8000
          }
        ],
        "query": "SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND ${SCHEMA}.dateOr99(c.expiration_date) > cs.max_year",
        "exobenchServerVersion": "1.4.27"
      },
      "result": "{\"timestamp\":\"2026-11-19T22:19:21.134119954Z\",\"databaseType\":\"sqlserver\",\"sql\":\"SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND ${SCHEMA}.dateOr99(c.expiration_date) > cs.max_year\",\"warmCacheIterations\":0,\"compression\":\"low\",\"seed\":1379604262,\"seedSource\":\"default\",\"scalePointCount\":4,\"totalComputeSeconds\":83.23100000000001,\"results\":[{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":1000},\"output\":\"outliving\\n3000\",\"runtimeDurationMs\":370,\"rowsAreCapped\":false,\"computeSeconds\":47.243,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0.249585 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1005],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0006005 SubtreeCost=0.249585 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=337 CPUms=337)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1005\\n        Defined Values: Expr1005 = Count(*)\\n        ->  Hash Match (Inner Join)  (est Rows=1000 IO=0 CPU=0.23725 SubtreeCost=0.248985 AvgRowSize=9) (actual Rows=3000 Executions=1 Elapsedms=337 CPUms=337)\\n              Node Id: 2  Mode: Row\\n              Hash Keys Build: cs.product\\n              Hash Keys Probe: c.product\\n              Probe Residual: [contracts].[product] as [c].[product]=[contract_sheet].[product] as [cs].[product] AND [bench-azure-sql-slot-09222264-1b70-424f-bef0-3482de1f1672].[exo_temp_36a087da_a2d5_4896_b537_b6f48a84b969].[dateOr99]([contracts].[expiration_date] as [c].[expiration_date])>[contract_sheet].[max_year] as [cs].[max_year]\\n              Memory Fractions: Input=1 Output=1\\n              I/O: EndOfScans=1\\n              Memory Grant: Input=1344kB Output=1344kB Used=512kB\\n              ->  Clustered Index Scan [PK__contract__F5AE5F6261C80082] on contract_sheet cs  (est Rows=1000 RowsRead=1000 IO=0.00534722 CPU=0.001257 SubtreeCost=0.00660422 AvgRowSize=12) (actual Rows=1000 RowsRead=1000 Executions=1 Elapsedms=0 CPUms=0)\\n                    Node Id: 3  Mode: Row  Table Cardinality: 1000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=6 EndOfScans=1\\n                    Output List: cs.product, cs.max_year\\n                    Defined Values: cs.product; cs.max_year\\n              ->  Index Scan [contracts_product_expiration] on contracts c  (est Rows=1000 RowsRead=1000 IO=0.00386574 CPU=0.001257 SubtreeCost=0.00512274 AvgRowSize=12) (actual Rows=1000 RowsRead=1000 Executions=1 Elapsedms=0 CPUms=0)\\n                    Node Id: 4  Mode: Row  Table Cardinality: 1000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=4 EndOfScans=1\\n                    Output List: c.product, c.expiration_date\\n                    Defined Values: c.product; c.expiration_date\\nStatement: SELECT, optimization FULL (early abort: GoodEnoughPlanFound), CE model 170\\nQuery Plan Hash: 0x232EC548D07F2395\\nDegree Of Parallelism: 0  Non-Parallel Reason: TSQLUserDefinedFunctionsNotParallelizable\\nMemory Grant: Granted=1344kB MaxUsed=512kB Required=1024kB Desired=1344kB Requested=1344kB GrantWaitTime=0ms Feedback: No: First Execution\\nCompile: Time=12ms CPU=6ms Memory=360kB CachedPlanSize=48kB\\nCPU Time: 337 ms\\nExecution Time: 337 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]},{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":2000},\"output\":\"outliving\\n6000\",\"runtimeDurationMs\":1489,\"rowsAreCapped\":false,\"computeSeconds\":2.034,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0.874901 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1005],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0012005 SubtreeCost=0.874901 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=1464 CPUms=1345)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1005\\n        Defined Values: Expr1005 = Count(*)\\n        ->  Hash Match (Inner Join)  (est Rows=2000 IO=0 CPU=0.855321 SubtreeCost=0.873701 AvgRowSize=9) (actual Rows=6000 Executions=1 Elapsedms=1464 CPUms=1345)\\n              Node Id: 2  Mode: Row\\n              Hash Keys Build: cs.product\\n              Hash Keys Probe: c.product\\n              Probe Residual: [contracts].[product] as [c].[product]=[contract_sheet].[product] as [cs].[product] AND [bench-azure-sql-slot-09222264-1b70-424f-bef0-3482de1f1672].[exo_temp_02f8bddc_5d67_4f57_99a3_183d59a544cc].[dateOr99]([contracts].[expiration_date] as [c].[expiration_date])>[contract_sheet].[max_year] as [cs].[max_year]\\n              Memory Fractions: Input=1 Output=1\\n              I/O: EndOfScans=1\\n              Memory Grant: Input=1632kB Output=1632kB Used=512kB\\n              ->  Clustered Index Scan [PK__contract__F5AE5F6298858B22] on contract_sheet cs  (est Rows=2000 RowsRead=2000 IO=0.00831019 CPU=0.002357 SubtreeCost=0.0106672 AvgRowSize=12) (actual Rows=2000 RowsRead=2000 Executions=1 Elapsedms=0 CPUms=0)\\n                    Node Id: 3  Mode: Row  Table Cardinality: 2000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=10 EndOfScans=1\\n                    Output List: cs.product, cs.max_year\\n                    Defined Values: cs.product; cs.max_year\\n              ->  Index Scan [contracts_product_expiration] on contracts c  (est Rows=2000 RowsRead=2000 IO=0.00534722 CPU=0.002357 SubtreeCost=0.00770422 AvgRowSize=12) (actual Rows=2000 RowsRead=2000 Executions=1 Elapsedms=1 CPUms=1)\\n                    Node Id: 4  Mode: Row  Table Cardinality: 2000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=6 EndOfScans=1\\n                    Output List: c.product, c.expiration_date\\n                    Defined Values: c.product; c.expiration_date\\nStatement: SELECT, optimization FULL (early abort: GoodEnoughPlanFound), CE model 170\\nQuery Plan Hash: 0x232EC548D07F2395\\nDegree Of Parallelism: 0  Non-Parallel Reason: TSQLUserDefinedFunctionsNotParallelizable\\nMemory Grant: Granted=1632kB MaxUsed=512kB Required=1024kB Desired=1632kB Requested=1632kB GrantWaitTime=0ms Feedback: No: First Execution\\nWait Stats: SOS_SCHEDULER_YIELD WaitTimeMs=119 WaitCount=336\\nWait Stats: RESOURCE_GOVERNOR_IDLE WaitTimeMs=100 WaitCount=12\\nCompile: Time=12ms CPU=7ms Memory=368kB CachedPlanSize=48kB\\nCPU Time: 1345 ms\\nExecution Time: 1464 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]},{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":4000},\"output\":\"outliving\\n12000\",\"runtimeDurationMs\":6634,\"rowsAreCapped\":false,\"computeSeconds\":7.136,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=3.32125 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1005],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0024005 SubtreeCost=3.32125 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=6607 CPUms=5559)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1005\\n        Defined Values: Expr1005 = Count(*)\\n        ->  Hash Match (Inner Join)  (est Rows=4000 IO=0 CPU=3.28718 SubtreeCost=3.31885 AvgRowSize=9) (actual Rows=12000 Executions=1 Elapsedms=6606 CPUms=5559)\\n              Node Id: 2  Mode: Row\\n              Hash Keys Build: cs.product\\n              Hash Keys Probe: c.product\\n              Probe Residual: [contracts].[product] as [c].[product]=[contract_sheet].[product] as [cs].[product] AND [bench-azure-sql-slot-09222264-1b70-424f-bef0-3482de1f1672].[exo_temp_fa2faf46_b35e_4f8e_8cb2_0bf9faf9f4ba].[dateOr99]([contracts].[expiration_date] as [c].[expiration_date])>[contract_sheet].[max_year] as [cs].[max_year]\\n              Memory Fractions: Input=1 Output=1\\n              I/O: EndOfScans=1\\n              Memory Grant: Input=1184kB Output=1184kB Used=400kB\\n              ->  Clustered Index Scan [PK__contract__F5AE5F622C54F392] on contract_sheet cs  (est Rows=4000 RowsRead=4000 IO=0.0142361 CPU=0.004557 SubtreeCost=0.0187931 AvgRowSize=12) (actual Rows=4000 RowsRead=4000 Executions=1 Elapsedms=0 CPUms=0)\\n                    Node Id: 3  Mode: Row  Table Cardinality: 4000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=18 EndOfScans=1\\n                    Output List: cs.product, cs.max_year\\n                    Defined Values: cs.product; cs.max_year\\n              ->  Index Scan [contracts_product_expiration] on contracts c  (est Rows=4000 RowsRead=4000 IO=0.00831019 CPU=0.004557 SubtreeCost=0.0128672 AvgRowSize=12) (actual Rows=4000 RowsRead=4000 Executions=1 Elapsedms=3 CPUms=3)\\n                    Node Id: 4  Mode: Row  Table Cardinality: 4000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=10 EndOfScans=1\\n                    Output List: c.product, c.expiration_date\\n                    Defined Values: c.product; c.expiration_date\\nStatement: SELECT, optimization FULL, CE model 170\\nQuery Plan Hash: 0x232EC548D07F2395\\nDegree Of Parallelism: 0  Non-Parallel Reason: TSQLUserDefinedFunctionsNotParallelizable\\nMemory Grant: Granted=1184kB MaxUsed=400kB Required=1024kB Desired=1184kB Requested=1184kB GrantWaitTime=0ms Feedback: No: First Execution\\nWait Stats: SOS_SCHEDULER_YIELD WaitTimeMs=1052 WaitCount=1388\\nWait Stats: RESOURCE_GOVERNOR_IDLE WaitTimeMs=986 WaitCount=148\\nCompile: Time=15ms CPU=9ms Memory=352kB CachedPlanSize=48kB\\nCPU Time: 5559 ms\\nExecution Time: 6607 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]},{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":8000},\"output\":\"outliving\\n24000\",\"runtimeDurationMs\":26252,\"rowsAreCapped\":false,\"computeSeconds\":26.818,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=12.9961 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1005],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0048005 SubtreeCost=12.9961 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=26221 CPUms=21769)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1005\\n        Defined Values: Expr1005 = Count(*)\\n        ->  Hash Match (Inner Join)  (est Rows=8000 IO=0 CPU=12.9338 SubtreeCost=12.9913 AvgRowSize=9) (actual Rows=24000 Executions=1 Elapsedms=26220 CPUms=21768)\\n              Node Id: 2  Mode: Row\\n              Hash Keys Build: cs.product\\n              Hash Keys Probe: c.product\\n              Probe Residual: [contracts].[product] as [c].[product]=[contract_sheet].[product] as [cs].[product] AND [bench-azure-sql-slot-09222264-1b70-424f-bef0-3482de1f1672].[exo_temp_b6781704_4a7e_4721_8dc0_5eafcedb427e].[dateOr99]([contracts].[expiration_date] as [c].[expiration_date])>[contract_sheet].[max_year] as [cs].[max_year]\\n              Memory Fractions: Input=1 Output=1\\n              I/O: EndOfScans=1\\n              Memory Grant: Input=2368kB Output=2368kB Used=632kB\\n              ->  Clustered Index Scan [PK__contract__F5AE5F62D8EAA6B7] on contract_sheet cs  (est Rows=8000 RowsRead=8000 IO=0.026088 CPU=0.008957 SubtreeCost=0.035045 AvgRowSize=12) (actual Rows=8000 RowsRead=8000 Executions=1 Elapsedms=1 CPUms=1)\\n                    Node Id: 3  Mode: Row  Table Cardinality: 8000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=34 EndOfScans=1\\n                    Output List: cs.product, cs.max_year\\n                    Defined Values: cs.product; cs.max_year\\n              ->  Index Scan [contracts_product_expiration] on contracts c  (est Rows=8000 RowsRead=8000 IO=0.0134954 CPU=0.008957 SubtreeCost=0.0224524 AvgRowSize=12) (actual Rows=8000 RowsRead=8000 Executions=1 Elapsedms=10 CPUms=10)\\n                    Node Id: 4  Mode: Row  Table Cardinality: 8000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=17 EndOfScans=1\\n                    Output List: c.product, c.expiration_date\\n                    Defined Values: c.product; c.expiration_date\\nStatement: SELECT, optimization FULL, CE model 170\\nQuery Plan Hash: 0x232EC548D07F2395\\nDegree Of Parallelism: 0  Non-Parallel Reason: TSQLUserDefinedFunctionsNotParallelizable\\nMemory Grant: Granted=2368kB MaxUsed=632kB Required=1024kB Desired=2368kB Requested=2368kB GrantWaitTime=0ms Feedback: No: First Execution\\nWait Stats: SOS_SCHEDULER_YIELD WaitTimeMs=4469 WaitCount=5432\\nWait Stats: RESOURCE_GOVERNOR_IDLE WaitTimeMs=4226 WaitCount=684\\nCompile: Time=19ms CPU=13ms Memory=336kB CachedPlanSize=48kB\\nCPU Time: 21769 ms\\nExecution Time: 26221 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]}],\"workerId\":\"05cc57bd-70c0-47d8-aa90-ac7cc70bb462\",\"correlationId\":\"16ffa12c-5308-43fa-98ba-92f534716888\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "SQL Server (Azure SQL Database), dateOr99 set to WITH INLINE = OFF, the way every scalar UDF ran before SQL Server 2019, in the join that counts, for each sheet line, the contracts on its product that outlive its max_year: 1,000 to 8,000 sheet lines in one call on one database. The slow half of the story's before and after.",
      "planCaptions": {
        "1K": "At 1,000 sheet lines SQL Server hashes the sheet on product, probes it with every contract, and calls dateOr99 in the Probe Residual for each contract and sheet line on the same product, on database 09222264. The plan is serial, Non-Parallel Reason TSQLUserDefinedFunctionsNotParallelizable, and takes 337 ms.",
        "2K": "At 2,000 lines SQL Server runs the same Hash Match and the call takes 1,464 ms, more than four times as long as at half the size. CPU is 1,345 ms, and the plan prints its first waits, SOS_SCHEDULER_YIELD and RESOURCE_GOVERNOR_IDLE.",
        "4K": "At 4,000 lines the same serial SQL Server plan takes 6,607 ms, four and a half times as long as at half the size. CPU is 5,559 ms of it, and the SOS_SCHEDULER_YIELD waits come to 1,052 ms.",
        "8K": "At 8,000 lines SQL Server takes 26,221 ms, about four times as long as at half the size; every doubling here has roughly quadrupled the time, which follows the pairs of sheet line and contract, not the lines. CPU is 21,769 ms, and the SOS_SCHEDULER_YIELD waits reach 4,469 ms."
      }
    },
    "ssHandWritten": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "SQLSERVER",
        "schemaTemplate": "CREATE TABLE contracts (id INT PRIMARY KEY, product CHAR(2) NOT NULL, expiration_date DATE NULL);\nINSERT INTO contracts (id, product, expiration_date)\nSELECT gs.value,\n       CHOOSE(gs.value % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       CASE WHEN gs.value <= 24 THEN NULL ELSE DATEADD(DAY, (gs.value - 1) / 8, CAST('2026-01-02' AS DATE)) END\nFROM GENERATE_SERIES(1, ${N}) gs;\nCREATE INDEX contracts_product_expiration ON contracts (product, expiration_date);\nCREATE TABLE contract_sheet (line_id INT PRIMARY KEY, product CHAR(2) NOT NULL, max_year DATE NOT NULL);\nINSERT INTO contract_sheet (line_id, product, max_year)\nSELECT gs.value,\n       CHOOSE(gs.value % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       DATEADD(DAY, ${N} / 8 + gs.value, CAST('2026-01-02' AS DATE))\nFROM GENERATE_SERIES(1, ${N}) gs;\nUPDATE STATISTICS contracts; UPDATE STATISTICS contract_sheet;\nCREATE FUNCTION dateOr99(@d DATE) RETURNS DATE AS\nBEGIN\n    RETURN ISNULL(@d, DATEFROMPARTS(9999, 1, 1));\nEND;",
        "scalePoints": [
          {
            "N": 1000
          },
          {
            "N": 2000
          },
          {
            "N": 4000
          },
          {
            "N": 8000
          }
        ],
        "query": "SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND (c.expiration_date IS NULL OR c.expiration_date > cs.max_year)",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:28:36.151247795Z\",\"databaseType\":\"sqlserver\",\"sql\":\"SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND (c.expiration_date IS NULL OR c.expiration_date > cs.max_year)\",\"warmCacheIterations\":0,\"compression\":\"low\",\"seed\":3631051063,\"seedSource\":\"default\",\"scalePointCount\":4,\"totalComputeSeconds\":2.784,\"results\":[{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":1000},\"output\":\"outliving\\n3000\",\"runtimeDurationMs\":48,\"rowsAreCapped\":false,\"computeSeconds\":0.829,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0.175735 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1017],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0006005 SubtreeCost=0.175735 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=15 CPUms=15)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1017\\n        Defined Values: Expr1017 = Count(*)\\n        ->  Nested Loops (Inner Join)  (est Rows=1000 IO=0 CPU=0.00418 SubtreeCost=0.175134 AvgRowSize=9) (actual Rows=3000 Executions=1 Elapsedms=15 CPUms=15)\\n              Node Id: 2  Mode: Row\\n              Outer References: cs.product, cs.max_year\\n              I/O: EndOfScans=1\\n              ->  Clustered Index Scan [PK__contract__F5AE5F620BB0661F] on contract_sheet cs  (est Rows=1000 RowsRead=1000 IO=0.00534722 CPU=0.001257 SubtreeCost=0.00660422 AvgRowSize=12) (actual Rows=1000 RowsRead=1000 Executions=1 Elapsedms=0 CPUms=0)\\n                    Node Id: 3  Mode: Row  Table Cardinality: 1000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=6 EndOfScans=1\\n                    Output List: cs.product, cs.max_year\\n                    Defined Values: cs.product; cs.max_year\\n              ->  Nested Loops (Inner Join)  (est Rows=1 RowsRead=1 Rebinds=999 IO=0.003125 CPU=0.0001581 SubtreeCost=0.16435 AvgRowSize=9) (actual Rows=3000 Executions=1000 Elapsedms=14 CPUms=14)\\n                    Node Id: 4  Mode: Row  Table Cardinality: 1000\\n                    Outer References: Expr1011, Expr1012, Expr1013\\n                    I/O: EndOfScans=1000\\n                    ->  Merge Interval  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=2000 Executions=1000 Elapsedms=9 CPUms=9)\\n                          Node Id: 5  Mode: Row\\n                          Element: MergeInterval\\n                          I/O: EndOfScans=1000\\n                          Output List: Expr1011, Expr1012, Expr1013\\n                          ->  Sort (TopN Sort)  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=2000 Executions=1000 Rebinds=1000 Elapsedms=9 CPUms=9)\\n                                Node Id: 6  Mode: Row\\n                                Top: 2\\n                                Order By: Expr1014 DESC, Expr1015, Expr1011, Expr1016 DESC\\n                                Memory Fractions: Input=1 Output=1\\n                                I/O: EndOfScans=1000\\n                                Memory Grant: Input=1024kB Output=1024kB Used=16kB\\n                                Output List: Expr1011, Expr1012, Expr1013, Expr1014, Expr1015, Expr1016\\n                                ->  Compute Scalar  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17)\\n                                      Node Id: 7  Mode: Row\\n                                      Output List: Expr1011, Expr1012, Expr1013, Expr1014, Expr1015, Expr1016\\n                                      Defined Values: Expr1014 = ((4)&[Expr1013]) = (4) AND NULL = [Expr1011]; Expr1015 = (4)&[Expr1013]; Expr1016 = (16)&[Expr1013]\\n                                      ->  Concatenation  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=2000 Executions=1000 Elapsedms=0 CPUms=0)\\n                                            Node Id: 8  Mode: Row\\n                                            I/O: EndOfScans=1000\\n                                            Output List: Expr1011, Expr1012, Expr1013\\n                                            Defined Values: Expr1011, Expr1006, Expr1009; Expr1012, Expr1007, Expr1010; Expr1013, Expr1005, Expr1008\\n                                            ->  Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17)\\n                                                  Node Id: 9  Mode: Row\\n                                                  Output List: Expr1006, Expr1007, Expr1005\\n                                                  Defined Values: Expr1006 = NULL; Expr1007 = NULL; Expr1005 = (60)\\n                                                  ->  Constant Scan  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=0) (actual Rows=1000 Executions=1000 Elapsedms=0 CPUms=0)\\n                                                        Node Id: 10  Mode: Row\\n                                                        I/O: EndOfScans=1000\\n                                            ->  Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17)\\n                                                  Node Id: 11  Mode: Row\\n                                                  Output List: Expr1009, Expr1010, Expr1008\\n                                                  Defined Values: Expr1009 = [contract_sheet].[max_year] as [cs].[max_year]; Expr1010 = NULL; Expr1008 = (6)\\n                                                  ->  Constant Scan  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=0) (actual Rows=1000 Executions=1000 Elapsedms=0 CPUms=0)\\n                                                        Node Id: 12  Mode: Row\\n                                                        I/O: EndOfScans=1000\\n                    ->  Index Seek [contracts_product_expiration] on contracts c  (est Rows=1 RowsRead=1 Rebinds=999 IO=0.003125 CPU=0.0001581 SubtreeCost=0.16435 AvgRowSize=9) (actual Rows=3000 RowsRead=3000 Executions=2000 Elapsedms=4 CPUms=4)\\n                          Node Id: 13  Mode: Row  Table Cardinality: 1000  Storage: RowStore  Ordered: FORWARD\\n                          Seek Predicates: Prefix EQ c.product = [contract_sheet].[product] as [cs].[product]; Start GT c.expiration_date [Expr1011]; End LT c.expiration_date [Expr1012]\\n                          I/O: Scans=2000 LogicalReads=4000 EndOfScans=2000\\nStatement: SELECT, optimization FULL (early abort: GoodEnoughPlanFound), CE model 170\\nQuery Plan Hash: 0xB8E80EDE479B3C86\\nDegree Of Parallelism: 1\\nMemory Grant: Granted=1024kB MaxUsed=16kB Required=16kB Desired=24kB Requested=1024kB GrantWaitTime=0ms Feedback: No: First Execution\\nCompile: Time=13ms CPU=6ms Memory=352kB CachedPlanSize=48kB\\nCPU Time: 15 ms\\nExecution Time: 15 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]},{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":2000},\"output\":\"outliving\\n6000\",\"runtimeDurationMs\":65,\"rowsAreCapped\":false,\"computeSeconds\":0.558,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0.348928 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1017],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0012005 SubtreeCost=0.348928 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=32 CPUms=32)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1017\\n        Defined Values: Expr1017 = Count(*)\\n        ->  Nested Loops (Inner Join)  (est Rows=2000 IO=0 CPU=0.00836 SubtreeCost=0.347727 AvgRowSize=9) (actual Rows=6000 Executions=1 Elapsedms=32 CPUms=32)\\n              Node Id: 2  Mode: Row\\n              Outer References: cs.product, cs.max_year\\n              I/O: EndOfScans=1\\n              ->  Clustered Index Scan [PK__contract__F5AE5F622D08A9E5] on contract_sheet cs  (est Rows=2000 RowsRead=2000 IO=0.00831019 CPU=0.002357 SubtreeCost=0.0106672 AvgRowSize=12) (actual Rows=2000 RowsRead=2000 Executions=1 Elapsedms=1 CPUms=1)\\n                    Node Id: 3  Mode: Row  Table Cardinality: 2000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=10 EndOfScans=1\\n                    Output List: cs.product, cs.max_year\\n                    Defined Values: cs.product; cs.max_year\\n              ->  Nested Loops (Inner Join)  (est Rows=1 RowsRead=1 Rebinds=1999 IO=0.003125 CPU=0.0001581 SubtreeCost=0.3287 AvgRowSize=9) (actual Rows=6000 Executions=2000 Elapsedms=29 CPUms=29)\\n                    Node Id: 4  Mode: Row  Table Cardinality: 2000\\n                    Outer References: Expr1011, Expr1012, Expr1013\\n                    I/O: EndOfScans=2000\\n                    ->  Merge Interval  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=4000 Executions=2000 Elapsedms=19 CPUms=19)\\n                          Node Id: 5  Mode: Row\\n                          Element: MergeInterval\\n                          I/O: EndOfScans=2000\\n                          Output List: Expr1011, Expr1012, Expr1013\\n                          ->  Sort (TopN Sort)  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=4000 Executions=2000 Rebinds=2000 Elapsedms=18 CPUms=18)\\n                                Node Id: 6  Mode: Row\\n                                Top: 2\\n                                Order By: Expr1014 DESC, Expr1015, Expr1011, Expr1016 DESC\\n                                Memory Fractions: Input=1 Output=1\\n                                I/O: EndOfScans=2000\\n                                Memory Grant: Input=1024kB Output=1024kB Used=16kB\\n                                Output List: Expr1011, Expr1012, Expr1013, Expr1014, Expr1015, Expr1016\\n                                ->  Compute Scalar  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17)\\n                                      Node Id: 7  Mode: Row\\n                                      Output List: Expr1011, Expr1012, Expr1013, Expr1014, Expr1015, Expr1016\\n                                      Defined Values: Expr1014 = ((4)&[Expr1013]) = (4) AND NULL = [Expr1011]; Expr1015 = (4)&[Expr1013]; Expr1016 = (16)&[Expr1013]\\n                                      ->  Concatenation  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=4000 Executions=2000 Elapsedms=1 CPUms=1)\\n                                            Node Id: 8  Mode: Row\\n                                            I/O: EndOfScans=2000\\n                                            Output List: Expr1011, Expr1012, Expr1013\\n                                            Defined Values: Expr1011, Expr1006, Expr1009; Expr1012, Expr1007, Expr1010; Expr1013, Expr1005, Expr1008\\n                                            ->  Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17)\\n                                                  Node Id: 9  Mode: Row\\n                                                  Output List: Expr1006, Expr1007, Expr1005\\n                                                  Defined Values: Expr1006 = NULL; Expr1007 = NULL; Expr1005 = (60)\\n                                                  ->  Constant Scan  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=0) (actual Rows=2000 Executions=2000 Elapsedms=0 CPUms=0)\\n                                                        Node Id: 10  Mode: Row\\n                                                        I/O: EndOfScans=2000\\n                                            ->  Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17)\\n                                                  Node Id: 11  Mode: Row\\n                                                  Output List: Expr1009, Expr1010, Expr1008\\n                                                  Defined Values: Expr1009 = [contract_sheet].[max_year] as [cs].[max_year]; Expr1010 = NULL; Expr1008 = (6)\\n                                                  ->  Constant Scan  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=0) (actual Rows=2000 Executions=2000 Elapsedms=0 CPUms=0)\\n                                                        Node Id: 12  Mode: Row\\n                                                        I/O: EndOfScans=2000\\n                    ->  Index Seek [contracts_product_expiration] on contracts c  (est Rows=1 RowsRead=1 Rebinds=1999 IO=0.003125 CPU=0.0001581 SubtreeCost=0.3287 AvgRowSize=9) (actual Rows=6000 RowsRead=6000 Executions=4000 Elapsedms=8 CPUms=8)\\n                          Node Id: 13  Mode: Row  Table Cardinality: 2000  Storage: RowStore  Ordered: FORWARD\\n                          Seek Predicates: Prefix EQ c.product = [contract_sheet].[product] as [cs].[product]; Start GT c.expiration_date [Expr1011]; End LT c.expiration_date [Expr1012]\\n                          I/O: Scans=4000 LogicalReads=8000 EndOfScans=4000\\nStatement: SELECT, optimization FULL (early abort: GoodEnoughPlanFound), CE model 170\\nQuery Plan Hash: 0x0D0183CC03267619\\nDegree Of Parallelism: 1\\nMemory Grant: Granted=1024kB MaxUsed=16kB Required=16kB Desired=24kB Requested=1024kB GrantWaitTime=0ms Feedback: No: First Execution\\nWait Stats: RESERVED_MEMORY_ALLOCATION_EXT WaitTimeMs=1 WaitCount=4000\\nCompile: Time=14ms CPU=7ms Memory=352kB CachedPlanSize=48kB\\nCPU Time: 32 ms\\nExecution Time: 32 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]},{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":4000},\"output\":\"outliving\\n12000\",\"runtimeDurationMs\":101,\"rowsAreCapped\":false,\"computeSeconds\":0.633,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0.695314 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1017],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0024005 SubtreeCost=0.695314 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=64 CPUms=64)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1017\\n        Defined Values: Expr1017 = Count(*)\\n        ->  Nested Loops (Inner Join)  (est Rows=4000 IO=0 CPU=0.01672 SubtreeCost=0.692913 AvgRowSize=9) (actual Rows=12000 Executions=1 Elapsedms=63 CPUms=63)\\n              Node Id: 2  Mode: Row\\n              Outer References: cs.product, cs.max_year\\n              I/O: EndOfScans=1\\n              ->  Clustered Index Scan [PK__contract__F5AE5F622BBD5151] on contract_sheet cs  (est Rows=4000 RowsRead=4000 IO=0.0142361 CPU=0.004557 SubtreeCost=0.0187931 AvgRowSize=12) (actual Rows=4000 RowsRead=4000 Executions=1 Elapsedms=2 CPUms=2)\\n                    Node Id: 3  Mode: Row  Table Cardinality: 4000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=18 EndOfScans=1\\n                    Output List: cs.product, cs.max_year\\n                    Defined Values: cs.product; cs.max_year\\n              ->  Nested Loops (Inner Join)  (est Rows=1 RowsRead=1 Rebinds=3999 IO=0.003125 CPU=0.0001581 SubtreeCost=0.6574 AvgRowSize=9) (actual Rows=12000 Executions=4000 Elapsedms=58 CPUms=58)\\n                    Node Id: 4  Mode: Row  Table Cardinality: 4000\\n                    Outer References: Expr1011, Expr1012, Expr1013\\n                    I/O: EndOfScans=4000\\n                    ->  Merge Interval  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=8000 Executions=4000 Elapsedms=38 CPUms=38)\\n                          Node Id: 5  Mode: Row\\n                          Element: MergeInterval\\n                          I/O: EndOfScans=4000\\n                          Output List: Expr1011, Expr1012, Expr1013\\n                          ->  Sort (TopN Sort)  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=8000 Executions=4000 Rebinds=4000 Elapsedms=36 CPUms=36)\\n                                Node Id: 6  Mode: Row\\n                                Top: 2\\n                                Order By: Expr1014 DESC, Expr1015, Expr1011, Expr1016 DESC\\n                                Memory Fractions: Input=1 Output=1\\n                                I/O: EndOfScans=4000\\n                                Memory Grant: Input=1024kB Output=1024kB Used=16kB\\n                                Output List: Expr1011, Expr1012, Expr1013, Expr1014, Expr1015, Expr1016\\n                                ->  Compute Scalar  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17)\\n                                      Node Id: 7  Mode: Row\\n                                      Output List: Expr1011, Expr1012, Expr1013, Expr1014, Expr1015, Expr1016\\n                                      Defined Values: Expr1014 = ((4)&[Expr1013]) = (4) AND NULL = [Expr1011]; Expr1015 = (4)&[Expr1013]; Expr1016 = (16)&[Expr1013]\\n                                      ->  Concatenation  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=8000 Executions=4000 Elapsedms=3 CPUms=3)\\n                                            Node Id: 8  Mode: Row\\n                                            I/O: EndOfScans=4000\\n                                            Output List: Expr1011, Expr1012, Expr1013\\n                                            Defined Values: Expr1011, Expr1006, Expr1009; Expr1012, Expr1007, Expr1010; Expr1013, Expr1005, Expr1008\\n                                            ->  Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17)\\n                                                  Node Id: 9  Mode: Row\\n                                                  Output List: Expr1006, Expr1007, Expr1005\\n                                                  Defined Values: Expr1006 = NULL; Expr1007 = NULL; Expr1005 = (60)\\n                                                  ->  Constant Scan  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=0) (actual Rows=4000 Executions=4000 Elapsedms=0 CPUms=0)\\n                                                        Node Id: 10  Mode: Row\\n                                                        I/O: EndOfScans=4000\\n                                            ->  Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17)\\n                                                  Node Id: 11  Mode: Row\\n                                                  Output List: Expr1009, Expr1010, Expr1008\\n                                                  Defined Values: Expr1009 = [contract_sheet].[max_year] as [cs].[max_year]; Expr1010 = NULL; Expr1008 = (6)\\n                                                  ->  Constant Scan  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=0) (actual Rows=4000 Executions=4000 Elapsedms=0 CPUms=0)\\n                                                        Node Id: 12  Mode: Row\\n                                                        I/O: EndOfScans=4000\\n                    ->  Index Seek [contracts_product_expiration] on contracts c  (est Rows=1 RowsRead=1 Rebinds=3999 IO=0.003125 CPU=0.0001581 SubtreeCost=0.6574 AvgRowSize=9) (actual Rows=12000 RowsRead=12000 Executions=8000 Elapsedms=16 CPUms=16)\\n                          Node Id: 13  Mode: Row  Table Cardinality: 4000  Storage: RowStore  Ordered: FORWARD\\n                          Seek Predicates: Prefix EQ c.product = [contract_sheet].[product] as [cs].[product]; Start GT c.expiration_date [Expr1011]; End LT c.expiration_date [Expr1012]\\n                          I/O: Scans=8000 LogicalReads=16000 EndOfScans=8000\\nStatement: SELECT, optimization FULL (early abort: GoodEnoughPlanFound), CE model 170\\nQuery Plan Hash: 0x10535863E724DB72\\nDegree Of Parallelism: 1\\nMemory Grant: Granted=1024kB MaxUsed=16kB Required=16kB Desired=24kB Requested=1024kB GrantWaitTime=0ms Feedback: No: First Execution\\nWait Stats: RESERVED_MEMORY_ALLOCATION_EXT WaitTimeMs=2 WaitCount=8000\\nWait Stats: MEMORY_ALLOCATION_EXT WaitTimeMs=1 WaitCount=4010\\nCompile: Time=17ms CPU=10ms Memory=328kB CachedPlanSize=48kB\\nCPU Time: 64 ms\\nExecution Time: 64 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]},{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":8000},\"output\":\"outliving\\n24000\",\"runtimeDurationMs\":168,\"rowsAreCapped\":false,\"computeSeconds\":0.764,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=1.38496 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1017],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0048005 SubtreeCost=1.38496 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=125 CPUms=125)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1017\\n        Defined Values: Expr1017 = Count(*)\\n        ->  Nested Loops (Inner Join)  (est Rows=8000 IO=0 CPU=0.03344 SubtreeCost=1.38016 AvgRowSize=9) (actual Rows=24000 Executions=1 Elapsedms=124 CPUms=124)\\n              Node Id: 2  Mode: Row\\n              Outer References: cs.product, cs.max_year\\n              I/O: EndOfScans=1\\n              ->  Clustered Index Scan [PK__contract__F5AE5F620927E6AB] on contract_sheet cs  (est Rows=8000 RowsRead=8000 IO=0.026088 CPU=0.008957 SubtreeCost=0.035045 AvgRowSize=12) (actual Rows=8000 RowsRead=8000 Executions=1 Elapsedms=4 CPUms=4)\\n                    Node Id: 3  Mode: Row  Table Cardinality: 8000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=34 EndOfScans=1\\n                    Output List: cs.product, cs.max_year\\n                    Defined Values: cs.product; cs.max_year\\n              ->  Nested Loops (Inner Join)  (est Rows=1 RowsRead=1 Rebinds=7999 IO=0.003125 CPU=0.0001581 SubtreeCost=1.31167 AvgRowSize=9) (actual Rows=24000 Executions=8000 Elapsedms=114 CPUms=114)\\n                    Node Id: 4  Mode: Row  Table Cardinality: 8000\\n                    Outer References: Expr1011, Expr1012, Expr1013\\n                    I/O: EndOfScans=8000\\n                    ->  Merge Interval  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=16000 Executions=8000 Elapsedms=75 CPUms=75)\\n                          Node Id: 5  Mode: Row\\n                          Element: MergeInterval\\n                          I/O: EndOfScans=8000\\n                          Output List: Expr1011, Expr1012, Expr1013\\n                          ->  Sort (TopN Sort)  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=16000 Executions=8000 Rebinds=8000 Elapsedms=70 CPUms=70)\\n                                Node Id: 6  Mode: Row\\n                                Top: 2\\n                                Order By: Expr1014 DESC, Expr1015, Expr1011, Expr1016 DESC\\n                                Memory Fractions: Input=1 Output=1\\n                                I/O: EndOfScans=8000\\n                                Memory Grant: Input=1024kB Output=1024kB Used=16kB\\n                                Output List: Expr1011, Expr1012, Expr1013, Expr1014, Expr1015, Expr1016\\n                                ->  Compute Scalar  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17)\\n                                      Node Id: 7  Mode: Row\\n                                      Output List: Expr1011, Expr1012, Expr1013, Expr1014, Expr1015, Expr1016\\n                                      Defined Values: Expr1014 = ((4)&[Expr1013]) = (4) AND NULL = [Expr1011]; Expr1015 = (4)&[Expr1013]; Expr1016 = (16)&[Expr1013]\\n                                      ->  Concatenation  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=16000 Executions=8000 Elapsedms=6 CPUms=6)\\n                                            Node Id: 8  Mode: Row\\n                                            I/O: EndOfScans=8000\\n                                            Output List: Expr1011, Expr1012, Expr1013\\n                                            Defined Values: Expr1011, Expr1006, Expr1009; Expr1012, Expr1007, Expr1010; Expr1013, Expr1005, Expr1008\\n                                            ->  Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17)\\n                                                  Node Id: 9  Mode: Row\\n                                                  Output List: Expr1006, Expr1007, Expr1005\\n                                                  Defined Values: Expr1006 = NULL; Expr1007 = NULL; Expr1005 = (60)\\n                                                  ->  Constant Scan  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=0) (actual Rows=8000 Executions=8000 Elapsedms=1 CPUms=1)\\n                                                        Node Id: 10  Mode: Row\\n                                                        I/O: EndOfScans=8000\\n                                            ->  Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17)\\n                                                  Node Id: 11  Mode: Row\\n                                                  Output List: Expr1009, Expr1010, Expr1008\\n                                                  Defined Values: Expr1009 = [contract_sheet].[max_year] as [cs].[max_year]; Expr1010 = NULL; Expr1008 = (6)\\n                                                  ->  Constant Scan  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=0) (actual Rows=8000 Executions=8000 Elapsedms=0 CPUms=0)\\n                                                        Node Id: 12  Mode: Row\\n                                                        I/O: EndOfScans=8000\\n                    ->  Index Seek [contracts_product_expiration] on contracts c  (est Rows=1 RowsRead=1 Rebinds=7999 IO=0.003125 CPU=0.0001581 SubtreeCost=1.31167 AvgRowSize=9) (actual Rows=24000 RowsRead=24000 Executions=16000 Elapsedms=33 CPUms=33)\\n                          Node Id: 13  Mode: Row  Table Cardinality: 8000  Storage: RowStore  Ordered: FORWARD\\n                          Seek Predicates: Prefix EQ c.product = [contract_sheet].[product] as [cs].[product]; Start GT c.expiration_date [Expr1011]; End LT c.expiration_date [Expr1012]\\n                          I/O: Scans=16000 LogicalReads=32000 EndOfScans=16000\\nStatement: SELECT, optimization FULL, CE model 170\\nQuery Plan Hash: 0xD9B0002F448588AE\\nDegree Of Parallelism: 1\\nMemory Grant: Granted=1024kB MaxUsed=16kB Required=16kB Desired=24kB Requested=1024kB GrantWaitTime=0ms Feedback: No: First Execution\\nWait Stats: RESERVED_MEMORY_ALLOCATION_EXT WaitTimeMs=4 WaitCount=16000\\nWait Stats: MEMORY_ALLOCATION_EXT WaitTimeMs=2 WaitCount=8011\\nCompile: Time=23ms CPU=16ms Memory=320kB CachedPlanSize=48kB\\nCPU Time: 125 ms\\nExecution Time: 125 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]}],\"workerId\":\"af0156f7-a2eb-4632-9924-fb948f5c2388\",\"correlationId\":\"42a33508-bb89-4fe5-893a-5f537f1869f4\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "SQL Server (Azure SQL Database) with dateOr99 written out by hand, c.expiration_date IS NULL OR c.expiration_date > cs.max_year, the change someone in the story just tried: the same join at 1,000 to 8,000 sheet lines. The fast half of the before and after.",
      "planCaptions": {
        "1K": "At 1,000 sheet lines SQL Server turns IS NULL OR > into index seeks: for each sheet line a Merge Interval builds two ranges, the NULL dates and the dates past max_year, and the Index Seek on contracts_product_expiration runs 2,000 times. The plan runs on one thread in 15 ms.",
        "2K": "At 2,000 lines the SQL Server plan is unchanged, still two seeks per sheet line, and the time roughly doubles to 32 ms. Each line's seeks find only the three contracts on its product that never expire.",
        "4K": "At 4,000 lines SQL Server's seeks double again, to 8,000, and so does the time, 64 ms. The work per sheet line is fixed, so the time grows in step with the sheet.",
        "8K": "At 8,000 lines SQL Server's Index Seek runs 16,000 times, two per sheet line, and the call takes 125 ms. Each doubling of the lines has about doubled the time: the hand-written condition grows with the lines, not with the pairs."
      }
    },
    "ssHandWritten800k": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "SQLSERVER",
        "schemaTemplate": "CREATE TABLE contracts (id INT PRIMARY KEY, product CHAR(2) NOT NULL, expiration_date DATE NULL);\nINSERT INTO contracts (id, product, expiration_date)\nSELECT gs.value,\n       CHOOSE(gs.value % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       CASE WHEN gs.value <= 24 THEN NULL ELSE DATEADD(DAY, (gs.value - 1) / 8, CAST('2026-01-02' AS DATE)) END\nFROM GENERATE_SERIES(1, ${N}) gs;\nCREATE INDEX contracts_product_expiration ON contracts (product, expiration_date);\nCREATE TABLE contract_sheet (line_id INT PRIMARY KEY, product CHAR(2) NOT NULL, max_year DATE NOT NULL);\nINSERT INTO contract_sheet (line_id, product, max_year)\nSELECT gs.value,\n       CHOOSE(gs.value % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       DATEADD(DAY, ${N} / 8 + gs.value, CAST('2026-01-02' AS DATE))\nFROM GENERATE_SERIES(1, ${N}) gs;\nUPDATE STATISTICS contracts; UPDATE STATISTICS contract_sheet;\nCREATE FUNCTION dateOr99(@d DATE) RETURNS DATE AS\nBEGIN\n    RETURN ISNULL(@d, DATEFROMPARTS(9999, 1, 1));\nEND;",
        "scalePoints": [
          {
            "N": 8000
          },
          {
            "N": 80000
          },
          {
            "N": 800000
          }
        ],
        "query": "SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND (c.expiration_date IS NULL OR c.expiration_date > cs.max_year)",
        "exobenchServerVersion": "1.4.27"
      },
      "result": "{\"timestamp\":\"2026-11-20T16:54:30.219783045Z\",\"databaseType\":\"sqlserver\",\"sql\":\"SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND (c.expiration_date IS NULL OR c.expiration_date > cs.max_year)\",\"warmCacheIterations\":0,\"compression\":\"low\",\"seed\":3193998079,\"seedSource\":\"default\",\"scalePointCount\":3,\"totalComputeSeconds\":26.741,\"results\":[{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":8000},\"output\":\"outliving\\n24000\",\"runtimeDurationMs\":240,\"rowsAreCapped\":false,\"computeSeconds\":1.053,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=1.38496 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1017],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0048005 SubtreeCost=1.38496 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=192 CPUms=187)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1017\\n        Defined Values: Expr1017 = Count(*)\\n        ->  Nested Loops (Inner Join)  (est Rows=8000 IO=0 CPU=0.03344 SubtreeCost=1.38016 AvgRowSize=9) (actual Rows=24000 Executions=1 Elapsedms=191 CPUms=186)\\n              Node Id: 2  Mode: Row\\n              Outer References: cs.product, cs.max_year\\n              I/O: EndOfScans=1\\n              ->  Clustered Index Scan [PK__contract__F5AE5F62C625880D] on contract_sheet cs  (est Rows=8000 RowsRead=8000 IO=0.026088 CPU=0.008957 SubtreeCost=0.035045 AvgRowSize=12) (actual Rows=8000 RowsRead=8000 Executions=1 Elapsedms=5 CPUms=5)\\n                    Node Id: 3  Mode: Row  Table Cardinality: 8000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=34 EndOfScans=1\\n                    Output List: cs.product, cs.max_year\\n                    Defined Values: cs.product; cs.max_year\\n              ->  Nested Loops (Inner Join)  (est Rows=1 RowsRead=1 Rebinds=7999 IO=0.003125 CPU=0.0001581 SubtreeCost=1.31167 AvgRowSize=9) (actual Rows=24000 Executions=8000 Elapsedms=177 CPUms=172)\\n                    Node Id: 4  Mode: Row  Table Cardinality: 8000\\n                    Outer References: Expr1011, Expr1012, Expr1013\\n                    I/O: EndOfScans=8000\\n                    ->  Merge Interval  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=16000 Executions=8000 Elapsedms=117 CPUms=112)\\n                          Node Id: 5  Mode: Row\\n                          Element: MergeInterval\\n                          I/O: EndOfScans=8000\\n                          Output List: Expr1011, Expr1012, Expr1013\\n                          ->  Sort (TopN Sort)  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=16000 Executions=8000 Rebinds=8000 Elapsedms=111 CPUms=106)\\n                                Node Id: 6  Mode: Row\\n                                Top: 2\\n                                Order By: Expr1014 DESC, Expr1015, Expr1011, Expr1016 DESC\\n                                Memory Fractions: Input=1 Output=1\\n                                I/O: EndOfScans=8000\\n                                Memory Grant: Input=1024kB Output=1024kB Used=16kB\\n                                Output List: Expr1011, Expr1012, Expr1013, Expr1014, Expr1015, Expr1016\\n                                ->  Compute Scalar  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17)\\n                                      Node Id: 7  Mode: Row\\n                                      Output List: Expr1011, Expr1012, Expr1013, Expr1014, Expr1015, Expr1016\\n                                      Defined Values: Expr1014 = ((4)&[Expr1013]) = (4) AND NULL = [Expr1011]; Expr1015 = (4)&[Expr1013]; Expr1016 = (16)&[Expr1013]\\n                                      ->  Concatenation  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=16000 Executions=8000 Elapsedms=6 CPUms=6)\\n                                            Node Id: 8  Mode: Row\\n                                            I/O: EndOfScans=8000\\n                                            Output List: Expr1011, Expr1012, Expr1013\\n                                            Defined Values: Expr1011, Expr1006, Expr1009; Expr1012, Expr1007, Expr1010; Expr1013, Expr1005, Expr1008\\n                                            ->  Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17)\\n                                                  Node Id: 9  Mode: Row\\n                                                  Output List: Expr1006, Expr1007, Expr1005\\n                                                  Defined Values: Expr1006 = NULL; Expr1007 = NULL; Expr1005 = (60)\\n                                                  ->  Constant Scan  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=0) (actual Rows=8000 Executions=8000 Elapsedms=1 CPUms=1)\\n                                                        Node Id: 10  Mode: Row\\n                                                        I/O: EndOfScans=8000\\n                                            ->  Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17)\\n                                                  Node Id: 11  Mode: Row\\n                                                  Output List: Expr1009, Expr1010, Expr1008\\n                                                  Defined Values: Expr1009 = [contract_sheet].[max_year] as [cs].[max_year]; Expr1010 = NULL; Expr1008 = (6)\\n                                                  ->  Constant Scan  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=0) (actual Rows=8000 Executions=8000 Elapsedms=0 CPUms=0)\\n                                                        Node Id: 12  Mode: Row\\n                                                        I/O: EndOfScans=8000\\n                    ->  Index Seek [contracts_product_expiration] on contracts c  (est Rows=1 RowsRead=1 Rebinds=7999 IO=0.003125 CPU=0.0001581 SubtreeCost=1.31167 AvgRowSize=9) (actual Rows=24000 RowsRead=24000 Executions=16000 Elapsedms=53 CPUms=53)\\n                          Node Id: 13  Mode: Row  Table Cardinality: 8000  Storage: RowStore  Ordered: FORWARD\\n                          Seek Predicates: Prefix EQ c.product = [contract_sheet].[product] as [cs].[product]; Start GT c.expiration_date [Expr1011]; End LT c.expiration_date [Expr1012]\\n                          I/O: Scans=16000 LogicalReads=32000 EndOfScans=16000\\nStatement: SELECT, optimization FULL, CE model 170\\nQuery Plan Hash: 0xF8BD18934E587259\\nDegree Of Parallelism: 1\\nMemory Grant: Granted=1024kB MaxUsed=16kB Required=16kB Desired=24kB Requested=1024kB GrantWaitTime=0ms Feedback: No: First Execution\\nWait Stats: RESERVED_MEMORY_ALLOCATION_EXT WaitTimeMs=6 WaitCount=16000\\nWait Stats: SOS_SCHEDULER_YIELD WaitTimeMs=5 WaitCount=47\\nWait Stats: MEMORY_ALLOCATION_EXT WaitTimeMs=4 WaitCount=8011\\nWait Stats: RESOURCE_GOVERNOR_IDLE WaitTimeMs=4 WaitCount=1\\nCompile: Time=28ms CPU=22ms Memory=320kB CachedPlanSize=48kB\\nCPU Time: 187 ms\\nExecution Time: 192 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]},{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":80000},\"output\":\"outliving\\n240000\",\"runtimeDurationMs\":1392,\"rowsAreCapped\":false,\"computeSeconds\":2.814,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0.0000001 SubtreeCost=13.624 AvgRowSize=11)\\n  Node Id: 1  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[globalagg1004],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0000017 SubtreeCost=13.624 AvgRowSize=15) (actual Rows=1 Executions=1 Elapsedms=1017 CPUms=0)\\n        Node Id: 2  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: globalagg1004\\n        Defined Values: globalagg1004 = SUM([partialagg1003])\\n        ->  Parallelism (Gather Streams)  (est Rows=2 IO=0 CPU=0.0285021 SubtreeCost=13.624 AvgRowSize=15) (actual Rows=4 Executions=1 Elapsedms=1017 CPUms=0)\\n              Node Id: 3  Mode: Row\\n              I/O: EndOfScans=1\\n              Output List: partialagg1003\\n              ->  Stream Aggregate (Aggregate)  (est Rows=2 IO=0 CPU=0.0240005 SubtreeCost=13.5955 AvgRowSize=15) (actual Rows=4 Executions=4 Elapsedms=1016 CPUms=3879 Threads=4)\\n                    Node Id: 4  Mode: Row\\n                    I/O: EndOfScans=4\\n                    Output List: partialagg1003\\n                    Defined Values: partialagg1003 = Count(*)\\n                    ->  Nested Loops (Inner Join)  (est Rows=80000 IO=0 CPU=0.1672 SubtreeCost=13.5715 AvgRowSize=9) (actual Rows=240000 Executions=4 Elapsedms=1009 CPUms=3852 Threads=4)\\n                          Node Id: 5  Mode: Row\\n                          Outer References: cs.product, cs.max_year\\n                          I/O: EndOfScans=4\\n                          ->  Clustered Index Scan [PK__contract__F5AE5F625E053921] on contract_sheet cs  (est Rows=80000 RowsRead=80000 IO=0.237199 CPU=0.0440785 SubtreeCost=0.281278 AvgRowSize=12) (actual Rows=80000 RowsRead=80000 Executions=4 Elapsedms=31 CPUms=120 Threads=4)\\n                                Node Id: 6  Mode: Row  Table Cardinality: 80000  Storage: RowStore\\n                                I/O: Scans=5 LogicalReads=952 EndOfScans=4\\n                                Output List: cs.product, cs.max_year\\n                                Defined Values: cs.product; cs.max_year\\n                          ->  Nested Loops (Inner Join)  (est Rows=1 RowsRead=1 Rebinds=79999 IO=0.003125 CPU=0.0001581 SubtreeCost=13.123 AvgRowSize=9) (actual Rows=240000 Executions=80000 Elapsedms=947 CPUms=3597 Threads=4)\\n                                Node Id: 7  Mode: Row  Table Cardinality: 80000\\n                                Outer References: Expr1011, Expr1012, Expr1013\\n                                I/O: EndOfScans=80000\\n                                ->  Merge Interval  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=160000 Executions=80000 Elapsedms=594 CPUms=2274 Threads=4)\\n                                      Node Id: 8  Mode: Row\\n                                      Element: MergeInterval\\n                                      I/O: EndOfScans=80000\\n                                      Output List: Expr1011, Expr1012, Expr1013\\n                                      ->  Sort (TopN Sort)  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=160000 Executions=80000 Rebinds=80000 Elapsedms=564 CPUms=2153 Threads=4)\\n                                            Node Id: 9  Mode: Row\\n                                            Top: 2\\n                                            Order By: Expr1014 DESC, Expr1015, Expr1011, Expr1016 DESC\\n                                            Memory Fractions: Input=1 Output=1\\n                                            I/O: EndOfScans=80000\\n                                            Memory Grant: Input=928kB Output=928kB Used=64kB\\n                                            Output List: Expr1011, Expr1012, Expr1013, Expr1014, Expr1015, Expr1016\\n                                            ->  Compute Scalar  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17)\\n                                                  Node Id: 10  Mode: Row\\n                                                  Output List: Expr1011, Expr1012, Expr1013, Expr1014, Expr1015, Expr1016\\n                                                  Defined Values: Expr1014 = ((4)&[Expr1013]) = (4) AND NULL = [Expr1011]; Expr1015 = (4)&[Expr1013]; Expr1016 = (16)&[Expr1013]\\n                                                  ->  Concatenation  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=160000 Executions=80000 Elapsedms=29 CPUms=106 Threads=4)\\n                                                        Node Id: 11  Mode: Row\\n                                                        I/O: EndOfScans=80000\\n                                                        Output List: Expr1011, Expr1012, Expr1013\\n                                                        Defined Values: Expr1011, Expr1006, Expr1009; Expr1012, Expr1007, Expr1010; Expr1013, Expr1005, Expr1008\\n                                                        ->  Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17)\\n                                                              Node Id: 12  Mode: Row\\n                                                              Output List: Expr1006, Expr1007, Expr1005\\n                                                              Defined Values: Expr1006 = NULL; Expr1007 = NULL; Expr1005 = (60)\\n                                                              ->  Constant Scan  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=0) (actual Rows=80000 Executions=80000 Elapsedms=4 CPUms=13 Threads=4)\\n                                                                    Node Id: 13  Mode: Row\\n                                                                    I/O: EndOfScans=80000\\n                                                        ->  Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17)\\n                                                              Node Id: 14  Mode: Row\\n                                                              Output List: Expr1009, Expr1010, Expr1008\\n                                                              Defined Values: Expr1009 = [contract_sheet].[max_year] as [cs].[max_year]; Expr1010 = NULL; Expr1008 = (6)\\n                                                              ->  Constant Scan  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=0) (actual Rows=80000 Executions=80000 Elapsedms=3 CPUms=10 Threads=4)\\n                                                                    Node Id: 15  Mode: Row\\n                                                                    I/O: EndOfScans=80000\\n                                ->  Index Seek [contracts_product_expiration] on contracts c  (est Rows=1 RowsRead=1 Rebinds=79999 IO=0.003125 CPU=0.0001581 SubtreeCost=13.123 AvgRowSize=9) (actual Rows=240000 RowsRead=240000 Executions=160000 Elapsedms=349 CPUms=1207 Threads=4)\\n                                      Node Id: 16  Mode: Row  Table Cardinality: 80000  Storage: RowStore  Ordered: FORWARD\\n                                      Seek Predicates: Prefix EQ c.product = [contract_sheet].[product] as [cs].[product]; Start GT c.expiration_date [Expr1011]; End LT c.expiration_date [Expr1012]\\n                                      I/O: Scans=160000 LogicalReads=380000 EndOfScans=160000\\nStatement: SELECT, optimization FULL, CE model 170\\nQuery Plan Hash: 0xAE20DC6ED791FB5A\\nDegree Of Parallelism: 4  Used Threads: 4\\nMemory Grant: Granted=1024kB MaxUsed=136kB Required=136kB Desired=168kB Requested=1024kB GrantWaitTime=0ms Feedback: No: First Execution\\nWait Stats: CXSYNC_PORT WaitTimeMs=1040 WaitCount=5\\nWait Stats: SOS_SCHEDULER_YIELD WaitTimeMs=169 WaitCount=945\\nWait Stats: RESOURCE_GOVERNOR_IDLE WaitTimeMs=142 WaitCount=20\\nWait Stats: RESERVED_MEMORY_ALLOCATION_EXT WaitTimeMs=124 WaitCount=160009\\nWait Stats: MEMORY_ALLOCATION_EXT WaitTimeMs=83 WaitCount=80046\\nCompile: Time=351ms CPU=212ms Memory=344kB CachedPlanSize=56kB\\nCPU Time: 3883 ms\\nExecution Time: 1018 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]},{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":800000},\"output\":\"outliving\\n2400000\",\"runtimeDurationMs\":11657,\"rowsAreCapped\":false,\"computeSeconds\":22.874,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0.0000001 SubtreeCost=135.856 AvgRowSize=11)\\n  Node Id: 1  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[globalagg1004],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0000017 SubtreeCost=135.856 AvgRowSize=15) (actual Rows=1 Executions=1 Elapsedms=10745 CPUms=0)\\n        Node Id: 2  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: globalagg1004\\n        Defined Values: globalagg1004 = SUM([partialagg1003])\\n        ->  Parallelism (Gather Streams)  (est Rows=2 IO=0 CPU=0.0285021 SubtreeCost=135.856 AvgRowSize=15) (actual Rows=4 Executions=1 Elapsedms=10745 CPUms=0)\\n              Node Id: 3  Mode: Row\\n              I/O: EndOfScans=1\\n              Output List: partialagg1003\\n              ->  Stream Aggregate (Aggregate)  (est Rows=2 IO=0 CPU=0.240001 SubtreeCost=135.827 AvgRowSize=15) (actual Rows=4 Executions=4 Elapsedms=10741 CPUms=36487 Threads=4)\\n                    Node Id: 4  Mode: Row\\n                    I/O: EndOfScans=4\\n                    Output List: partialagg1003\\n                    Defined Values: partialagg1003 = Count(*)\\n                    ->  Nested Loops (Inner Join)  (est Rows=800000 IO=0 CPU=1.672 SubtreeCost=135.587 AvgRowSize=9) (actual Rows=2400000 Executions=4 Elapsedms=10680 CPUms=36246 Threads=4)\\n                          Node Id: 5  Mode: Row\\n                          Outer References: cs.product, cs.max_year\\n                          I/O: EndOfScans=4\\n                          ->  Clustered Index Scan [PK__contract__F5AE5F6271AC8AC9] on contract_sheet cs  (est Rows=800000 RowsRead=800000 IO=2.34535 CPU=0.440078 SubtreeCost=2.78543 AvgRowSize=12) (actual Rows=800000 RowsRead=800000 Executions=4 Elapsedms=293 CPUms=1111 Threads=4)\\n                                Node Id: 6  Mode: Row  Table Cardinality: 800000  Storage: RowStore\\n                                I/O: Scans=5 LogicalReads=3257 EndOfScans=4\\n                                Output List: cs.product, cs.max_year\\n                                Defined Values: cs.product; cs.max_year\\n                          ->  Nested Loops (Inner Join)  (est Rows=1 RowsRead=1 Rebinds=799999 Rewinds=0.00144649 IO=0.003125 CPU=0.0001581 SubtreeCost=131.13 AvgRowSize=9) (actual Rows=2400000 Executions=800000 Elapsedms=10069 CPUms=33905 Threads=4)\\n                                Node Id: 7  Mode: Row  Table Cardinality: 800000\\n                                Outer References: Expr1011, Expr1012, Expr1013\\n                                I/O: EndOfScans=800000\\n                                ->  Merge Interval  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=1600000 Executions=800000 Elapsedms=5803 CPUms=20664 Threads=4)\\n                                      Node Id: 8  Mode: Row\\n                                      Element: MergeInterval\\n                                      I/O: EndOfScans=800000\\n                                      Output List: Expr1011, Expr1012, Expr1013\\n                                      ->  Sort (TopN Sort)  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=1600000 Executions=800000 Rebinds=800000 Elapsedms=5512 CPUms=19540 Threads=4)\\n                                            Node Id: 9  Mode: Row\\n                                            Top: 2\\n                                            Order By: Expr1014 DESC, Expr1015, Expr1011, Expr1016 DESC\\n                                            Memory Fractions: Input=1 Output=1\\n                                            I/O: EndOfScans=800000\\n                                            Memory Grant: Input=928kB Output=928kB Used=64kB\\n                                            Output List: Expr1011, Expr1012, Expr1013, Expr1014, Expr1015, Expr1016\\n                                            ->  Compute Scalar  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17)\\n                                                  Node Id: 10  Mode: Row\\n                                                  Output List: Expr1011, Expr1012, Expr1013, Expr1014, Expr1015, Expr1016\\n                                                  Defined Values: Expr1014 = ((4)&[Expr1013]) = (4) AND NULL = [Expr1011]; Expr1015 = (4)&[Expr1013]; Expr1016 = (16)&[Expr1013]\\n                                                  ->  Concatenation  (est Rows=2 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=1600000 Executions=800000 Elapsedms=254 CPUms=976 Threads=4)\\n                                                        Node Id: 11  Mode: Row\\n                                                        I/O: EndOfScans=800000\\n                                                        Output List: Expr1011, Expr1012, Expr1013\\n                                                        Defined Values: Expr1011, Expr1006, Expr1009; Expr1012, Expr1007, Expr1010; Expr1013, Expr1005, Expr1008\\n                                                        ->  Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17)\\n                                                              Node Id: 12  Mode: Row\\n                                                              Output List: Expr1006, Expr1007, Expr1005\\n                                                              Defined Values: Expr1006 = NULL; Expr1007 = NULL; Expr1005 = (60)\\n                                                              ->  Constant Scan  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=0) (actual Rows=800000 Executions=800000 Elapsedms=35 CPUms=130 Threads=4)\\n                                                                    Node Id: 13  Mode: Row\\n                                                                    I/O: EndOfScans=800000\\n                                                        ->  Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17)\\n                                                              Node Id: 14  Mode: Row\\n                                                              Output List: Expr1009, Expr1010, Expr1008\\n                                                              Defined Values: Expr1009 = [contract_sheet].[max_year] as [cs].[max_year]; Expr1010 = NULL; Expr1008 = (6)\\n                                                              ->  Constant Scan  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=0) (actual Rows=800000 Executions=800000 Elapsedms=30 CPUms=115 Threads=4)\\n                                                                    Node Id: 15  Mode: Row\\n                                                                    I/O: EndOfScans=800000\\n                                ->  Index Seek [contracts_product_expiration] on contracts c  (est Rows=1 RowsRead=1 Rebinds=799999 Rewinds=0.00144649 IO=0.003125 CPU=0.0001581 SubtreeCost=131.13 AvgRowSize=9) (actual Rows=2400000 RowsRead=2400000 Executions=1600000 Elapsedms=3964 CPUms=12181 Threads=4)\\n                                      Node Id: 16  Mode: Row  Table Cardinality: 800000  Storage: RowStore  Ordered: FORWARD\\n                                      Seek Predicates: Prefix EQ c.product = [contract_sheet].[product] as [cs].[product]; Start GT c.expiration_date [Expr1011]; End LT c.expiration_date [Expr1012]\\n                                      I/O: Scans=1600000 LogicalReads=5400000 EndOfScans=1600000\\nStatement: SELECT, optimization FULL, CE model 170\\nQuery Plan Hash: 0xD3C852912294111D\\nDegree Of Parallelism: 4  Used Threads: 4\\nMemory Grant: Granted=1024kB MaxUsed=136kB Required=136kB Desired=168kB Requested=1024kB GrantWaitTime=0ms Feedback: No: First Execution\\nStatistics Used: [_WA_Sys_00000003_29971E47] on contract_sheet (sampled 36.181%)\\nStatistics Used: [_WA_Sys_00000003_27AED5D5] on contracts (sampled 34.642%)\\nStatistics Used: [PK__contract__3213E83F01A6CC29] on contracts (sampled 34.642%)\\nStatistics Used: [contracts_product_expiration] on contracts (sampled 36.717%)\\nStatistics Used: [_WA_Sys_00000002_29971E47] on contract_sheet (sampled 36.181%)\\nWait Stats: CXSYNC_PORT WaitTimeMs=13297 WaitCount=5\\nWait Stats: SOS_SCHEDULER_YIELD WaitTimeMs=3968 WaitCount=9007\\nWait Stats: RESOURCE_GOVERNOR_IDLE WaitTimeMs=3238 WaitCount=531\\nWait Stats: RESERVED_MEMORY_ALLOCATION_EXT WaitTimeMs=1217 WaitCount=1600009\\nWait Stats: MEMORY_ALLOCATION_EXT WaitTimeMs=878 WaitCount=877282\\nWait Stats: PAGELATCH_SH WaitTimeMs=10 WaitCount=9\\nWait Stats: SLEEP_MEMORYPOOL_ALLOCATEPAGES WaitTimeMs=4 WaitCount=1\\nCompile: Time=888ms CPU=23ms Memory=480kB CachedPlanSize=56kB\\nCPU Time: 36490 ms\\nExecution Time: 10745 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]}],\"workerId\":\"22afd01c-0e0f-4009-88b4-b5cc254539d9\",\"correlationId\":\"24aee057-820c-4f1f-b020-cf94b768570f\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "SQL Server (Azure SQL Database) with the hand-written IS NULL OR >, the main run's query and tables, in a later call at 8,000, 80,000 and 800,000 sheet lines: the fast half of the before and after, at ten and a hundred times the story's largest size.",
      "planCaptions": {
        "8K": "At 8,000 sheet lines SQL Server runs the main run's plan on one thread: a Merge Interval builds two ranges per sheet line, and the Index Seek on contracts_product_expiration runs 16,000 times. The call takes 192 ms.",
        "80K": "At 80,000 lines SQL Server keeps two seeks per sheet line, 160,000 in all, and splits them across 4 threads, so the call takes 1,018 ms of Execution Time while its CPU Time adds up to 3,883 ms.",
        "800K": "At 800,000 lines the plan is unchanged: 1,600,000 seeks on 4 threads find 2,400,000 matches, the three contracts per sheet line that never expire, and the call takes 10,745 ms, with 36,490 ms of CPU Time. The seeks grow with the lines, not with the pairs."
      }
    },
    "ssGrowthChart": {
      "type": "chart",
      "chartType": "split-scale",
      "x": [
        1000,
        2000,
        4000,
        8000
      ],
      "xTicks": [
        1000,
        2000,
        4000,
        8000
      ],
      "xLabel": "Sheet lines in the join, to scale (with as many contracts)",
      "xUnit": "sheet lines",
      "splitAt": 1000,
      "upper": {
        "title": "Calls of a second or more (seconds)",
        "unit": "s",
        "divisor": 1000,
        "max": 30,
        "ticks": [
          0,
          10,
          20,
          30
        ]
      },
      "lower": {
        "title": "Calls under a second (milliseconds)",
        "unit": "ms",
        "divisor": 1,
        "max": 1000,
        "ticks": [
          0,
          250,
          500,
          750,
          1000
        ]
      },
      "series": [
        {
          "label": "UDF, inlining off (as before SQL Server 2019)",
          "shortLabel": "Inlining off",
          "data": [
            337,
            1464,
            6607,
            26221
          ],
          "color": "#2a78d6",
          "style": "solid"
        },
        {
          "label": "UDF, inlined (SQL Server 2019 and later)",
          "shortLabel": "Inlined",
          "data": [
            12,
            48,
            189,
            815
          ],
          "color": "#eb6834",
          "style": "solid"
        },
        {
          "label": "Hand-written IS NULL OR >",
          "shortLabel": "IS NULL OR >",
          "data": [
            15,
            32,
            64,
            125
          ],
          "color": "#199e70",
          "style": "solid"
        },
        {
          "label": "UDF, inlined, plus an indexed computed column",
          "shortLabel": "Computed column",
          "data": [
            3,
            7,
            14,
            29
          ],
          "color": "#c98500",
          "style": "solid"
        }
      ],
      "caption": "SQL Server's Execution Time against sheet lines for four versions of the join: dateOr99 with inlining off, dateOr99 inlined, the hand-written IS NULL OR >, and the inlined dateOr99 with an indexed computed column. Each point is one execution and each line is one call: inlining off from a repeat run, the other three from the main run.",
      "subtitle": "Both panels are linear and share one x-axis drawn to scale: calls of a second or more above, in seconds, and shorter calls below, in milliseconds. A dotted line is a jump from one panel to the other.",
      "dataAsProse": "Execution Time per point, one execution each, from each plan's Execution Time line. UDF, inlining off (as before SQL Server 2019): 337 ms at 1,000 sheet lines, 1,464 ms at 2,000, 6,607 ms at 4,000 and 26,221 ms at 8,000. UDF, inlined (SQL Server 2019 and later): 12 ms at 1,000 sheet lines, 48 ms at 2,000, 189 ms at 4,000 and 815 ms at 8,000. Hand-written IS NULL OR >: 15 ms at 1,000 sheet lines, 32 ms at 2,000, 64 ms at 4,000 and 125 ms at 8,000. UDF, inlined, plus an indexed computed column: 3 ms at 1,000 sheet lines, 7 ms at 2,000, 14 ms at 4,000 and 29 ms at 8,000.",
      "summaryCaption": "Inlined, the UDF stays in the milliseconds panel but still curves upward like the inlining-off line above it, while the hand-written condition and the computed column climb in straight lines."
    },
    "ssComputedColumn": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "SQLSERVER",
        "schemaTemplate": "CREATE TABLE contracts (id INT PRIMARY KEY, product CHAR(2) NOT NULL, expiration_date DATE NULL);\nINSERT INTO contracts (id, product, expiration_date)\nSELECT gs.value,\n       CHOOSE(gs.value % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       CASE WHEN gs.value <= 24 THEN NULL ELSE DATEADD(DAY, (gs.value - 1) / 8, CAST('2026-01-02' AS DATE)) END\nFROM GENERATE_SERIES(1, ${N}) gs;\nCREATE INDEX contracts_product_expiration ON contracts (product, expiration_date);\nCREATE TABLE contract_sheet (line_id INT PRIMARY KEY, product CHAR(2) NOT NULL, max_year DATE NOT NULL);\nINSERT INTO contract_sheet (line_id, product, max_year)\nSELECT gs.value,\n       CHOOSE(gs.value % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       DATEADD(DAY, ${N} / 8 + gs.value, CAST('2026-01-02' AS DATE))\nFROM GENERATE_SERIES(1, ${N}) gs;\nUPDATE STATISTICS contracts; UPDATE STATISTICS contract_sheet;\nCREATE FUNCTION dateOr99(@d DATE) RETURNS DATE AS\nBEGIN\n    RETURN ISNULL(@d, DATEFROMPARTS(9999, 1, 1));\nEND;\nALTER TABLE contracts ADD expiration99 AS ISNULL(expiration_date, DATEFROMPARTS(9999, 1, 1)) PERSISTED;\nCREATE INDEX contracts_product_expiration99 ON contracts (product, expiration99);\nUPDATE STATISTICS contracts;",
        "scalePoints": [
          {
            "N": 1000
          },
          {
            "N": 2000
          },
          {
            "N": 4000
          },
          {
            "N": 8000
          }
        ],
        "query": "SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND ${SCHEMA}.dateOr99(c.expiration_date) > cs.max_year",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:28:42.512746950Z\",\"databaseType\":\"sqlserver\",\"sql\":\"SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND ${SCHEMA}.dateOr99(c.expiration_date) > cs.max_year\",\"warmCacheIterations\":0,\"compression\":\"low\",\"seed\":1726702255,\"seedSource\":\"default\",\"scalePointCount\":4,\"totalComputeSeconds\":2.742,\"results\":[{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":1000},\"output\":\"outliving\\n3000\",\"runtimeDurationMs\":36,\"rowsAreCapped\":false,\"computeSeconds\":0.625,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0.175835 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1009],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0006005 SubtreeCost=0.175835 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=3 CPUms=3)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1009\\n        Defined Values: Expr1009 = Count(*)\\n        ->  Nested Loops (Inner Join)  (est Rows=1000 IO=0 CPU=0.00418 SubtreeCost=0.175134 AvgRowSize=9) (actual Rows=3000 Executions=1 Elapsedms=3 CPUms=3)\\n              Node Id: 3  Mode: Row\\n              Outer References: cs.product, cs.max_year\\n              I/O: EndOfScans=1\\n              ->  Clustered Index Scan [PK__contract__F5AE5F6264044646] on contract_sheet cs  (est Rows=1000 RowsRead=1000 IO=0.00534722 CPU=0.001257 SubtreeCost=0.00660422 AvgRowSize=12) (actual Rows=1000 RowsRead=1000 Executions=1 Elapsedms=0 CPUms=0)\\n                    Node Id: 4  Mode: Row  Table Cardinality: 1000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=6 EndOfScans=1\\n                    Output List: cs.product, cs.max_year\\n                    Defined Values: cs.product; cs.max_year\\n              ->  Nested Loops (Inner Join)  (est Rows=1 RowsRead=1 Rebinds=999 IO=0.003125 CPU=0.0001581 SubtreeCost=0.16435 AvgRowSize=9) (actual Rows=3000 Executions=1000 Elapsedms=2 CPUms=2)\\n                    Node Id: 5  Mode: Row  Table Cardinality: 1000\\n                    Outer References: Expr1007, Expr1008, Expr1006\\n                    I/O: EndOfScans=1000\\n                    ->  Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=1000 Executions=1000 Elapsedms=0 CPUms=0)\\n                          Node Id: 6  Mode: Row\\n                          I/O: EndOfScans=1000\\n                          Output List: Expr1007, Expr1008, Expr1006\\n                          Defined Values: Expr1007, Expr1008, Expr1006 = GetRangeThroughConvert([contract_sheet].[max_year] as [cs].[max_year],NULL,(6))\\n                          ->  Constant Scan  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=0) (actual Rows=1000 Executions=1000 Elapsedms=0 CPUms=0)\\n                                Node Id: 7  Mode: Row\\n                                I/O: EndOfScans=1000\\n                    ->  Index Seek [contracts_product_expiration99] on contracts c  (est Rows=1 RowsRead=1 Rebinds=999 IO=0.003125 CPU=0.0001581 SubtreeCost=0.16435 AvgRowSize=9) (actual Rows=3000 RowsRead=3000 Executions=1000 Elapsedms=1 CPUms=1)\\n                          Node Id: 8  Mode: Row  Table Cardinality: 1000  Storage: RowStore  Ordered: FORWARD\\n                          Seek Predicates: Prefix EQ c.product = [contract_sheet].[product] as [cs].[product]; Start GT c.expiration99 [Expr1007]; End LT c.expiration99 [Expr1008]\\n                          I/O: Scans=1000 LogicalReads=2000 EndOfScans=1000\\nStatement: SELECT, optimization FULL (early abort: GoodEnoughPlanFound), CE model 170\\nQuery Plan Hash: 0x930B6F92F78B4377\\nDegree Of Parallelism: 1\\nMemory Grant: Granted=0kB MaxUsed=0kB\\nCompile: Time=14ms CPU=8ms Memory=456kB CachedPlanSize=40kB\\nextra: 1\\nCPU Time: 3 ms\\nExecution Time: 3 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]},{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":2000},\"output\":\"outliving\\n6000\",\"runtimeDurationMs\":38,\"rowsAreCapped\":false,\"computeSeconds\":0.626,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0.349128 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1009],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0012005 SubtreeCost=0.349128 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=7 CPUms=7)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1009\\n        Defined Values: Expr1009 = Count(*)\\n        ->  Nested Loops (Inner Join)  (est Rows=2000 IO=0 CPU=0.00836 SubtreeCost=0.347727 AvgRowSize=9) (actual Rows=6000 Executions=1 Elapsedms=7 CPUms=7)\\n              Node Id: 3  Mode: Row\\n              Outer References: cs.product, cs.max_year\\n              I/O: EndOfScans=1\\n              ->  Clustered Index Scan [PK__contract__F5AE5F62762E9F73] on contract_sheet cs  (est Rows=2000 RowsRead=2000 IO=0.00831019 CPU=0.002357 SubtreeCost=0.0106672 AvgRowSize=12) (actual Rows=2000 RowsRead=2000 Executions=1 Elapsedms=0 CPUms=0)\\n                    Node Id: 4  Mode: Row  Table Cardinality: 2000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=10 EndOfScans=1\\n                    Output List: cs.product, cs.max_year\\n                    Defined Values: cs.product; cs.max_year\\n              ->  Nested Loops (Inner Join)  (est Rows=1 RowsRead=1 Rebinds=1999 IO=0.003125 CPU=0.0001581 SubtreeCost=0.3287 AvgRowSize=9) (actual Rows=6000 Executions=2000 Elapsedms=5 CPUms=5)\\n                    Node Id: 5  Mode: Row  Table Cardinality: 2000\\n                    Outer References: Expr1007, Expr1008, Expr1006\\n                    I/O: EndOfScans=2000\\n                    ->  Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=2000 Executions=2000 Elapsedms=0 CPUms=0)\\n                          Node Id: 6  Mode: Row\\n                          I/O: EndOfScans=2000\\n                          Output List: Expr1007, Expr1008, Expr1006\\n                          Defined Values: Expr1007, Expr1008, Expr1006 = GetRangeThroughConvert([contract_sheet].[max_year] as [cs].[max_year],NULL,(6))\\n                          ->  Constant Scan  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=0) (actual Rows=2000 Executions=2000 Elapsedms=0 CPUms=0)\\n                                Node Id: 7  Mode: Row\\n                                I/O: EndOfScans=2000\\n                    ->  Index Seek [contracts_product_expiration99] on contracts c  (est Rows=1 RowsRead=1 Rebinds=1999 IO=0.003125 CPU=0.0001581 SubtreeCost=0.3287 AvgRowSize=9) (actual Rows=6000 RowsRead=6000 Executions=2000 Elapsedms=3 CPUms=3)\\n                          Node Id: 8  Mode: Row  Table Cardinality: 2000  Storage: RowStore  Ordered: FORWARD\\n                          Seek Predicates: Prefix EQ c.product = [contract_sheet].[product] as [cs].[product]; Start GT c.expiration99 [Expr1007]; End LT c.expiration99 [Expr1008]\\n                          I/O: Scans=2000 LogicalReads=4000 EndOfScans=2000\\nStatement: SELECT, optimization FULL (early abort: GoodEnoughPlanFound), CE model 170\\nQuery Plan Hash: 0xDFB9FE9062AA9E83\\nDegree Of Parallelism: 1\\nMemory Grant: Granted=0kB MaxUsed=0kB\\nCompile: Time=14ms CPU=8ms Memory=448kB CachedPlanSize=40kB\\nextra: 1\\nCPU Time: 7 ms\\nExecution Time: 7 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]},{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":4000},\"output\":\"outliving\\n12000\",\"runtimeDurationMs\":49,\"rowsAreCapped\":false,\"computeSeconds\":0.746,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0.695714 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1009],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0024005 SubtreeCost=0.695714 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=14 CPUms=14)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1009\\n        Defined Values: Expr1009 = Count(*)\\n        ->  Nested Loops (Inner Join)  (est Rows=4000 IO=0 CPU=0.01672 SubtreeCost=0.692913 AvgRowSize=9) (actual Rows=12000 Executions=1 Elapsedms=14 CPUms=14)\\n              Node Id: 3  Mode: Row\\n              Outer References: cs.product, cs.max_year\\n              I/O: EndOfScans=1\\n              ->  Clustered Index Scan [PK__contract__F5AE5F6200E1E4EB] on contract_sheet cs  (est Rows=4000 RowsRead=4000 IO=0.0142361 CPU=0.004557 SubtreeCost=0.0187931 AvgRowSize=12) (actual Rows=4000 RowsRead=4000 Executions=1 Elapsedms=1 CPUms=1)\\n                    Node Id: 4  Mode: Row  Table Cardinality: 4000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=18 EndOfScans=1\\n                    Output List: cs.product, cs.max_year\\n                    Defined Values: cs.product; cs.max_year\\n              ->  Nested Loops (Inner Join)  (est Rows=1 RowsRead=1 Rebinds=3999 IO=0.003125 CPU=0.0001581 SubtreeCost=0.6574 AvgRowSize=9) (actual Rows=12000 Executions=4000 Elapsedms=11 CPUms=11)\\n                    Node Id: 5  Mode: Row  Table Cardinality: 4000\\n                    Outer References: Expr1007, Expr1008, Expr1006\\n                    I/O: EndOfScans=4000\\n                    ->  Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=4000 Executions=4000 Elapsedms=1 CPUms=1)\\n                          Node Id: 6  Mode: Row\\n                          I/O: EndOfScans=4000\\n                          Output List: Expr1007, Expr1008, Expr1006\\n                          Defined Values: Expr1007, Expr1008, Expr1006 = GetRangeThroughConvert([contract_sheet].[max_year] as [cs].[max_year],NULL,(6))\\n                          ->  Constant Scan  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=0) (actual Rows=4000 Executions=4000 Elapsedms=0 CPUms=0)\\n                                Node Id: 7  Mode: Row\\n                                I/O: EndOfScans=4000\\n                    ->  Index Seek [contracts_product_expiration99] on contracts c  (est Rows=1 RowsRead=1 Rebinds=3999 IO=0.003125 CPU=0.0001581 SubtreeCost=0.6574 AvgRowSize=9) (actual Rows=12000 RowsRead=12000 Executions=4000 Elapsedms=7 CPUms=7)\\n                          Node Id: 8  Mode: Row  Table Cardinality: 4000  Storage: RowStore  Ordered: FORWARD\\n                          Seek Predicates: Prefix EQ c.product = [contract_sheet].[product] as [cs].[product]; Start GT c.expiration99 [Expr1007]; End LT c.expiration99 [Expr1008]\\n                          I/O: Scans=4000 LogicalReads=8000 EndOfScans=4000\\nStatement: SELECT, optimization FULL (early abort: GoodEnoughPlanFound), CE model 170\\nQuery Plan Hash: 0x94A4F35628AF2470\\nDegree Of Parallelism: 1\\nMemory Grant: Granted=0kB MaxUsed=0kB\\nCompile: Time=18ms CPU=11ms Memory=416kB CachedPlanSize=40kB\\nextra: 1\\nCPU Time: 14 ms\\nExecution Time: 14 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]},{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":8000},\"output\":\"outliving\\n24000\",\"runtimeDurationMs\":69,\"rowsAreCapped\":false,\"computeSeconds\":0.745,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=1.38576 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1009],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0048005 SubtreeCost=1.38576 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=29 CPUms=29)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1009\\n        Defined Values: Expr1009 = Count(*)\\n        ->  Nested Loops (Inner Join)  (est Rows=8000 IO=0 CPU=0.03344 SubtreeCost=1.38016 AvgRowSize=9) (actual Rows=24000 Executions=1 Elapsedms=28 CPUms=28)\\n              Node Id: 3  Mode: Row\\n              Outer References: cs.product, cs.max_year\\n              I/O: EndOfScans=1\\n              ->  Clustered Index Scan [PK__contract__F5AE5F62E7DEC827] on contract_sheet cs  (est Rows=8000 RowsRead=8000 IO=0.026088 CPU=0.008957 SubtreeCost=0.035045 AvgRowSize=12) (actual Rows=8000 RowsRead=8000 Executions=1 Elapsedms=2 CPUms=2)\\n                    Node Id: 4  Mode: Row  Table Cardinality: 8000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=34 EndOfScans=1\\n                    Output List: cs.product, cs.max_year\\n                    Defined Values: cs.product; cs.max_year\\n              ->  Nested Loops (Inner Join)  (est Rows=1 RowsRead=1 Rebinds=7999 IO=0.003125 CPU=0.0001581 SubtreeCost=1.31167 AvgRowSize=9) (actual Rows=24000 Executions=8000 Elapsedms=23 CPUms=23)\\n                    Node Id: 5  Mode: Row  Table Cardinality: 8000\\n                    Outer References: Expr1007, Expr1008, Expr1006\\n                    I/O: EndOfScans=8000\\n                    ->  Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=8000 Executions=8000 Elapsedms=3 CPUms=3)\\n                          Node Id: 6  Mode: Row\\n                          I/O: EndOfScans=8000\\n                          Output List: Expr1007, Expr1008, Expr1006\\n                          Defined Values: Expr1007, Expr1008, Expr1006 = GetRangeThroughConvert([contract_sheet].[max_year] as [cs].[max_year],NULL,(6))\\n                          ->  Constant Scan  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=0) (actual Rows=8000 Executions=8000 Elapsedms=0 CPUms=0)\\n                                Node Id: 7  Mode: Row\\n                                I/O: EndOfScans=8000\\n                    ->  Index Seek [contracts_product_expiration99] on contracts c  (est Rows=1 RowsRead=1 Rebinds=7999 IO=0.003125 CPU=0.0001581 SubtreeCost=1.31167 AvgRowSize=9) (actual Rows=24000 RowsRead=24000 Executions=8000 Elapsedms=15 CPUms=15)\\n                          Node Id: 8  Mode: Row  Table Cardinality: 8000  Storage: RowStore  Ordered: FORWARD\\n                          Seek Predicates: Prefix EQ c.product = [contract_sheet].[product] as [cs].[product]; Start GT c.expiration99 [Expr1007]; End LT c.expiration99 [Expr1008]\\n                          I/O: Scans=8000 LogicalReads=16000 EndOfScans=8000\\nStatement: SELECT, optimization FULL, CE model 170\\nQuery Plan Hash: 0x2B4B2A039B04D2E7\\nDegree Of Parallelism: 1\\nMemory Grant: Granted=0kB MaxUsed=0kB\\nCompile: Time=22ms CPU=17ms Memory=416kB CachedPlanSize=40kB\\nextra: 1\\nCPU Time: 29 ms\\nExecution Time: 29 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]}],\"workerId\":\"639e5eb3-e6e9-483d-9cd9-231a8992c371\",\"correlationId\":\"1016f276-3722-41bf-a841-148d92e2819e\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "SQL Server (Azure SQL Database) with dateOr99 inlined, the default here, plus a persisted computed column holding the same ISNULL expression, indexed with product: the query still calls dateOr99, but the plan never does. The same join at 1,000 to 8,000 sheet lines.",
      "planCaptions": {
        "1K": "At 1,000 sheet lines the query asks SQL Server for dateOr99(c.expiration_date) > cs.max_year, and the plan answers it with an Index Seek on contracts_product_expiration99, the index on the computed column expiration99: one seek per sheet line, 3 ms.",
        "2K": "At 2,000 lines SQL Server runs the same Nested Loops with one seek per sheet line, now 2,000 of them, and the time is 7 ms.",
        "4K": "At 4,000 lines SQL Server computes each line's seek range from its cs.max_year in a Compute Scalar, runs the seek 4,000 times, and doubles its time to 14 ms.",
        "8K": "At 8,000 lines SQL Server's Index Seek runs 8,000 times, once per sheet line, and the call takes 29 ms. The query text never changed: it still calls dateOr99, and the plan seeks the computed column instead."
      }
    },
    "ssComputedColumn800k": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "SQLSERVER",
        "schemaTemplate": "CREATE TABLE contracts (id INT PRIMARY KEY, product CHAR(2) NOT NULL, expiration_date DATE NULL);\nINSERT INTO contracts (id, product, expiration_date)\nSELECT gs.value,\n       CHOOSE(gs.value % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       CASE WHEN gs.value <= 24 THEN NULL ELSE DATEADD(DAY, (gs.value - 1) / 8, CAST('2026-01-02' AS DATE)) END\nFROM GENERATE_SERIES(1, ${N}) gs;\nCREATE INDEX contracts_product_expiration ON contracts (product, expiration_date);\nCREATE TABLE contract_sheet (line_id INT PRIMARY KEY, product CHAR(2) NOT NULL, max_year DATE NOT NULL);\nINSERT INTO contract_sheet (line_id, product, max_year)\nSELECT gs.value,\n       CHOOSE(gs.value % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       DATEADD(DAY, ${N} / 8 + gs.value, CAST('2026-01-02' AS DATE))\nFROM GENERATE_SERIES(1, ${N}) gs;\nUPDATE STATISTICS contracts; UPDATE STATISTICS contract_sheet;\nCREATE FUNCTION dateOr99(@d DATE) RETURNS DATE AS\nBEGIN\n    RETURN ISNULL(@d, DATEFROMPARTS(9999, 1, 1));\nEND;\nALTER TABLE contracts ADD expiration99 AS ISNULL(expiration_date, DATEFROMPARTS(9999, 1, 1)) PERSISTED;\nCREATE INDEX contracts_product_expiration99 ON contracts (product, expiration99);\nUPDATE STATISTICS contracts;",
        "scalePoints": [
          {
            "N": 8000
          },
          {
            "N": 80000
          },
          {
            "N": 800000
          }
        ],
        "query": "SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND ${SCHEMA}.dateOr99(c.expiration_date) > cs.max_year",
        "exobenchServerVersion": "1.4.27"
      },
      "result": "{\"timestamp\":\"2026-11-20T17:01:38.163007949Z\",\"databaseType\":\"sqlserver\",\"sql\":\"SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND ${SCHEMA}.dateOr99(c.expiration_date) > cs.max_year\",\"warmCacheIterations\":0,\"compression\":\"low\",\"seed\":1541140247,\"seedSource\":\"default\",\"scalePointCount\":3,\"totalComputeSeconds\":26.721999999999998,\"results\":[{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":8000},\"output\":\"outliving\\n24000\",\"runtimeDurationMs\":70,\"rowsAreCapped\":false,\"computeSeconds\":0.825,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=1.38576 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1009],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0048005 SubtreeCost=1.38576 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=30 CPUms=30)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1009\\n        Defined Values: Expr1009 = Count(*)\\n        ->  Nested Loops (Inner Join)  (est Rows=8000 IO=0 CPU=0.03344 SubtreeCost=1.38016 AvgRowSize=9) (actual Rows=24000 Executions=1 Elapsedms=29 CPUms=29)\\n              Node Id: 3  Mode: Row\\n              Outer References: cs.product, cs.max_year\\n              I/O: EndOfScans=1\\n              ->  Clustered Index Scan [PK__contract__F5AE5F625E552214] on contract_sheet cs  (est Rows=8000 RowsRead=8000 IO=0.026088 CPU=0.008957 SubtreeCost=0.035045 AvgRowSize=12) (actual Rows=8000 RowsRead=8000 Executions=1 Elapsedms=2 CPUms=2)\\n                    Node Id: 4  Mode: Row  Table Cardinality: 8000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=34 EndOfScans=1\\n                    Output List: cs.product, cs.max_year\\n                    Defined Values: cs.product; cs.max_year\\n              ->  Nested Loops (Inner Join)  (est Rows=1 RowsRead=1 Rebinds=7999 IO=0.003125 CPU=0.0001581 SubtreeCost=1.31167 AvgRowSize=9) (actual Rows=24000 Executions=8000 Elapsedms=24 CPUms=24)\\n                    Node Id: 5  Mode: Row  Table Cardinality: 8000\\n                    Outer References: Expr1007, Expr1008, Expr1006\\n                    I/O: EndOfScans=8000\\n                    ->  Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=8000 Executions=8000 Elapsedms=3 CPUms=3)\\n                          Node Id: 6  Mode: Row\\n                          I/O: EndOfScans=8000\\n                          Output List: Expr1007, Expr1008, Expr1006\\n                          Defined Values: Expr1007, Expr1008, Expr1006 = GetRangeThroughConvert([contract_sheet].[max_year] as [cs].[max_year],NULL,(6))\\n                          ->  Constant Scan  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=0) (actual Rows=8000 Executions=8000 Elapsedms=0 CPUms=0)\\n                                Node Id: 7  Mode: Row\\n                                I/O: EndOfScans=8000\\n                    ->  Index Seek [contracts_product_expiration99] on contracts c  (est Rows=1 RowsRead=1 Rebinds=7999 IO=0.003125 CPU=0.0001581 SubtreeCost=1.31167 AvgRowSize=9) (actual Rows=24000 RowsRead=24000 Executions=8000 Elapsedms=17 CPUms=17)\\n                          Node Id: 8  Mode: Row  Table Cardinality: 8000  Storage: RowStore  Ordered: FORWARD\\n                          Seek Predicates: Prefix EQ c.product = [contract_sheet].[product] as [cs].[product]; Start GT c.expiration99 [Expr1007]; End LT c.expiration99 [Expr1008]\\n                          I/O: Scans=8000 LogicalReads=16000 EndOfScans=8000\\nStatement: SELECT, optimization FULL, CE model 170\\nQuery Plan Hash: 0x5812142D3F603867\\nDegree Of Parallelism: 1\\nMemory Grant: Granted=0kB MaxUsed=0kB\\nCompile: Time=22ms CPU=16ms Memory=416kB CachedPlanSize=40kB\\nextra: 1\\nCPU Time: 30 ms\\nExecution Time: 30 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]},{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":80000},\"output\":\"outliving\\n240000\",\"runtimeDurationMs\":379,\"rowsAreCapped\":false,\"computeSeconds\":2.11,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0.0000001 SubtreeCost=13.628 AvgRowSize=11)\\n  Node Id: 1  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[globalagg1005],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0000017 SubtreeCost=13.628 AvgRowSize=15) (actual Rows=1 Executions=1 Elapsedms=150 CPUms=0)\\n        Node Id: 2  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: globalagg1005\\n        Defined Values: globalagg1005 = SUM([partialagg1004])\\n        ->  Parallelism (Gather Streams)  (est Rows=2 IO=0 CPU=0.0285021 SubtreeCost=13.628 AvgRowSize=15) (actual Rows=4 Executions=1 Elapsedms=150 CPUms=0)\\n              Node Id: 3  Mode: Row\\n              I/O: EndOfScans=1\\n              Output List: partialagg1004\\n              ->  Stream Aggregate (Aggregate)  (est Rows=2 IO=0 CPU=0.0240005 SubtreeCost=13.5995 AvgRowSize=15) (actual Rows=4 Executions=4 Elapsedms=150 CPUms=597 Threads=4)\\n                    Node Id: 4  Mode: Row\\n                    I/O: EndOfScans=4\\n                    Output List: partialagg1004\\n                    Defined Values: partialagg1004 = Count(*)\\n                    ->  Nested Loops (Inner Join)  (est Rows=80000 IO=0 CPU=0.1672 SubtreeCost=13.5715 AvgRowSize=9) (actual Rows=240000 Executions=4 Elapsedms=145 CPUms=577 Threads=4)\\n                          Node Id: 6  Mode: Row\\n                          Outer References: cs.product, cs.max_year\\n                          I/O: EndOfScans=4\\n                          ->  Clustered Index Scan [PK__contract__F5AE5F62C9EFE249] on contract_sheet cs  (est Rows=80000 RowsRead=80000 IO=0.237199 CPU=0.0440785 SubtreeCost=0.281278 AvgRowSize=12) (actual Rows=80000 RowsRead=80000 Executions=4 Elapsedms=13 CPUms=50 Threads=4)\\n                                Node Id: 7  Mode: Row  Table Cardinality: 80000  Storage: RowStore\\n                                I/O: Scans=5 LogicalReads=952 EndOfScans=4\\n                                Output List: cs.product, cs.max_year\\n                                Defined Values: cs.product; cs.max_year\\n                          ->  Nested Loops (Inner Join)  (est Rows=1 RowsRead=1 Rebinds=79999 IO=0.003125 CPU=0.0001581 SubtreeCost=13.123 AvgRowSize=9) (actual Rows=240000 Executions=80000 Elapsedms=122 CPUms=487 Threads=4)\\n                                Node Id: 8  Mode: Row  Table Cardinality: 80000\\n                                Outer References: Expr1007, Expr1008, Expr1006\\n                                I/O: EndOfScans=80000\\n                                ->  Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=80000 Executions=80000 Elapsedms=13 CPUms=50 Threads=4)\\n                                      Node Id: 9  Mode: Row\\n                                      I/O: EndOfScans=80000\\n                                      Output List: Expr1007, Expr1008, Expr1006\\n                                      Defined Values: Expr1007, Expr1008, Expr1006 = GetRangeThroughConvert([contract_sheet].[max_year] as [cs].[max_year],NULL,(6))\\n                                      ->  Constant Scan  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=0) (actual Rows=80000 Executions=80000 Elapsedms=1 CPUms=4 Threads=4)\\n                                            Node Id: 10  Mode: Row\\n                                            I/O: EndOfScans=80000\\n                                ->  Index Seek [contracts_product_expiration99] on contracts c  (est Rows=1 RowsRead=1 Rebinds=79999 IO=0.003125 CPU=0.0001581 SubtreeCost=13.123 AvgRowSize=9) (actual Rows=240000 RowsRead=240000 Executions=80000 Elapsedms=96 CPUms=382 Threads=4)\\n                                      Node Id: 11  Mode: Row  Table Cardinality: 80000  Storage: RowStore  Ordered: FORWARD\\n                                      Seek Predicates: Prefix EQ c.product = [contract_sheet].[product] as [cs].[product]; Start GT c.expiration99 [Expr1007]; End LT c.expiration99 [Expr1008]\\n                                      I/O: Scans=80000 LogicalReads=190000 EndOfScans=80000\\nStatement: SELECT, optimization FULL, CE model 170\\nQuery Plan Hash: 0xE4474F8FFCA0D728\\nDegree Of Parallelism: 4  Used Threads: 4\\nMemory Grant: Granted=72kB MaxUsed=72kB Required=72kB Desired=72kB Requested=72kB GrantWaitTime=0ms\\nWait Stats: CXSYNC_PORT WaitTimeMs=153 WaitCount=5\\nCompile: Time=211ms CPU=121ms Memory=440kB CachedPlanSize=40kB\\nextra: 1\\nCPU Time: 599 ms\\nExecution Time: 150 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]},{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":800000},\"output\":\"outliving\\n2400000\",\"runtimeDurationMs\":2937,\"rowsAreCapped\":false,\"computeSeconds\":23.787,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0.0000001 SubtreeCost=135.896 AvgRowSize=11)\\n  Node Id: 1  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[globalagg1005],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0000017 SubtreeCost=135.896 AvgRowSize=15) (actual Rows=1 Executions=1 Elapsedms=2328 CPUms=0)\\n        Node Id: 2  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: globalagg1005\\n        Defined Values: globalagg1005 = SUM([partialagg1004])\\n        ->  Parallelism (Gather Streams)  (est Rows=2 IO=0 CPU=0.0285021 SubtreeCost=135.896 AvgRowSize=15) (actual Rows=4 Executions=1 Elapsedms=2328 CPUms=0)\\n              Node Id: 3  Mode: Row\\n              I/O: EndOfScans=1\\n              Output List: partialagg1004\\n              ->  Stream Aggregate (Aggregate)  (est Rows=2 IO=0 CPU=0.240001 SubtreeCost=135.867 AvgRowSize=15) (actual Rows=4 Executions=4 Elapsedms=2327 CPUms=5382 Threads=4)\\n                    Node Id: 4  Mode: Row\\n                    I/O: EndOfScans=4\\n                    Output List: partialagg1004\\n                    Defined Values: partialagg1004 = Count(*)\\n                    ->  Nested Loops (Inner Join)  (est Rows=800000 IO=0 CPU=1.672 SubtreeCost=135.587 AvgRowSize=9) (actual Rows=2400000 Executions=4 Elapsedms=2288 CPUms=5220 Threads=4)\\n                          Node Id: 6  Mode: Row\\n                          Outer References: cs.product, cs.max_year\\n                          I/O: EndOfScans=4\\n                          ->  Clustered Index Scan [PK__contract__F5AE5F62C039A501] on contract_sheet cs  (est Rows=800000 RowsRead=800000 IO=2.34535 CPU=0.440078 SubtreeCost=2.78543 AvgRowSize=12) (actual Rows=800000 RowsRead=800000 Executions=4 Elapsedms=105 CPUms=390 Threads=4)\\n                                Node Id: 7  Mode: Row  Table Cardinality: 800000  Storage: RowStore\\n                                I/O: Scans=5 LogicalReads=3272 EndOfScans=4\\n                                Output List: cs.product, cs.max_year\\n                                Defined Values: cs.product; cs.max_year\\n                          ->  Nested Loops (Inner Join)  (est Rows=1 RowsRead=1 Rebinds=799999 Rewinds=0.0012714 IO=0.003125 CPU=0.0001581 SubtreeCost=131.13 AvgRowSize=9) (actual Rows=2400000 Executions=800000 Elapsedms=2070 CPUms=4466 Threads=4)\\n                                Node Id: 8  Mode: Row  Table Cardinality: 800000\\n                                Outer References: Expr1007, Expr1008, Expr1006\\n                                I/O: EndOfScans=800000\\n                                ->  Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=17) (actual Rows=800000 Executions=800000 Elapsedms=130 CPUms=462 Threads=4)\\n                                      Node Id: 9  Mode: Row\\n                                      I/O: EndOfScans=800000\\n                                      Output List: Expr1007, Expr1008, Expr1006\\n                                      Defined Values: Expr1007, Expr1008, Expr1006 = GetRangeThroughConvert([contract_sheet].[max_year] as [cs].[max_year],NULL,(6))\\n                                      ->  Constant Scan  (est Rows=1 IO=0 CPU=0 SubtreeCost=0 AvgRowSize=0) (actual Rows=800000 Executions=800000 Elapsedms=28 CPUms=76 Threads=4)\\n                                            Node Id: 10  Mode: Row\\n                                            I/O: EndOfScans=800000\\n                                ->  Index Seek [contracts_product_expiration99] on contracts c  (est Rows=1 RowsRead=1 Rebinds=799999 Rewinds=0.0012714 IO=0.003125 CPU=0.0001581 SubtreeCost=131.13 AvgRowSize=9) (actual Rows=2400000 RowsRead=2400000 Executions=800000 Elapsedms=1791 CPUms=3549 Threads=4)\\n                                      Node Id: 11  Mode: Row  Table Cardinality: 800000  Storage: RowStore  Ordered: FORWARD\\n                                      Seek Predicates: Prefix EQ c.product = [contract_sheet].[product] as [cs].[product]; Start GT c.expiration99 [Expr1007]; End LT c.expiration99 [Expr1008]\\n                                      I/O: Scans=800000 LogicalReads=2700000 EndOfScans=800000\\nStatement: SELECT, optimization FULL, CE model 170\\nQuery Plan Hash: 0xD3D3FF6E7F6B5244\\nDegree Of Parallelism: 4  Used Threads: 4\\nMemory Grant: Granted=72kB MaxUsed=72kB Required=72kB Desired=72kB Requested=72kB GrantWaitTime=0ms\\nStatistics Used: [_WA_Sys_00000003_42ECDBF6] on contract_sheet (sampled 36.086%)\\nStatistics Used: [_WA_Sys_00000003_41049384] on contracts (sampled 12.405%)\\nStatistics Used: [contracts_product_expiration99] on contracts (sampled 11.807%)\\nStatistics Used: [_WA_Sys_00000004_41049384] on contracts (sampled 10.316%)\\nStatistics Used: [_WA_Sys_00000002_42ECDBF6] on contract_sheet (sampled 36.086%)\\nStatistics Used: [contracts_product_expiration] on contracts (sampled 11.807%)\\nWait Stats: SOS_SCHEDULER_YIELD WaitTimeMs=3666 WaitCount=1331\\nWait Stats: RESOURCE_GOVERNOR_IDLE WaitTimeMs=3573 WaitCount=415\\nWait Stats: CXSYNC_PORT WaitTimeMs=2597 WaitCount=5\\nCompile: Time=590ms CPU=20ms Memory=632kB CachedPlanSize=48kB\\nextra: 1\\nCPU Time: 5384 ms\\nExecution Time: 2328 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]}],\"workerId\":\"0aa8085f-26a5-4ce3-a659-470291ed31bc\",\"correlationId\":\"ef7039aa-b758-4e4a-b26c-8ab67e524cf1\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "SQL Server (Azure SQL Database) with dateOr99 inlined plus the indexed computed column expiration99, the main run's query and tables, in a later call at 8,000, 80,000 and 800,000 sheet lines. The query still calls dateOr99, and the plan seeks the computed column at every size.",
      "planCaptions": {
        "8K": "At 8,000 sheet lines SQL Server runs the main run's plan on one thread: the Index Seek on contracts_product_expiration99 runs 8,000 times, once per sheet line, and the call takes 30 ms.",
        "80K": "At 80,000 lines SQL Server still seeks the computed column's index once per sheet line, 80,000 times, now on 4 threads: 150 ms of Execution Time and 599 ms of CPU Time.",
        "800K": "At 800,000 lines the Index Seek runs 800,000 times on 4 threads and returns 2,400,000 matches, three per sheet line. The call takes 2,328 ms, with 5,384 ms of CPU Time."
      }
    },
    "ssGrowthChart80k": {
      "type": "chart",
      "chartType": "split-scale",
      "x": [
        8000,
        40000,
        80000
      ],
      "xTicks": [
        8000,
        40000,
        80000
      ],
      "xLabel": "Sheet lines in the join, to scale (with as many contracts)",
      "xUnit": "sheet lines",
      "splitAt": 1000,
      "upper": {
        "title": "Calls of a second or more (seconds)",
        "unit": "s",
        "divisor": 1000,
        "max": 70,
        "ticks": [
          0,
          20,
          40,
          60
        ]
      },
      "lower": {
        "title": "Calls under a second (milliseconds)",
        "unit": "ms",
        "divisor": 1,
        "max": 800,
        "ticks": [
          0,
          200,
          400,
          600,
          800
        ]
      },
      "series": [
        {
          "label": "UDF, inlined (SQL Server 2019 and later)",
          "shortLabel": "Inlined",
          "data": [
            630,
            15913,
            63772
          ],
          "color": "#eb6834",
          "style": "solid"
        },
        {
          "label": "Hand-written IS NULL OR >",
          "shortLabel": "IS NULL OR >",
          "data": [
            192,
            481,
            1018
          ],
          "color": "#199e70",
          "style": "solid"
        },
        {
          "label": "UDF, inlined, plus an indexed computed column",
          "shortLabel": "Computed column",
          "data": [
            30,
            73,
            150
          ],
          "color": "#c98500",
          "style": "solid"
        }
      ],
      "caption": "SQL Server's Execution Time at 8,000, 40,000 and 80,000 sheet lines for three versions of the join: dateOr99 inlined, the hand-written IS NULL OR >, and the inlined dateOr99 with an indexed computed column. The 8,000 and 80,000-line points are the cards' calls, and each 40,000-line point is a later call on the same database as its line's card. Inlining off ran only up to 8,000 lines and isn't drawn.",
      "subtitle": "Both panels are linear and share one x-axis drawn to scale: calls of a second or more above, in seconds, and shorter calls below, in milliseconds. A dotted line is a jump from one panel to the other.",
      "dataAsProse": "Execution Time per point, one execution each, from each plan's Execution Time line. UDF, inlined (SQL Server 2019 and later): 630 ms at 8,000 sheet lines, 15,913 ms at 40,000 and 63,772 ms at 80,000. Hand-written IS NULL OR >: 192 ms at 8,000 sheet lines, 481 ms at 40,000 and 1,018 ms at 80,000. UDF, inlined, plus an indexed computed column: 30 ms at 8,000 sheet lines, 73 ms at 40,000 and 150 ms at 80,000.",
      "summaryCaption": "The inlined UDF quadruples with every doubling of the lines, from the milliseconds panel to over a minute at 80,000, while the hand-written condition and the computed column barely leave the floor."
    },
    "pg18HandWritten": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "POSTGRES_18",
        "schemaTemplate": "CREATE TABLE contracts (id int PRIMARY KEY, product char(2) NOT NULL, expiration_date date);\nINSERT INTO contracts\nSELECT i, (ARRAY['CL','BZ','NG','HO','RB','QM','QG','HH'])[i % 8 + 1],\n       CASE WHEN i <= 24 THEN NULL ELSE DATE '2026-01-02' + (i - 1) / 8 END\nFROM generate_series(1, ${N}) i;\nCREATE INDEX contracts_product_expiration ON contracts (product, expiration_date);\nCREATE TABLE contract_sheet (line_id int PRIMARY KEY, product char(2) NOT NULL, max_year date NOT NULL);\nINSERT INTO contract_sheet\nSELECT i, (ARRAY['CL','BZ','NG','HO','RB','QM','QG','HH'])[i % 8 + 1], DATE '2026-01-02' + (${N} / 8 + i)\nFROM generate_series(1, ${N}) i;\nCREATE FUNCTION dateOr99(d date) RETURNS date LANGUAGE plpgsql AS $$ BEGIN RETURN COALESCE(d, DATE '9999-01-01'); END $$;\nVACUUM ANALYZE;",
        "scalePoints": [
          {
            "N": 1000
          },
          {
            "N": 2000
          },
          {
            "N": 4000
          },
          {
            "N": 8000
          }
        ],
        "query": "EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND (c.expiration_date IS NULL OR c.expiration_date > cs.max_year)",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:30:18.490935603Z\",\"databaseType\":\"postgres_18\",\"sql\":\"EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND (c.expiration_date IS NULL OR c.expiration_date > cs.max_year)\",\"warmCacheIterations\":0,\"seed\":2246177544,\"seedSource\":\"default\",\"scalePointCount\":4,\"totalComputeSeconds\":3.908,\"results\":[{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":1000},\"output\":\"QUERY PLAN\\nAggregate  (cost=1874.92..1874.93 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=12\\n  ->  Hash Join  (cost=28.50..1765.75 rows=43667 width=0) (actual rows=3000.00 loops=1)\\n        Hash Cond: (cs.product = c.product)\\n        Join Filter: ((c.expiration_date IS NULL) OR (c.expiration_date > cs.max_year))\\n        Rows Removed by Join Filter: 122000\\n        Buffers: shared hit=12\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..16.00 rows=1000 width=7) (actual rows=1000.00 loops=1)\\n              Buffers: shared hit=6\\n        ->  Hash  (cost=16.00..16.00 rows=1000 width=7) (actual rows=1000.00 loops=1)\\n              Buckets: 1024  Batches: 1  Memory Usage: 47kB\\n              Buffers: shared hit=6\\n              ->  Seq Scan on contracts c  (cost=0.00..16.00 rows=1000 width=7) (actual rows=1000.00 loops=1)\\n                    Buffers: shared hit=6\\nPlanning:\\n  Buffers: shared hit=108\\nPlanning Time: 0.266 ms\\nExecution Time: 7.017 ms\",\"runtimeDurationMs\":22,\"rowsAreCapped\":false,\"computeSeconds\":0.805},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":2000},\"output\":\"QUERY PLAN\\nAggregate  (cost=7393.67..7393.68 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=22\\n  ->  Hash Join  (cost=56.00..6967.00 rows=170667 width=0) (actual rows=6000.00 loops=1)\\n        Hash Cond: (cs.product = c.product)\\n        Join Filter: ((c.expiration_date IS NULL) OR (c.expiration_date > cs.max_year))\\n        Rows Removed by Join Filter: 494000\\n        Buffers: shared hit=22\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..31.00 rows=2000 width=7) (actual rows=2000.00 loops=1)\\n              Buffers: shared hit=11\\n        ->  Hash  (cost=31.00..31.00 rows=2000 width=7) (actual rows=2000.00 loops=1)\\n              Buckets: 2048  Batches: 1  Memory Usage: 95kB\\n              Buffers: shared hit=11\\n              ->  Seq Scan on contracts c  (cost=0.00..31.00 rows=2000 width=7) (actual rows=2000.00 loops=1)\\n                    Buffers: shared hit=11\\nPlanning:\\n  Buffers: shared hit=108\\nPlanning Time: 0.273 ms\\nExecution Time: 27.206 ms\",\"runtimeDurationMs\":42,\"rowsAreCapped\":false,\"computeSeconds\":0.854},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":4000},\"output\":\"QUERY PLAN\\nAggregate  (cost=29370.67..29370.68 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=44\\n  ->  Hash Join  (cost=112.00..27684.00 rows=674667 width=0) (actual rows=12000.00 loops=1)\\n        Hash Cond: (cs.product = c.product)\\n        Join Filter: ((c.expiration_date IS NULL) OR (c.expiration_date > cs.max_year))\\n        Rows Removed by Join Filter: 1988000\\n        Buffers: shared hit=44\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..62.00 rows=4000 width=7) (actual rows=4000.00 loops=1)\\n              Buffers: shared hit=22\\n        ->  Hash  (cost=62.00..62.00 rows=4000 width=7) (actual rows=4000.00 loops=1)\\n              Buckets: 4096  Batches: 1  Memory Usage: 189kB\\n              Buffers: shared hit=22\\n              ->  Seq Scan on contracts c  (cost=0.00..62.00 rows=4000 width=7) (actual rows=4000.00 loops=1)\\n                    Buffers: shared hit=22\\nPlanning:\\n  Buffers: shared hit=108\\nPlanning Time: 0.270 ms\\nExecution Time: 107.233 ms\",\"runtimeDurationMs\":122,\"rowsAreCapped\":false,\"computeSeconds\":0.938},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":8000},\"output\":\"QUERY PLAN\\nAggregate  (cost=117074.67..117074.68 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=88\\n  ->  Hash Join  (cost=224.00..110368.00 rows=2682667 width=0) (actual rows=24000.00 loops=1)\\n        Hash Cond: (cs.product = c.product)\\n        Join Filter: ((c.expiration_date IS NULL) OR (c.expiration_date > cs.max_year))\\n        Rows Removed by Join Filter: 7976000\\n        Buffers: shared hit=88\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..124.00 rows=8000 width=7) (actual rows=8000.00 loops=1)\\n              Buffers: shared hit=44\\n        ->  Hash  (cost=124.00..124.00 rows=8000 width=7) (actual rows=8000.00 loops=1)\\n              Buckets: 8192  Batches: 1  Memory Usage: 377kB\\n              Buffers: shared hit=44\\n              ->  Seq Scan on contracts c  (cost=0.00..124.00 rows=8000 width=7) (actual rows=8000.00 loops=1)\\n                    Buffers: shared hit=44\\nPlanning:\\n  Buffers: shared hit=108\\nPlanning Time: 0.285 ms\\nExecution Time: 428.283 ms\",\"runtimeDurationMs\":445,\"rowsAreCapped\":false,\"computeSeconds\":1.311}],\"workerId\":\"2eba9755-c35f-47b2-a79f-0e91a0cf4007\",\"correlationId\":\"196dac5b-e90b-4ad1-a27a-518addf72616\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "PG18 (PostgreSQL 18.7) with the hand-written IS NULL OR >, the condition that turned into index seeks on SQL Server, in the same join at 1,000 to 8,000 sheet lines: EXPLAIN (ANALYZE, TIMING OFF), one execution per size.",
      "planCaptions": {
        "1K": "At 1,000 sheet lines PG18 hashes the contracts on product and runs the whole OR as a Join Filter on every sheet line and contract that share a product. It removes 122,000 of those pairs and keeps 3,000, in 7.017 ms.",
        "2K": "At 2,000 lines PG18 runs the same Hash Join with the OR in the Join Filter, now removing 494,000 pairs, and the call takes 27.206 ms, close to four times as long as at half the size.",
        "4K": "At 4,000 lines PG18's Join Filter removes 1,988,000 pairs and the call takes 107.233 ms: twice the sheet lines, four times the pairs, and about four times the time.",
        "8K": "At 8,000 lines PG18's Join Filter removes 7,976,000 pairs and the call takes 428.283 ms. The plan reads contracts with a Seq Scan and tests the hand-written condition on every pair."
      }
    },
    "pg18HandWritten80k": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "POSTGRES_18",
        "schemaTemplate": "CREATE TABLE contracts (id int PRIMARY KEY, product char(2) NOT NULL, expiration_date date);\nINSERT INTO contracts\nSELECT i, (ARRAY['CL','BZ','NG','HO','RB','QM','QG','HH'])[i % 8 + 1],\n       CASE WHEN i <= 24 THEN NULL ELSE DATE '2026-01-02' + (i - 1) / 8 END\nFROM generate_series(1, ${N}) i;\nCREATE INDEX contracts_product_expiration ON contracts (product, expiration_date);\nCREATE TABLE contract_sheet (line_id int PRIMARY KEY, product char(2) NOT NULL, max_year date NOT NULL);\nINSERT INTO contract_sheet\nSELECT i, (ARRAY['CL','BZ','NG','HO','RB','QM','QG','HH'])[i % 8 + 1], DATE '2026-01-02' + (${N} / 8 + i)\nFROM generate_series(1, ${N}) i;\nCREATE FUNCTION dateOr99(d date) RETURNS date LANGUAGE plpgsql AS $$ BEGIN RETURN COALESCE(d, DATE '9999-01-01'); END $$;\nVACUUM ANALYZE;",
        "scalePoints": [
          {
            "N": 8000
          },
          {
            "N": 80000
          }
        ],
        "query": "EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND (c.expiration_date IS NULL OR c.expiration_date > cs.max_year)",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "c0c2143c-3dc7-4e99-9e26-13a4fddef82c"
      },
      "result": "{\"timestamp\":\"2026-11-20T16:19:08.736821936Z\",\"databaseType\":\"postgres_18\",\"sql\":\"EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND (c.expiration_date IS NULL OR c.expiration_date > cs.max_year)\",\"warmCacheIterations\":0,\"seed\":3540833074,\"seedSource\":\"default\",\"scalePointCount\":2,\"totalComputeSeconds\":16.571,\"results\":[{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":8000},\"output\":\"QUERY PLAN\\nAggregate  (cost=117074.67..117074.68 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=88\\n  ->  Hash Join  (cost=224.00..110368.00 rows=2682667 width=0) (actual rows=24000.00 loops=1)\\n        Hash Cond: (cs.product = c.product)\\n        Join Filter: ((c.expiration_date IS NULL) OR (c.expiration_date > cs.max_year))\\n        Rows Removed by Join Filter: 7976000\\n        Buffers: shared hit=88\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..124.00 rows=8000 width=7) (actual rows=8000.00 loops=1)\\n              Buffers: shared hit=44\\n        ->  Hash  (cost=124.00..124.00 rows=8000 width=7) (actual rows=8000.00 loops=1)\\n              Buckets: 8192  Batches: 1  Memory Usage: 377kB\\n              Buffers: shared hit=44\\n              ->  Seq Scan on contracts c  (cost=0.00..124.00 rows=8000 width=7) (actual rows=8000.00 loops=1)\\n                    Buffers: shared hit=44\\nPlanning:\\n  Buffers: shared hit=108\\nPlanning Time: 0.259 ms\\nExecution Time: 425.220 ms\",\"runtimeDurationMs\":439,\"rowsAreCapped\":false,\"computeSeconds\":1.315},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":80000},\"output\":\"QUERY PLAN\\nFinalize Aggregate  (cost=4872450.01..4872450.02 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=1342 read=220\\n  ->  Gather  (cost=4872449.80..4872450.01 rows=2 width=8) (actual rows=3.00 loops=1)\\n        Workers Planned: 2\\n        Workers Launched: 2\\n        Buffers: shared hit=1342 read=220\\n        ->  Partial Aggregate  (cost=4871449.80..4871449.81 rows=1 width=8) (actual rows=1.00 loops=3)\\n              Buffers: shared hit=1342 read=220\\n              ->  Hash Join  (cost=2233.29..4593421.64 rows=111211262 width=0) (actual rows=80000.00 loops=3)\\n                    Hash Cond: (c.product = cs.product)\\n                    Join Filter: ((c.expiration_date IS NULL) OR (c.expiration_date > cs.max_year))\\n                    Rows Removed by Join Filter: 266586667\\n                    Buffers: shared hit=1342 read=220\\n                    ->  Parallel Index Only Scan using contracts_product_expiration on contracts c  (cost=0.29..1617.63 rows=33333 width=7) (actual rows=26666.67 loops=3)\\n                          Heap Fetches: 0\\n                          Index Searches: 1\\n                          Buffers: shared hit=3 read=220\\n                    ->  Hash  (cost=1233.00..1233.00 rows=80000 width=7) (actual rows=80000.00 loops=3)\\n                          Buckets: 131072  Batches: 1  Memory Usage: 4149kB\\n                          Buffers: shared hit=1339\\n                          ->  Seq Scan on contract_sheet cs  (cost=0.00..1233.00 rows=80000 width=7) (actual rows=80000.00 loops=3)\\n                                Buffers: shared hit=1339\\nPlanning:\\n  Buffers: shared hit=108\\nPlanning Time: 0.291 ms\\nExecution Time: 13998.132 ms\",\"runtimeDurationMs\":14016,\"rowsAreCapped\":false,\"computeSeconds\":15.256}],\"workerId\":\"43eed8ea-a5a6-4243-a33d-8b573e9971a8\",\"correlationId\":\"2d741c47-2d45-4b1f-85d9-61ea093d3a97\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "PG18 (PostgreSQL 18.7) with the hand-written IS NULL OR >, the main run's query and tables, at 8,000 and 80,000 sheet lines in a later call: EXPLAIN (ANALYZE, TIMING OFF), one execution per size.",
      "planCaptions": {
        "8K": "At 8,000 sheet lines PG18 runs the same Hash Join as in the main run, in one process: its Join Filter removes 7,976,000 pairs and the call takes 425.220 ms.",
        "80K": "At 80,000 lines PG18 runs the join in parallel, Workers Launched: 2, so with the leader the Hash Join runs 3 times (loops=3), each hashing all 80,000 sheet lines and reading a share of the contracts. Its Join Filter removes 266,586,667 pairs per loop, and the call takes 13,998.132 ms."
      }
    },
    "pg18ExpressionIndex": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "POSTGRES_18",
        "schemaTemplate": "CREATE TABLE contracts (id int PRIMARY KEY, product char(2) NOT NULL, expiration_date date);\nINSERT INTO contracts\nSELECT i, (ARRAY['CL','BZ','NG','HO','RB','QM','QG','HH'])[i % 8 + 1],\n       CASE WHEN i <= 24 THEN NULL ELSE DATE '2026-01-02' + (i - 1) / 8 END\nFROM generate_series(1, ${N}) i;\nCREATE INDEX contracts_product_expiration ON contracts (product, expiration_date);\nCREATE TABLE contract_sheet (line_id int PRIMARY KEY, product char(2) NOT NULL, max_year date NOT NULL);\nINSERT INTO contract_sheet\nSELECT i, (ARRAY['CL','BZ','NG','HO','RB','QM','QG','HH'])[i % 8 + 1], DATE '2026-01-02' + (${N} / 8 + i)\nFROM generate_series(1, ${N}) i;\nCREATE FUNCTION dateOr99(d date) RETURNS date LANGUAGE sql IMMUTABLE AS $$ SELECT COALESCE(d, DATE '9999-01-01') $$;\nCREATE INDEX contracts_product_expiration99 ON contracts (product, dateOr99(expiration_date));\nVACUUM ANALYZE;",
        "scalePoints": [
          {
            "N": 1000
          },
          {
            "N": 2000
          },
          {
            "N": 4000
          },
          {
            "N": 8000
          }
        ],
        "query": "EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND dateOr99(c.expiration_date) > cs.max_year",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:30:24.330868609Z\",\"databaseType\":\"postgres_18\",\"sql\":\"EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND dateOr99(c.expiration_date) > cs.max_year\",\"warmCacheIterations\":0,\"seed\":1161350697,\"seedSource\":\"default\",\"scalePointCount\":4,\"totalComputeSeconds\":3.443,\"results\":[{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":1000},\"output\":\"QUERY PLAN\\nAggregate  (cost=1699.17..1699.18 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=3002 read=4\\n  ->  Nested Loop  (cost=0.28..1595.00 rows=41667 width=0) (actual rows=3000.00 loops=1)\\n        Buffers: shared hit=3002 read=4\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..16.00 rows=1000 width=7) (actual rows=1000.00 loops=1)\\n              Buffers: shared hit=6\\n        ->  Index Scan using contracts_product_expiration99 on contracts c  (cost=0.28..1.16 rows=42 width=7) (actual rows=3.00 loops=1000)\\n              Index Cond: ((product = cs.product) AND (COALESCE(expiration_date, '9999-01-01'::date) > cs.max_year))\\n              Index Searches: 1000\\n              Buffers: shared hit=2996 read=4\\nPlanning:\\n  Buffers: shared hit=143\\nPlanning Time: 0.283 ms\\nExecution Time: 1.663 ms\",\"runtimeDurationMs\":17,\"rowsAreCapped\":false,\"computeSeconds\":0.872},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":2000},\"output\":\"QUERY PLAN\\nAggregate  (cost=6058.67..6058.68 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=6004 read=7\\n  ->  Nested Loop  (cost=0.28..5642.00 rows=166667 width=0) (actual rows=6000.00 loops=1)\\n        Buffers: shared hit=6004 read=7\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..31.00 rows=2000 width=7) (actual rows=2000.00 loops=1)\\n              Buffers: shared hit=11\\n        ->  Index Scan using contracts_product_expiration99 on contracts c  (cost=0.28..1.98 rows=83 width=7) (actual rows=3.00 loops=2000)\\n              Index Cond: ((product = cs.product) AND (COALESCE(expiration_date, '9999-01-01'::date) > cs.max_year))\\n              Index Searches: 2000\\n              Buffers: shared hit=5993 read=7\\nPlanning:\\n  Buffers: shared hit=143\\nPlanning Time: 0.310 ms\\nExecution Time: 3.421 ms\",\"runtimeDurationMs\":17,\"rowsAreCapped\":false,\"computeSeconds\":0.786},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":4000},\"output\":\"QUERY PLAN\\nAggregate  (cost=23028.67..23028.68 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=12013 read=9\\n  ->  Nested Loop  (cost=0.28..21362.00 rows=666667 width=0) (actual rows=12000.00 loops=1)\\n        Buffers: shared hit=12013 read=9\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..62.00 rows=4000 width=7) (actual rows=4000.00 loops=1)\\n              Buffers: shared hit=22\\n        ->  Index Scan using contracts_product_expiration99 on contracts c  (cost=0.28..3.66 rows=167 width=7) (actual rows=3.00 loops=4000)\\n              Index Cond: ((product = cs.product) AND (COALESCE(expiration_date, '9999-01-01'::date) > cs.max_year))\\n              Index Searches: 4000\\n              Buffers: shared hit=11991 read=9\\nPlanning:\\n  Buffers: shared hit=143\\nPlanning Time: 0.346 ms\\nExecution Time: 6.668 ms\",\"runtimeDurationMs\":23,\"rowsAreCapped\":false,\"computeSeconds\":0.894},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":8000},\"output\":\"QUERY PLAN\\nAggregate  (cost=89242.67..89242.68 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=24035 read=9\\n  ->  Nested Loop  (cost=0.28..82576.00 rows=2666667 width=0) (actual rows=24000.00 loops=1)\\n        Buffers: shared hit=24035 read=9\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..124.00 rows=8000 width=7) (actual rows=8000.00 loops=1)\\n              Buffers: shared hit=44\\n        ->  Index Scan using contracts_product_expiration99 on contracts c  (cost=0.28..6.98 rows=333 width=7) (actual rows=3.00 loops=8000)\\n              Index Cond: ((product = cs.product) AND (COALESCE(expiration_date, '9999-01-01'::date) > cs.max_year))\\n              Index Searches: 8000\\n              Buffers: shared hit=23991 read=9\\nPlanning:\\n  Buffers: shared hit=143\\nPlanning Time: 0.346 ms\\nExecution Time: 13.387 ms\",\"runtimeDurationMs\":28,\"rowsAreCapped\":false,\"computeSeconds\":0.891}],\"workerId\":\"4cb5d5ee-34a8-4ed5-9ee7-939b8f708bd9\",\"correlationId\":\"7f0c95e2-fafb-4958-934c-98281d21dd8e\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "PG18 (PostgreSQL 18.7) with dateOr99 as a LANGUAGE sql function declared IMMUTABLE and an index on (product, dateOr99(expiration_date)), the query unchanged: the same join at 1,000 to 8,000 sheet lines, one execution per size.",
      "planCaptions": {
        "1K": "At 1,000 sheet lines PG18 inlines dateOr99 into its COALESCE, matches it to the expression index, and puts the date test in the Index Cond: a Nested Loop that searches contracts_product_expiration99 once per sheet line, in 1.663 ms.",
        "2K": "At 2,000 lines PG18's Nested Loop makes 2,000 index searches, each returning the 3 contracts that never expire, in 3.421 ms.",
        "4K": "At 4,000 lines PG18's time doubles with the lines, to 6.668 ms: one index search per sheet line, and nothing checked pair by pair.",
        "8K": "At 8,000 lines PG18's Nested Loop runs 8,000 index searches in 13.387 ms. The function is still in the query, but the index turns its date test into a search instead of a check on every pair."
      }
    },
    "pg18UnionAll80k": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "POSTGRES_18",
        "schemaTemplate": "CREATE TABLE contracts (id int PRIMARY KEY, product char(2) NOT NULL, expiration_date date);\nINSERT INTO contracts\nSELECT i, (ARRAY['CL','BZ','NG','HO','RB','QM','QG','HH'])[i % 8 + 1],\n       CASE WHEN i <= 24 THEN NULL ELSE DATE '2026-01-02' + (i - 1) / 8 END\nFROM generate_series(1, ${N}) i;\nCREATE INDEX contracts_product_expiration ON contracts (product, expiration_date);\nCREATE TABLE contract_sheet (line_id int PRIMARY KEY, product char(2) NOT NULL, max_year date NOT NULL);\nINSERT INTO contract_sheet\nSELECT i, (ARRAY['CL','BZ','NG','HO','RB','QM','QG','HH'])[i % 8 + 1], DATE '2026-01-02' + (${N} / 8 + i)\nFROM generate_series(1, ${N}) i;\nCREATE FUNCTION dateOr99(d date) RETURNS date LANGUAGE plpgsql AS $$ BEGIN RETURN COALESCE(d, DATE '9999-01-01'); END $$;\nVACUUM ANALYZE;",
        "scalePoints": [
          {
            "N": 8000
          },
          {
            "N": 80000
          }
        ],
        "query": "EXPLAIN (ANALYZE, TIMING OFF) SELECT sum(n) AS outliving FROM (SELECT count(*) AS n FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND c.expiration_date IS NULL UNION ALL SELECT count(*) FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND c.expiration_date > cs.max_year) t",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "9553ba06-9556-4e44-9561-69aa368dbc60"
      },
      "result": "{\"timestamp\":\"2026-11-20T16:28:12.495585021Z\",\"databaseType\":\"postgres_18\",\"sql\":\"EXPLAIN (ANALYZE, TIMING OFF) SELECT sum(n) AS outliving FROM (SELECT count(*) AS n FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND c.expiration_date IS NULL UNION ALL SELECT count(*) FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND c.expiration_date > cs.max_year) t\",\"warmCacheIterations\":0,\"seed\":3583333341,\"seedSource\":\"default\",\"scalePointCount\":2,\"totalComputeSeconds\":15.283000000000001,\"results\":[{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":8000},\"output\":\"QUERY PLAN\\nAggregate  (cost=89653.89..89653.90 rows=1 width=32) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=24104 read=9\\n  ->  Append  (cost=587.18..89653.88 rows=2 width=8) (actual rows=2.00 loops=1)\\n        Buffers: shared hit=24104 read=9\\n        ->  Aggregate  (cost=587.18..587.19 rows=1 width=8) (actual rows=1.00 loops=1)\\n              Buffers: shared hit=60 read=9\\n              ->  Nested Loop  (cost=0.29..527.18 rows=24000 width=0) (actual rows=24000.00 loops=1)\\n                    Buffers: shared hit=60 read=9\\n                    ->  Seq Scan on contract_sheet cs  (cost=0.00..124.00 rows=8000 width=3) (actual rows=8000.00 loops=1)\\n                          Buffers: shared hit=44\\n                    ->  Memoize  (cost=0.29..0.36 rows=3 width=3) (actual rows=3.00 loops=8000)\\n                          Cache Key: cs.product\\n                          Cache Mode: logical\\n                          Hits: 7992  Misses: 8  Evictions: 0  Overflows: 0  Memory Usage: 2kB\\n                          Buffers: shared hit=16 read=9\\n                          ->  Index Only Scan using contracts_product_expiration on contracts c  (cost=0.28..0.35 rows=3 width=3) (actual rows=3.00 loops=8)\\n                                Index Cond: ((product = cs.product) AND (expiration_date IS NULL))\\n                                Heap Fetches: 0\\n                                Index Searches: 8\\n                                Buffers: shared hit=16 read=9\\n        ->  Aggregate  (cost=89066.67..89066.68 rows=1 width=8) (actual rows=1.00 loops=1)\\n              Buffers: shared hit=24044\\n              ->  Nested Loop  (cost=0.28..82400.00 rows=2666667 width=0) (actual rows=0.00 loops=1)\\n                    Buffers: shared hit=24044\\n                    ->  Seq Scan on contract_sheet cs_1  (cost=0.00..124.00 rows=8000 width=7) (actual rows=8000.00 loops=1)\\n                          Buffers: shared hit=44\\n                    ->  Index Only Scan using contracts_product_expiration on contracts c_1  (cost=0.28..6.95 rows=333 width=7) (actual rows=0.00 loops=8000)\\n                          Index Cond: ((product = cs_1.product) AND (expiration_date > cs_1.max_year))\\n                          Heap Fetches: 0\\n                          Index Searches: 8000\\n                          Buffers: shared hit=24000\\nPlanning:\\n  Buffers: shared hit=148\\nPlanning Time: 0.340 ms\\nExecution Time: 13.387 ms\",\"runtimeDurationMs\":30,\"rowsAreCapped\":false,\"computeSeconds\":0.931},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":80000},\"output\":\"QUERY PLAN\\nAggregate  (cost=4885278.78..4885278.79 rows=1 width=32) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=1800 read=220\\n  ->  Append  (cost=5911.30..4885278.77 rows=2 width=8) (actual rows=2.00 loops=1)\\n        Buffers: shared hit=1800 read=220\\n        ->  Aggregate  (cost=5911.30..5911.31 rows=1 width=8) (actual rows=1.00 loops=1)\\n              Buffers: shared hit=449 read=9\\n              ->  Nested Loop  (cost=0.30..5236.26 rows=270015 width=0) (actual rows=240000.00 loops=1)\\n                    Buffers: shared hit=449 read=9\\n                    ->  Seq Scan on contract_sheet cs  (cost=0.00..1233.00 rows=80000 width=3) (actual rows=80000.00 loops=1)\\n                          Buffers: shared hit=433\\n                    ->  Memoize  (cost=0.30..0.37 rows=3 width=3) (actual rows=3.00 loops=80000)\\n                          Cache Key: cs.product\\n                          Cache Mode: logical\\n                          Hits: 79992  Misses: 8  Evictions: 0  Overflows: 0  Memory Usage: 2kB\\n                          Buffers: shared hit=16 read=9\\n                          ->  Index Only Scan using contracts_product_expiration on contracts c  (cost=0.29..0.36 rows=3 width=3) (actual rows=3.00 loops=8)\\n                                Index Cond: ((product = cs.product) AND (expiration_date IS NULL))\\n                                Heap Fetches: 0\\n                                Index Searches: 8\\n                                Buffers: shared hit=16 read=9\\n        ->  Finalize Aggregate  (cost=4879367.44..4879367.45 rows=1 width=8) (actual rows=1.00 loops=1)\\n              Buffers: shared hit=1351 read=211\\n              ->  Gather  (cost=4879367.22..4879367.43 rows=2 width=8) (actual rows=3.00 loops=1)\\n                    Workers Planned: 2\\n                    Workers Launched: 2\\n                    Buffers: shared hit=1351 read=211\\n                    ->  Partial Aggregate  (cost=4878367.22..4878367.23 rows=1 width=8) (actual rows=1.00 loops=3)\\n                          Buffers: shared hit=1351 read=211\\n                          ->  Hash Join  (cost=2233.29..4600574.25 rows=111117189 width=0) (actual rows=0.00 loops=3)\\n                                Hash Cond: (c_1.product = cs_1.product)\\n                                Join Filter: (c_1.expiration_date > cs_1.max_year)\\n                                Rows Removed by Join Filter: 266666667\\n                                Buffers: shared hit=1351 read=211\\n                                ->  Parallel Index Only Scan using contracts_product_expiration on contracts c_1  (cost=0.29..1617.63 rows=33333 width=7) (actual rows=26666.67 loops=3)\\n                                      Heap Fetches: 0\\n                                      Index Searches: 1\\n                                      Buffers: shared hit=12 read=211\\n                                ->  Hash  (cost=1233.00..1233.00 rows=80000 width=7) (actual rows=80000.00 loops=3)\\n                                      Buckets: 131072  Batches: 1  Memory Usage: 4149kB\\n                                      Buffers: shared hit=1339\\n                                      ->  Seq Scan on contract_sheet cs_1  (cost=0.00..1233.00 rows=80000 width=7) (actual rows=80000.00 loops=3)\\n                                            Buffers: shared hit=1339\\nPlanning:\\n  Buffers: shared hit=148\\nPlanning Time: 0.382 ms\\nExecution Time: 13140.531 ms\",\"runtimeDurationMs\":13158,\"rowsAreCapped\":false,\"computeSeconds\":14.352}],\"workerId\":\"40a6f467-e9ce-48a8-bdc9-b062cae9d0ef\",\"correlationId\":\"287cf27e-d22e-4488-91c4-242acf8e7822\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "PG18 (PostgreSQL 18.7) with the condition split into a UNION ALL of two counts, the main run's query and tables, at 8,000 and 80,000 sheet lines in a later call.",
      "planCaptions": {
        "8K": "At 8,000 sheet lines PG18 plans the split as in the main run: the > half searches contracts_product_expiration 8,000 times in a Nested Loop and finds nothing, the IS NULL half answers 7,992 of its lookups from a Memoize cache, and the call takes 13.387 ms.",
        "80K": "At 80,000 lines PG18 stops searching the index for the > half. It hashes the sheet on product in a parallel Hash Join, Workers Launched: 2, and its Join Filter, expiration_date > max_year, removes 266,666,667 pairs in each of its 3 loops and keeps none. The IS NULL half still takes 79,992 cache hits, and the call takes 13,140.531 ms."
      }
    },
    "pgGrowthChart": {
      "type": "chart",
      "chartType": "split-scale",
      "x": [
        1000,
        2000,
        4000,
        8000,
        80000
      ],
      "xTicks": [
        1000,
        2000,
        4000,
        8000,
        80000
      ],
      "xLabel": "Sheet lines in the join, on a log scale (with as many contracts)",
      "xUnit": "sheet lines",
      "splitAt": 1000,
      "upper": {
        "title": "Calls of a second or more (seconds)",
        "unit": "s",
        "divisor": 1000,
        "max": 15,
        "ticks": [
          0,
          5,
          10,
          15
        ]
      },
      "lower": {
        "title": "Calls under a second (milliseconds)",
        "unit": "ms",
        "divisor": 1,
        "max": 500,
        "ticks": [
          0,
          100,
          200,
          300,
          400,
          500
        ]
      },
      "series": [
        {
          "label": "Hand-written IS NULL OR >",
          "shortLabel": "IS NULL OR >",
          "data": [
            7.017,
            27.206,
            107.233,
            428.283,
            13998.132
          ],
          "color": "#199e70",
          "style": "solid"
        },
        {
          "label": "UNION ALL split, no function",
          "shortLabel": "UNION ALL",
          "data": [
            1.548,
            3.087,
            6.37,
            13.226,
            13140.531
          ],
          "color": "#6250d6",
          "style": "solid"
        },
        {
          "label": "dateOr99 declared IMMUTABLE, with an index on its result",
          "shortLabel": "Expression index",
          "data": [
            1.663,
            3.421,
            6.668,
            13.387,
            136.601
          ],
          "color": "#c98500",
          "style": "solid"
        }
      ],
      "caption": "PG18's Execution Time against sheet lines for three versions of the join: the hand-written IS NULL OR >, the UNION ALL split, and dateOr99 declared IMMUTABLE with an index on its result. Each point is one execution, from the main run up to 8,000 lines and from three later calls at 80,000, which matched the main run within about one percent at 8,000. PL/pgSQL and the inlined SQL function ran only up to 8,000 lines and aren't drawn.",
      "subtitle": "The x-axis is logarithmic, so 1,000 to 8,000 lines get about as much room as 8,000 to 80,000. Both panels are linear: calls of a second or more above, in seconds, and shorter calls below, in milliseconds. A dotted line is a jump from one panel to the other.",
      "dataAsProse": "Execution Time per point, one execution each, from each plan's Execution Time line. Hand-written IS NULL OR >: 7.017 ms at 1,000 sheet lines, 27.206 ms at 2,000, 107.233 ms at 4,000, 428.283 ms at 8,000 and 13,998.132 ms at 80,000. UNION ALL split, no function: 1.548 ms at 1,000 sheet lines, 3.087 ms at 2,000, 6.370 ms at 4,000, 13.226 ms at 8,000 and 13,140.531 ms at 80,000. dateOr99 declared IMMUTABLE, with an index on its result: 1.663 ms at 1,000 sheet lines, 3.421 ms at 2,000, 6.668 ms at 4,000, 13.387 ms at 8,000 and 136.601 ms at 80,000.",
      "summaryCaption": "Up to 8,000 lines the UNION ALL split stays beside the index in milliseconds; at 80,000 it jumps to the seconds panel next to the hand-written condition, while the index stays in milliseconds.",
      "xScale": "log"
    },
    "mysqlHandWritten": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "MYSQL",
        "schemaTemplate": "SET SESSION cte_max_recursion_depth = 4294967295;\nCREATE TABLE contracts (id INT PRIMARY KEY, product CHAR(2) NOT NULL, expiration_date DATE NULL, INDEX contracts_product_expiration (product, expiration_date));\nINSERT INTO contracts (id, product, expiration_date)\nWITH RECURSIVE s(i) AS (SELECT 1 UNION ALL SELECT i + 1 FROM s WHERE i < ${N})\nSELECT i, ELT(i % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       CASE WHEN i <= 24 THEN NULL ELSE DATE_ADD('2026-01-02', INTERVAL (i - 1) DIV 8 DAY) END\nFROM s;\nCREATE TABLE contract_sheet (line_id INT PRIMARY KEY, product CHAR(2) NOT NULL, max_year DATE NOT NULL);\nINSERT INTO contract_sheet (line_id, product, max_year)\nWITH RECURSIVE s(i) AS (SELECT 1 UNION ALL SELECT i + 1 FROM s WHERE i < ${N})\nSELECT i, ELT(i % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'), DATE_ADD('2026-01-02', INTERVAL (${N} DIV 8 + i) DAY)\nFROM s;\nCREATE FUNCTION dateOr99(d DATE) RETURNS DATE NO SQL RETURN COALESCE(d, '9999-01-01');\nANALYZE TABLE contracts, contract_sheet;",
        "scalePoints": [
          {
            "N": 1000
          },
          {
            "N": 2000
          },
          {
            "N": 4000
          },
          {
            "N": 8000
          }
        ],
        "query": "EXPLAIN ANALYZE SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND (c.expiration_date IS NULL OR c.expiration_date > cs.max_year)",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:29:38.460223247Z\",\"databaseType\":\"mysql\",\"sql\":\"EXPLAIN ANALYZE SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND (c.expiration_date IS NULL OR c.expiration_date > cs.max_year)\",\"warmCacheIterations\":0,\"seed\":3997903842,\"seedSource\":\"default\",\"seedNote\":\"MySQL has no session-level random seed (RAND(N) is per statement); the seed was recorded but RAND() was not seeded.\",\"scalePointCount\":4,\"totalComputeSeconds\":4.112,\"results\":[{\"kind\":\"mysql_explain_analyze\",\"scalePoint\":{\"N\":1000},\"output\":\"EXPLAIN\\n-> Aggregate: count(0)  (cost=17911 rows=1) (actual time=37.1..37.1 rows=1 loops=1)\\n    -> Nested loop inner join  (cost=12911 rows=49996) (actual time=0.0381..37 rows=3000 loops=1)\\n        -> Table scan on cs  (cost=101 rows=1000) (actual time=0.0161..0.21 rows=1000 loops=1)\\n        -> Filter: ((c.expiration_date is null) or (c.expiration_date > cs.max_year))  (cost=0.315 rows=50) (actual time=0.0131..0.0365 rows=3 loops=1000)\\n            -> Covering index lookup on c using contracts_product_expiration (product=cs.product)  (cost=0.315 rows=125) (actual time=0.0129..0.0273 rows=125 loops=1000)\\n\",\"runtimeDurationMs\":39,\"rowsAreCapped\":false,\"computeSeconds\":0.279},{\"kind\":\"mysql_explain_analyze\",\"scalePoint\":{\"N\":2000},\"output\":\"EXPLAIN\\n-> Aggregate: count(0)  (cost=70943 rows=1) (actual time=149..149 rows=1 loops=1)\\n    -> Nested loop inner join  (cost=50944 rows=199985) (actual time=0.0383..148 rows=6000 loops=1)\\n        -> Table scan on cs  (cost=202 rows=2000) (actual time=0.0162..0.424 rows=2000 loops=1)\\n        -> Filter: ((c.expiration_date is null) or (c.expiration_date > cs.max_year))  (cost=0.376 rows=100) (actual time=0.014..0.0737 rows=3 loops=2000)\\n            -> Covering index lookup on c using contracts_product_expiration (product=cs.product)  (cost=0.376 rows=250) (actual time=0.0139..0.056 rows=250 loops=2000)\\n\",\"runtimeDurationMs\":152,\"rowsAreCapped\":false,\"computeSeconds\":0.411},{\"kind\":\"mysql_explain_analyze\",\"scalePoint\":{\"N\":4000},\"output\":\"EXPLAIN\\n-> Aggregate: count(0)  (cost=282369 rows=1) (actual time=557..557 rows=1 loops=1)\\n    -> Nested loop inner join  (cost=202375 rows=799940) (actual time=0.0436..557 rows=12000 loops=1)\\n        -> Table scan on cs  (cost=402 rows=4000) (actual time=0.0163..0.823 rows=4000 loops=1)\\n        -> Filter: ((c.expiration_date is null) or (c.expiration_date > cs.max_year))  (cost=0.498 rows=200) (actual time=0.0135..0.139 rows=3 loops=4000)\\n            -> Covering index lookup on c using contracts_product_expiration (product=cs.product)  (cost=0.498 rows=500) (actual time=0.0133..0.105 rows=500 loops=4000)\\n\",\"runtimeDurationMs\":560,\"rowsAreCapped\":false,\"computeSeconds\":0.882},{\"kind\":\"mysql_explain_analyze\",\"scalePoint\":{\"N\":8000},\"output\":\"EXPLAIN\\n-> Aggregate: count(0)  (cost=1.13e+6 rows=1) (actual time=2159..2159 rows=1 loops=1)\\n    -> Nested loop inner join  (cost=806699 rows=3.2e+6) (actual time=0.0384..2158 rows=24000 loops=1)\\n        -> Table scan on cs  (cost=804 rows=8000) (actual time=0.016..1.48 rows=8000 loops=1)\\n        -> Filter: ((c.expiration_date is null) or (c.expiration_date > cs.max_year))  (cost=0.742 rows=400) (actual time=0.0132..0.269 rows=3 loops=8000)\\n            -> Covering index lookup on c using contracts_product_expiration (product=cs.product)  (cost=0.742 rows=1000) (actual time=0.013..0.203 rows=1000 loops=8000)\\n\",\"runtimeDurationMs\":2162,\"rowsAreCapped\":false,\"computeSeconds\":2.54}],\"workerId\":\"5ed9588e-ae64-42f1-a763-4021d192712a\",\"correlationId\":\"4547f40d-2bba-462a-96db-bdb6cc85015f\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "MySQL 8.0.39 (Aurora 3.08.0) with the hand-written IS NULL OR >, no function anywhere. The same join at 1,000 to 8,000 sheet lines: EXPLAIN ANALYZE, one execution per size, times from the plan's root line.",
      "planCaptions": {
        "1K": "At 1,000 sheet lines MySQL looks each line's product up in contracts_product_expiration, gets 125 contracts back, and checks the OR on each of them in a Filter. The root line reports 37.1 ms.",
        "2K": "At 2,000 lines MySQL's lookups return 250 contracts each and the Filter keeps the 3 that never expire, so the work per line has doubled with the lines. The root line reports 149 ms.",
        "4K": "At 4,000 lines MySQL makes one lookup per sheet line and hands 500 contracts from each to the Filter. The root line reports 557 ms, close to four times as long as at half the size.",
        "8K": "At 8,000 lines MySQL's Filter checks the OR on all 1,000 contracts of a line's product, for every sheet line. The root line reports 2,159 ms: no function left to call, and still a check on every pair."
      }
    },
    "pg18EqualityPlpgsql": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "POSTGRES_18",
        "schemaTemplate": "CREATE TABLE crm (id int PRIMARY KEY, email text NOT NULL);\nCREATE TABLE billing (id int PRIMARY KEY, email text NOT NULL);\nINSERT INTO crm SELECT i, 'user' || i || '@example.com' FROM generate_series(1, ${M}) i;\nINSERT INTO billing SELECT i, '  USER' || i || '@Example.COM ' FROM generate_series(1, ${M}) i;\nCREATE FUNCTION norm_email(e text) RETURNS text LANGUAGE plpgsql AS $$ BEGIN RETURN lower(trim(e)); END $$;\nVACUUM ANALYZE;",
        "scalePoints": [
          {
            "M": 500
          },
          {
            "M": 1000
          },
          {
            "M": 2000
          }
        ],
        "query": "EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS matched FROM crm a JOIN billing b ON norm_email(a.email) = norm_email(b.email)",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:31:00.498153386Z\",\"databaseType\":\"postgres_18\",\"sql\":\"EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS matched FROM crm a JOIN billing b ON norm_email(a.email) = norm_email(b.email)\",\"warmCacheIterations\":0,\"seed\":1870352128,\"seedSource\":\"default\",\"scalePointCount\":3,\"totalComputeSeconds\":6.585,\"results\":[{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"M\":500},\"output\":\"QUERY PLAN\\nAggregate  (cost=128772.38..128772.39 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=24\\n  ->  Nested Loop  (cost=0.00..128769.25 rows=1250 width=0) (actual rows=500.00 loops=1)\\n        Join Filter: (norm_email(a.email) = norm_email(b.email))\\n        Rows Removed by Join Filter: 249500\\n        Buffers: shared hit=24\\n        ->  Seq Scan on crm a  (cost=0.00..9.00 rows=500 width=19) (actual rows=500.00 loops=1)\\n              Buffers: shared hit=4\\n        ->  Materialize  (cost=0.00..11.50 rows=500 width=22) (actual rows=500.00 loops=500)\\n              Storage: Memory  Maximum Storage: 40kB\\n              Buffers: shared hit=4\\n              ->  Seq Scan on billing b  (cost=0.00..9.00 rows=500 width=22) (actual rows=500.00 loops=1)\\n                    Buffers: shared hit=4\\nPlanning:\\n  Buffers: shared hit=72\\nPlanning Time: 0.216 ms\\nExecution Time: 235.219 ms\",\"runtimeDurationMs\":250,\"rowsAreCapped\":false,\"computeSeconds\":1.045},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"M\":1000},\"output\":\"QUERY PLAN\\nAggregate  (cost=515050.00..515050.01 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=31\\n  ->  Nested Loop  (cost=0.00..515037.50 rows=5000 width=0) (actual rows=1000.00 loops=1)\\n        Join Filter: (norm_email(a.email) = norm_email(b.email))\\n        Rows Removed by Join Filter: 999000\\n        Buffers: shared hit=31\\n        ->  Seq Scan on crm a  (cost=0.00..17.00 rows=1000 width=19) (actual rows=1000.00 loops=1)\\n              Buffers: shared hit=7\\n        ->  Materialize  (cost=0.00..23.00 rows=1000 width=22) (actual rows=1000.00 loops=1000)\\n              Storage: Memory  Maximum Storage: 63kB\\n              Buffers: shared hit=8\\n              ->  Seq Scan on billing b  (cost=0.00..18.00 rows=1000 width=22) (actual rows=1000.00 loops=1)\\n                    Buffers: shared hit=8\\nPlanning:\\n  Buffers: shared hit=72\\nPlanning Time: 0.221 ms\\nExecution Time: 831.983 ms\",\"runtimeDurationMs\":846,\"rowsAreCapped\":false,\"computeSeconds\":1.573},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"M\":2000},\"output\":\"QUERY PLAN\\nAggregate  (cost=2060124.00..2060124.01 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=45\\n  ->  Nested Loop  (cost=0.00..2060074.00 rows=20000 width=0) (actual rows=2000.00 loops=1)\\n        Join Filter: (norm_email(a.email) = norm_email(b.email))\\n        Rows Removed by Join Filter: 3998000\\n        Buffers: shared hit=45\\n        ->  Seq Scan on crm a  (cost=0.00..34.00 rows=2000 width=20) (actual rows=2000.00 loops=1)\\n              Buffers: shared hit=14\\n        ->  Materialize  (cost=0.00..45.00 rows=2000 width=23) (actual rows=2000.00 loops=2000)\\n              Storage: Memory  Maximum Storage: 110kB\\n              Buffers: shared hit=15\\n              ->  Seq Scan on billing b  (cost=0.00..35.00 rows=2000 width=23) (actual rows=2000.00 loops=1)\\n                    Buffers: shared hit=15\\nPlanning:\\n  Buffers: shared hit=72\\nPlanning Time: 0.210 ms\\nExecution Time: 3258.880 ms\",\"runtimeDurationMs\":3273,\"rowsAreCapped\":false,\"computeSeconds\":3.967}],\"workerId\":\"89a05e60-936f-4a03-9c5c-651d323e3377\",\"correlationId\":\"6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "PG18 (PostgreSQL 18.7) joining two email lists that differ only in case and spaces on a PL/pgSQL norm_email(), lower(trim()) inside, left at the default VOLATILE and called on both sides of the =: 500 to 2,000 rows a side, one execution per size.",
      "planCaptions": {
        "500": "At 500 rows a side PG18 won't hash or merge on norm_email(a.email) = norm_email(b.email), since the function is VOLATILE. It runs a Nested Loop over a Materialize of billing and calls the function in the Join Filter for every pair, in 235.219 ms.",
        "1K": "At 1,000 rows a side PG18's Join Filter removes 999,000 pairs on the same Nested Loop, and the call takes 831.983 ms, about three and a half times as long as at half the rows.",
        "2K": "At 2,000 rows a side PG18's Join Filter removes 3,998,000 pairs and keeps the 2,000 matches. The call takes 3,258.880 ms: two function calls on every pair, and the pairs grow with the square of the rows."
      }
    },
    "ssUdfNoInlineEarlierRun": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "SQLSERVER",
        "schemaTemplate": "CREATE TABLE contracts (id INT PRIMARY KEY, product CHAR(2) NOT NULL, expiration_date DATE NULL);\nINSERT INTO contracts (id, product, expiration_date)\nSELECT gs.value,\n       CHOOSE(gs.value % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       CASE WHEN gs.value <= 24 THEN NULL ELSE DATEADD(DAY, (gs.value - 1) / 8, CAST('2026-01-02' AS DATE)) END\nFROM GENERATE_SERIES(1, ${N}) gs;\nCREATE INDEX contracts_product_expiration ON contracts (product, expiration_date);\nCREATE TABLE contract_sheet (line_id INT PRIMARY KEY, product CHAR(2) NOT NULL, max_year DATE NOT NULL);\nINSERT INTO contract_sheet (line_id, product, max_year)\nSELECT gs.value,\n       CHOOSE(gs.value % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       DATEADD(DAY, ${N} / 8 + gs.value, CAST('2026-01-02' AS DATE))\nFROM GENERATE_SERIES(1, ${N}) gs;\nUPDATE STATISTICS contracts; UPDATE STATISTICS contract_sheet;\nCREATE FUNCTION dateOr99(@d DATE) RETURNS DATE WITH INLINE = OFF AS\nBEGIN\n    RETURN ISNULL(@d, DATEFROMPARTS(9999, 1, 1));\nEND;",
        "scalePoints": [
          {
            "N": 1000
          },
          {
            "N": 2000
          },
          {
            "N": 4000
          }
        ],
        "query": "SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND ${SCHEMA}.dateOr99(c.expiration_date) > cs.max_year",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:26:42.291251161Z\",\"databaseType\":\"sqlserver\",\"sql\":\"SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND ${SCHEMA}.dateOr99(c.expiration_date) > cs.max_year\",\"warmCacheIterations\":0,\"compression\":\"low\",\"seed\":2821979517,\"seedSource\":\"default\",\"scalePointCount\":3,\"totalComputeSeconds\":16.758,\"results\":[{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":1000},\"output\":\"outliving\\n3000\",\"runtimeDurationMs\":765,\"rowsAreCapped\":false,\"computeSeconds\":1.31,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0.249585 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1005],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0006005 SubtreeCost=0.249585 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=734 CPUms=734)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1005\\n        Defined Values: Expr1005 = Count(*)\\n        ->  Hash Match (Inner Join)  (est Rows=1000 IO=0 CPU=0.23725 SubtreeCost=0.248985 AvgRowSize=9) (actual Rows=3000 Executions=1 Elapsedms=734 CPUms=734)\\n              Node Id: 2  Mode: Row\\n              Hash Keys Build: cs.product\\n              Hash Keys Probe: c.product\\n              Probe Residual: [contracts].[product] as [c].[product]=[contract_sheet].[product] as [cs].[product] AND [bench-azure-sql-slot-09222264-1b70-424f-bef0-3482de1f1672].[exo_temp_1777688c_ecf9_411f_b5a6_5b07cb366a3d].[dateOr99]([contracts].[expiration_date] as [c].[expiration_date])>[contract_sheet].[max_year] as [cs].[max_year]\\n              Memory Fractions: Input=1 Output=1\\n              I/O: EndOfScans=1\\n              Memory Grant: Input=1344kB Output=1344kB Used=512kB\\n              ->  Clustered Index Scan [PK__contract__F5AE5F621895834E] on contract_sheet cs  (est Rows=1000 RowsRead=1000 IO=0.00534722 CPU=0.001257 SubtreeCost=0.00660422 AvgRowSize=12) (actual Rows=1000 RowsRead=1000 Executions=1 Elapsedms=0 CPUms=0)\\n                    Node Id: 3  Mode: Row  Table Cardinality: 1000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=6 EndOfScans=1\\n                    Output List: cs.product, cs.max_year\\n                    Defined Values: cs.product; cs.max_year\\n              ->  Index Scan [contracts_product_expiration] on contracts c  (est Rows=1000 RowsRead=1000 IO=0.00386574 CPU=0.001257 SubtreeCost=0.00512274 AvgRowSize=12) (actual Rows=1000 RowsRead=1000 Executions=1 Elapsedms=0 CPUms=0)\\n                    Node Id: 4  Mode: Row  Table Cardinality: 1000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=4 EndOfScans=1\\n                    Output List: c.product, c.expiration_date\\n                    Defined Values: c.product; c.expiration_date\\nStatement: SELECT, optimization FULL (early abort: GoodEnoughPlanFound), CE model 170\\nQuery Plan Hash: 0x232EC548D07F2395\\nDegree Of Parallelism: 0  Non-Parallel Reason: TSQLUserDefinedFunctionsNotParallelizable\\nMemory Grant: Granted=1344kB MaxUsed=512kB Required=1024kB Desired=1344kB Requested=1344kB GrantWaitTime=0ms Feedback: No: First Execution\\nCompile: Time=18ms CPU=11ms Memory=360kB CachedPlanSize=48kB\\nCPU Time: 734 ms\\nExecution Time: 734 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]},{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":2000},\"output\":\"outliving\\n6000\",\"runtimeDurationMs\":2826,\"rowsAreCapped\":false,\"computeSeconds\":3.522,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0.874901 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1005],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0012005 SubtreeCost=0.874901 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=2797 CPUms=2792)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1005\\n        Defined Values: Expr1005 = Count(*)\\n        ->  Hash Match (Inner Join)  (est Rows=2000 IO=0 CPU=0.855321 SubtreeCost=0.873701 AvgRowSize=9) (actual Rows=6000 Executions=1 Elapsedms=2796 CPUms=2792)\\n              Node Id: 2  Mode: Row\\n              Hash Keys Build: cs.product\\n              Hash Keys Probe: c.product\\n              Probe Residual: [contracts].[product] as [c].[product]=[contract_sheet].[product] as [cs].[product] AND [bench-azure-sql-slot-09222264-1b70-424f-bef0-3482de1f1672].[exo_temp_83c0f675_bd84_46fe_a55d_951431f93045].[dateOr99]([contracts].[expiration_date] as [c].[expiration_date])>[contract_sheet].[max_year] as [cs].[max_year]\\n              Memory Fractions: Input=1 Output=1\\n              I/O: EndOfScans=1\\n              Memory Grant: Input=1632kB Output=1632kB Used=512kB\\n              ->  Clustered Index Scan [PK__contract__F5AE5F62100557EB] on contract_sheet cs  (est Rows=2000 RowsRead=2000 IO=0.00831019 CPU=0.002357 SubtreeCost=0.0106672 AvgRowSize=12) (actual Rows=2000 RowsRead=2000 Executions=1 Elapsedms=0 CPUms=0)\\n                    Node Id: 3  Mode: Row  Table Cardinality: 2000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=10 EndOfScans=1\\n                    Output List: cs.product, cs.max_year\\n                    Defined Values: cs.product; cs.max_year\\n              ->  Index Scan [contracts_product_expiration] on contracts c  (est Rows=2000 RowsRead=2000 IO=0.00534722 CPU=0.002357 SubtreeCost=0.00770422 AvgRowSize=12) (actual Rows=2000 RowsRead=2000 Executions=1 Elapsedms=1 CPUms=1)\\n                    Node Id: 4  Mode: Row  Table Cardinality: 2000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=6 EndOfScans=1\\n                    Output List: c.product, c.expiration_date\\n                    Defined Values: c.product; c.expiration_date\\nStatement: SELECT, optimization FULL (early abort: GoodEnoughPlanFound), CE model 170\\nQuery Plan Hash: 0x232EC548D07F2395\\nDegree Of Parallelism: 0  Non-Parallel Reason: TSQLUserDefinedFunctionsNotParallelizable\\nMemory Grant: Granted=1632kB MaxUsed=512kB Required=1024kB Desired=1632kB Requested=1632kB GrantWaitTime=0ms Feedback: No: First Execution\\nWait Stats: SOS_SCHEDULER_YIELD WaitTimeMs=6 WaitCount=697\\nWait Stats: RESOURCE_GOVERNOR_IDLE WaitTimeMs=4 WaitCount=1\\nCompile: Time=17ms CPU=10ms Memory=368kB CachedPlanSize=48kB\\nCPU Time: 2792 ms\\nExecution Time: 2797 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]},{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":4000},\"output\":\"outliving\\n12000\",\"runtimeDurationMs\":11367,\"rowsAreCapped\":false,\"computeSeconds\":11.926,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=3.32125 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1005],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0024005 SubtreeCost=3.32125 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=11327 CPUms=11306)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1005\\n        Defined Values: Expr1005 = Count(*)\\n        ->  Hash Match (Inner Join)  (est Rows=4000 IO=0 CPU=3.28718 SubtreeCost=3.31885 AvgRowSize=9) (actual Rows=12000 Executions=1 Elapsedms=11327 CPUms=11305)\\n              Node Id: 2  Mode: Row\\n              Hash Keys Build: cs.product\\n              Hash Keys Probe: c.product\\n              Probe Residual: [contracts].[product] as [c].[product]=[contract_sheet].[product] as [cs].[product] AND [bench-azure-sql-slot-09222264-1b70-424f-bef0-3482de1f1672].[exo_temp_7be90678_ba0f_4abe_8e5f_842664334c14].[dateOr99]([contracts].[expiration_date] as [c].[expiration_date])>[contract_sheet].[max_year] as [cs].[max_year]\\n              Memory Fractions: Input=1 Output=1\\n              I/O: EndOfScans=1\\n              Memory Grant: Input=1184kB Output=1184kB Used=400kB\\n              ->  Clustered Index Scan [PK__contract__F5AE5F62EA35FF62] on contract_sheet cs  (est Rows=4000 RowsRead=4000 IO=0.0142361 CPU=0.004557 SubtreeCost=0.0187931 AvgRowSize=12) (actual Rows=4000 RowsRead=4000 Executions=1 Elapsedms=1 CPUms=1)\\n                    Node Id: 3  Mode: Row  Table Cardinality: 4000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=18 EndOfScans=1\\n                    Output List: cs.product, cs.max_year\\n                    Defined Values: cs.product; cs.max_year\\n              ->  Index Scan [contracts_product_expiration] on contracts c  (est Rows=4000 RowsRead=4000 IO=0.00831019 CPU=0.004557 SubtreeCost=0.0128672 AvgRowSize=12) (actual Rows=4000 RowsRead=4000 Executions=1 Elapsedms=4 CPUms=4)\\n                    Node Id: 4  Mode: Row  Table Cardinality: 4000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=10 EndOfScans=1\\n                    Output List: c.product, c.expiration_date\\n                    Defined Values: c.product; c.expiration_date\\nStatement: SELECT, optimization FULL, CE model 170\\nQuery Plan Hash: 0x232EC548D07F2395\\nDegree Of Parallelism: 0  Non-Parallel Reason: TSQLUserDefinedFunctionsNotParallelizable\\nMemory Grant: Granted=1184kB MaxUsed=400kB Required=1024kB Desired=1184kB Requested=1184kB GrantWaitTime=0ms Feedback: No: First Execution\\nWait Stats: SOS_SCHEDULER_YIELD WaitTimeMs=29 WaitCount=2822\\nWait Stats: RESOURCE_GOVERNOR_IDLE WaitTimeMs=16 WaitCount=4\\nCompile: Time=26ms CPU=19ms Memory=352kB CachedPlanSize=48kB\\nCPU Time: 11306 ms\\nExecution Time: 11327 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]}],\"workerId\":\"5a95ecce-fa48-4d44-bf17-0a0ef11cf835\",\"correlationId\":\"9ab752d7-5f8f-4f37-8f6b-8d7768870516\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "SQL Server (Azure SQL Database), dateOr99 set to WITH INLINE = OFF, as called in the main run: the same query and data as the body's inlining-off card, at 1,000 to 4,000 sheet lines.",
      "planCaptions": {
        "1K": "At 1,000 sheet lines the main run's SQL Server call hashes the sheet on product and calls dateOr99 in the Probe Residual for each contract and sheet line on the same product, on one thread. The call takes 734 ms, and its CPU Time is 734 ms too.",
        "2K": "At 2,000 lines the SQL Server plan is unchanged, Query Plan Hash 0x232EC548D07F2395, and the call takes 2,797 ms, close to four times as long as at half the size. CPU is 2,792 ms, nearly all of it.",
        "4K": "At 4,000 lines SQL Server takes 11,327 ms with 11,306 ms of CPU, still on one thread, about four times as long as at half the size again."
      }
    },
    "ssUdfNoInline8kOtherDatabase": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "SQLSERVER",
        "schemaTemplate": "CREATE TABLE contracts (id INT PRIMARY KEY, product CHAR(2) NOT NULL, expiration_date DATE NULL);\nINSERT INTO contracts (id, product, expiration_date)\nSELECT gs.value,\n       CHOOSE(gs.value % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       CASE WHEN gs.value <= 24 THEN NULL ELSE DATEADD(DAY, (gs.value - 1) / 8, CAST('2026-01-02' AS DATE)) END\nFROM GENERATE_SERIES(1, ${N}) gs;\nCREATE INDEX contracts_product_expiration ON contracts (product, expiration_date);\nCREATE TABLE contract_sheet (line_id INT PRIMARY KEY, product CHAR(2) NOT NULL, max_year DATE NOT NULL);\nINSERT INTO contract_sheet (line_id, product, max_year)\nSELECT gs.value,\n       CHOOSE(gs.value % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       DATEADD(DAY, ${N} / 8 + gs.value, CAST('2026-01-02' AS DATE))\nFROM GENERATE_SERIES(1, ${N}) gs;\nUPDATE STATISTICS contracts; UPDATE STATISTICS contract_sheet;\nCREATE FUNCTION dateOr99(@d DATE) RETURNS DATE WITH INLINE = OFF AS\nBEGIN\n    RETURN ISNULL(@d, DATEFROMPARTS(9999, 1, 1));\nEND;",
        "scalePoints": [
          {
            "N": 8000
          }
        ],
        "query": "SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND ${SCHEMA}.dateOr99(c.expiration_date) > cs.max_year",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:27:13.825800725Z\",\"databaseType\":\"sqlserver\",\"sql\":\"SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND ${SCHEMA}.dateOr99(c.expiration_date) > cs.max_year\",\"warmCacheIterations\":0,\"compression\":\"low\",\"seed\":2341688760,\"seedSource\":\"default\",\"scalePointCount\":1,\"totalComputeSeconds\":28.674,\"results\":[{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":8000},\"output\":\"outliving\\n24000\",\"runtimeDurationMs\":28004,\"rowsAreCapped\":false,\"computeSeconds\":28.674,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=12.9961 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1005],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0048005 SubtreeCost=12.9961 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=27964 CPUms=27943)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1005\\n        Defined Values: Expr1005 = Count(*)\\n        ->  Hash Match (Inner Join)  (est Rows=8000 IO=0 CPU=12.9338 SubtreeCost=12.9913 AvgRowSize=9) (actual Rows=24000 Executions=1 Elapsedms=27963 CPUms=27942)\\n              Node Id: 2  Mode: Row\\n              Hash Keys Build: cs.product\\n              Hash Keys Probe: c.product\\n              Probe Residual: [contracts].[product] as [c].[product]=[contract_sheet].[product] as [cs].[product] AND [bench-azure-sql-slot-c9ebddf4-2c1c-4905-b506-057e151d5c61].[exo_temp_96640bb0_c2e0_470c_8761_c17e0e7dc8ba].[dateOr99]([contracts].[expiration_date] as [c].[expiration_date])>[contract_sheet].[max_year] as [cs].[max_year]\\n              Memory Fractions: Input=1 Output=1\\n              I/O: EndOfScans=1\\n              Memory Grant: Input=2368kB Output=2368kB Used=632kB\\n              ->  Clustered Index Scan [PK__contract__F5AE5F62A5D59878] on contract_sheet cs  (est Rows=8000 RowsRead=8000 IO=0.026088 CPU=0.008957 SubtreeCost=0.035045 AvgRowSize=12) (actual Rows=8000 RowsRead=8000 Executions=1 Elapsedms=2 CPUms=2)\\n                    Node Id: 3  Mode: Row  Table Cardinality: 8000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=34 EndOfScans=1\\n                    Output List: cs.product, cs.max_year\\n                    Defined Values: cs.product; cs.max_year\\n              ->  Index Scan [contracts_product_expiration] on contracts c  (est Rows=8000 RowsRead=8000 IO=0.0134954 CPU=0.008957 SubtreeCost=0.0224524 AvgRowSize=12) (actual Rows=8000 RowsRead=8000 Executions=1 Elapsedms=9 CPUms=9)\\n                    Node Id: 4  Mode: Row  Table Cardinality: 8000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=17 EndOfScans=1\\n                    Output List: c.product, c.expiration_date\\n                    Defined Values: c.product; c.expiration_date\\nStatement: SELECT, optimization FULL, CE model 170\\nQuery Plan Hash: 0x232EC548D07F2395\\nDegree Of Parallelism: 0  Non-Parallel Reason: TSQLUserDefinedFunctionsNotParallelizable\\nMemory Grant: Granted=2368kB MaxUsed=632kB Required=1024kB Desired=2368kB Requested=2368kB GrantWaitTime=0ms Feedback: No: First Execution\\nWait Stats: SOS_SCHEDULER_YIELD WaitTimeMs=40 WaitCount=6979\\nCompile: Time=27ms CPU=17ms Memory=336kB CachedPlanSize=48kB\\nCPU Time: 27943 ms\\nExecution Time: 27964 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]}],\"workerId\":\"03a000af-7e62-40b5-b2c9-98c70f6885d1\",\"correlationId\":\"f7e9196c-b629-496e-9b12-4bf5ce6fe473\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "SQL Server (Azure SQL Database), dateOr99 set to WITH INLINE = OFF: the main run's 8,000-line call, made on its own. Its plan names the database it ran on, bench-azure-sql-slot-c9ebddf4.",
      "planCaptions": {
        "8K": "At 8,000 sheet lines SQL Server runs the same serial Hash Match, with dateOr99 in the Probe Residual for every contract and sheet line on the same product, on database c9ebddf4. The call takes 27,964 ms, 27,943 ms of it on the CPU, and counts 24,000 contracts."
      }
    },
    "ssCompat140": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "SQLSERVER",
        "schemaTemplate": "CREATE TABLE contracts (id INT PRIMARY KEY, product CHAR(2) NOT NULL, expiration_date DATE NULL);\nINSERT INTO contracts (id, product, expiration_date)\nSELECT gs.value,\n       CHOOSE(gs.value % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       CASE WHEN gs.value <= 24 THEN NULL ELSE DATEADD(DAY, (gs.value - 1) / 8, CAST('2026-01-02' AS DATE)) END\nFROM GENERATE_SERIES(1, ${N}) gs;\nCREATE INDEX contracts_product_expiration ON contracts (product, expiration_date);\nCREATE TABLE contract_sheet (line_id INT PRIMARY KEY, product CHAR(2) NOT NULL, max_year DATE NOT NULL);\nINSERT INTO contract_sheet (line_id, product, max_year)\nSELECT gs.value,\n       CHOOSE(gs.value % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       DATEADD(DAY, ${N} / 8 + gs.value, CAST('2026-01-02' AS DATE))\nFROM GENERATE_SERIES(1, ${N}) gs;\nUPDATE STATISTICS contracts; UPDATE STATISTICS contract_sheet;\nCREATE FUNCTION dateOr99(@d DATE) RETURNS DATE AS\nBEGIN\n    RETURN ISNULL(@d, DATEFROMPARTS(9999, 1, 1));\nEND;",
        "scalePoints": [
          {
            "N": 1000
          },
          {
            "N": 2000
          },
          {
            "N": 4000
          }
        ],
        "query": "SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND ${SCHEMA}.dateOr99(c.expiration_date) > cs.max_year OPTION (USE HINT('QUERY_OPTIMIZER_COMPATIBILITY_LEVEL_140'))",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:27:34.413825463Z\",\"databaseType\":\"sqlserver\",\"sql\":\"SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND ${SCHEMA}.dateOr99(c.expiration_date) > cs.max_year OPTION (USE HINT('QUERY_OPTIMIZER_COMPATIBILITY_LEVEL_140'))\",\"warmCacheIterations\":0,\"compression\":\"low\",\"seed\":67164961,\"seedSource\":\"default\",\"scalePointCount\":3,\"totalComputeSeconds\":18.155,\"results\":[{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":1000},\"output\":\"outliving\\n3000\",\"runtimeDurationMs\":842,\"rowsAreCapped\":false,\"computeSeconds\":1.493,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0.183096 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1005],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0006005 SubtreeCost=0.183096 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=806 CPUms=806)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1005\\n        Defined Values: Expr1005 = Count(*)\\n        ->  Merge Join (Inner Join)  (est Rows=1000 IO=0.000313 CPU=0.14354 SubtreeCost=0.182496 AvgRowSize=9) (actual Rows=3000 RowsRead=125007 Executions=1 Elapsedms=806 CPUms=806)\\n              Node Id: 2  Mode: Row\\n              Many To Many: true\\n              Outer Side Join Columns: c.product\\n              Inner Side Join Columns: cs.product\\n              Residual: [contracts].[product] as [c].[product]=[contract_sheet].[product] as [cs].[product] AND [bench-azure-sql-slot-09222264-1b70-424f-bef0-3482de1f1672].[exo_temp_ae55653b_5c20_465a_916d_8d2b8e7e7334].[dateOr99]([contracts].[expiration_date] as [c].[expiration_date])>[contract_sheet].[max_year] as [cs].[max_year]\\n              I/O: Scans=8 LogicalReads=4015 EndOfScans=1\\n              ->  Index Scan [contracts_product_expiration] on contracts c  (est Rows=1000 RowsRead=1000 IO=0.00386574 CPU=0.001257 SubtreeCost=0.00512274 AvgRowSize=12) (actual Rows=1000 RowsRead=1000 Executions=1 Elapsedms=0 CPUms=0)\\n                    Node Id: 3  Mode: Row  Table Cardinality: 1000  Storage: RowStore  Ordered: FORWARD\\n                    I/O: Scans=1 LogicalReads=4 EndOfScans=1\\n                    Output List: c.product, c.expiration_date\\n                    Defined Values: c.product; c.expiration_date\\n              ->  Sort  (est Rows=1000 IO=0.0112613 CPU=0.0156466 SubtreeCost=0.0335121 AvgRowSize=12) (actual Rows=1000 Executions=1 Rebinds=1 Elapsedms=1 CPUms=1)\\n                    Node Id: 4  Mode: Row\\n                    Order By: cs.product\\n                    Memory Fractions: Input=1 Output=1\\n                    I/O: EndOfScans=1\\n                    Memory Grant: Input=1024kB Output=640kB Used=48kB\\n                    Output List: cs.product, cs.max_year\\n                    ->  Clustered Index Scan [PK__contract__F5AE5F621CB7EA6A] on contract_sheet cs  (est Rows=1000 RowsRead=1000 IO=0.00534722 CPU=0.001257 SubtreeCost=0.00660422 AvgRowSize=12) (actual Rows=1000 RowsRead=1000 Executions=1 Elapsedms=0 CPUms=0)\\n                          Node Id: 5  Mode: Row  Table Cardinality: 1000  Storage: RowStore\\n                          I/O: Scans=1 LogicalReads=6 EndOfScans=1\\n                          Output List: cs.product, cs.max_year\\n                          Defined Values: cs.product; cs.max_year\\nStatement: SELECT, optimization FULL (early abort: GoodEnoughPlanFound), CE model 140\\nQuery Plan Hash: 0x1FC20ADCF93848D6\\nDegree Of Parallelism: 0  Non-Parallel Reason: TSQLUserDefinedFunctionsNotParallelizable\\nMemory Grant: Granted=1024kB MaxUsed=48kB Required=512kB Desired=624kB Requested=1024kB GrantWaitTime=0ms\\nCompile: Time=17ms CPU=10ms Memory=368kB CachedPlanSize=32kB\\nCPU Time: 806 ms\\nExecution Time: 806 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]},{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":2000},\"output\":\"outliving\\n6000\",\"runtimeDurationMs\":3135,\"rowsAreCapped\":false,\"computeSeconds\":3.796,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0.596947 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1005],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0012005 SubtreeCost=0.596947 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=3097 CPUms=3088)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1005\\n        Defined Values: Expr1005 = Count(*)\\n        ->  Merge Join (Inner Join)  (est Rows=2000 IO=0.000313 CPU=0.53148 SubtreeCost=0.595747 AvgRowSize=9) (actual Rows=6000 RowsRead=500007 Executions=1 Elapsedms=3097 CPUms=3088)\\n              Node Id: 2  Mode: Row\\n              Many To Many: true\\n              Outer Side Join Columns: c.product\\n              Inner Side Join Columns: cs.product\\n              Residual: [contracts].[product] as [c].[product]=[contract_sheet].[product] as [cs].[product] AND [bench-azure-sql-slot-09222264-1b70-424f-bef0-3482de1f1672].[exo_temp_bee8108c_8489_487c_9c27_4e594cf74b39].[dateOr99]([contracts].[expiration_date] as [c].[expiration_date])>[contract_sheet].[max_year] as [cs].[max_year]\\n              I/O: Scans=8 LogicalReads=8015 EndOfScans=1\\n              ->  Index Scan [contracts_product_expiration] on contracts c  (est Rows=2000 RowsRead=2000 IO=0.00534722 CPU=0.002357 SubtreeCost=0.00770422 AvgRowSize=12) (actual Rows=2000 RowsRead=2000 Executions=1 Elapsedms=1 CPUms=1)\\n                    Node Id: 3  Mode: Row  Table Cardinality: 2000  Storage: RowStore  Ordered: FORWARD\\n                    I/O: Scans=1 LogicalReads=6 EndOfScans=1\\n                    Output List: c.product, c.expiration_date\\n                    Defined Values: c.product; c.expiration_date\\n              ->  Sort  (est Rows=2000 IO=0.0112613 CPU=0.0343133 SubtreeCost=0.0562417 AvgRowSize=12) (actual Rows=2000 Executions=1 Rebinds=1 Elapsedms=2 CPUms=2)\\n                    Node Id: 4  Mode: Row\\n                    Order By: cs.product\\n                    Memory Fractions: Input=1 Output=1\\n                    I/O: EndOfScans=1\\n                    Memory Grant: Input=1024kB Output=640kB Used=96kB\\n                    Output List: cs.product, cs.max_year\\n                    ->  Clustered Index Scan [PK__contract__F5AE5F62B8875F88] on contract_sheet cs  (est Rows=2000 RowsRead=2000 IO=0.00831019 CPU=0.002357 SubtreeCost=0.0106672 AvgRowSize=12) (actual Rows=2000 RowsRead=2000 Executions=1 Elapsedms=0 CPUms=0)\\n                          Node Id: 5  Mode: Row  Table Cardinality: 2000  Storage: RowStore\\n                          I/O: Scans=1 LogicalReads=10 EndOfScans=1\\n                          Output List: cs.product, cs.max_year\\n                          Defined Values: cs.product; cs.max_year\\nStatement: SELECT, optimization FULL (early abort: GoodEnoughPlanFound), CE model 140\\nQuery Plan Hash: 0xFADA370EB4975BA2\\nDegree Of Parallelism: 0  Non-Parallel Reason: TSQLUserDefinedFunctionsNotParallelizable\\nMemory Grant: Granted=1024kB MaxUsed=96kB Required=512kB Desired=720kB Requested=1024kB GrantWaitTime=0ms\\nWait Stats: SOS_SCHEDULER_YIELD WaitTimeMs=11 WaitCount=770\\nWait Stats: RESOURCE_GOVERNOR_IDLE WaitTimeMs=9 WaitCount=2\\nCompile: Time=18ms CPU=11ms Memory=360kB CachedPlanSize=32kB\\nCPU Time: 3088 ms\\nExecution Time: 3097 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]},{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":4000},\"output\":\"outliving\\n12000\",\"runtimeDurationMs\":12283,\"rowsAreCapped\":false,\"computeSeconds\":12.866,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=2.17777 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1005],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0024005 SubtreeCost=2.17777 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=12241 CPUms=12237)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1005\\n        Defined Values: Expr1005 = Count(*)\\n        ->  Merge Join (Inner Join)  (est Rows=4000 IO=0.000313 CPU=2.05736 SubtreeCost=2.17537 AvgRowSize=9) (actual Rows=12000 RowsRead=2000007 Executions=1 Elapsedms=12241 CPUms=12236)\\n              Node Id: 2  Mode: Row\\n              Many To Many: true\\n              Outer Side Join Columns: c.product\\n              Inner Side Join Columns: cs.product\\n              Residual: [contracts].[product] as [c].[product]=[contract_sheet].[product] as [cs].[product] AND [bench-azure-sql-slot-09222264-1b70-424f-bef0-3482de1f1672].[exo_temp_50d7789a_019b_4587_a8a0_a2412349ac48].[dateOr99]([contracts].[expiration_date] as [c].[expiration_date])>[contract_sheet].[max_year] as [cs].[max_year]\\n              I/O: Scans=8 LogicalReads=20047 EndOfScans=1\\n              ->  Index Scan [contracts_product_expiration] on contracts c  (est Rows=4000 RowsRead=4000 IO=0.00831019 CPU=0.004557 SubtreeCost=0.0128672 AvgRowSize=12) (actual Rows=4000 RowsRead=4000 Executions=1 Elapsedms=3 CPUms=3)\\n                    Node Id: 3  Mode: Row  Table Cardinality: 4000  Storage: RowStore  Ordered: FORWARD\\n                    I/O: Scans=1 LogicalReads=10 EndOfScans=1\\n                    Output List: c.product, c.expiration_date\\n                    Defined Values: c.product; c.expiration_date\\n              ->  Sort  (est Rows=4000 IO=0.0112613 CPU=0.0747665 SubtreeCost=0.104821 AvgRowSize=12) (actual Rows=4000 Executions=1 Rebinds=1 Elapsedms=5 CPUms=5)\\n                    Node Id: 4  Mode: Row\\n                    Order By: cs.product\\n                    Memory Fractions: Input=1 Output=1\\n                    I/O: EndOfScans=1\\n                    Memory Grant: Input=1024kB Output=640kB Used=192kB\\n                    Output List: cs.product, cs.max_year\\n                    ->  Clustered Index Scan [PK__contract__F5AE5F626389EA14] on contract_sheet cs  (est Rows=4000 RowsRead=4000 IO=0.0142361 CPU=0.004557 SubtreeCost=0.0187931 AvgRowSize=12) (actual Rows=4000 RowsRead=4000 Executions=1 Elapsedms=1 CPUms=1)\\n                          Node Id: 5  Mode: Row  Table Cardinality: 4000  Storage: RowStore\\n                          I/O: Scans=1 LogicalReads=18 EndOfScans=1\\n                          Output List: cs.product, cs.max_year\\n                          Defined Values: cs.product; cs.max_year\\nStatement: SELECT, optimization FULL, CE model 140\\nQuery Plan Hash: 0x47471F79C9E04A18\\nDegree Of Parallelism: 0  Non-Parallel Reason: TSQLUserDefinedFunctionsNotParallelizable\\nMemory Grant: Granted=1024kB MaxUsed=192kB Required=512kB Desired=928kB Requested=1024kB GrantWaitTime=0ms\\nWait Stats: SOS_SCHEDULER_YIELD WaitTimeMs=12 WaitCount=3053\\nWait Stats: RESOURCE_GOVERNOR_IDLE WaitTimeMs=3 WaitCount=1\\nCompile: Time=22ms CPU=15ms Memory=344kB CachedPlanSize=32kB\\nCPU Time: 12237 ms\\nExecution Time: 12242 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]}],\"workerId\":\"373c8fc2-dd4f-4cc5-b3c6-c76c1c005f6f\",\"correlationId\":\"876285a1-5e08-4f9e-907e-c02fa2ac21ea\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "SQL Server (Azure SQL Database) with the inlinable dateOr99 compiled under OPTION (USE HINT('QUERY_OPTIMIZER_COMPATIBILITY_LEVEL_140')), the SQL Server 2017 optimizer, which doesn't inline it: the same join at 1,000 to 4,000 sheet lines.",
      "planCaptions": {
        "1K": "At 1,000 sheet lines the hinted SQL Server plan sorts the sheet and merge-joins it to contracts on product, with dateOr99 in the Merge Join's Residual on every pair it reads, 125,007 rows. It runs on one thread, with the cardinality estimator the plan calls CE model 140, in 806 ms.",
        "2K": "At 2,000 lines SQL Server's Merge Join reads 500,007 rows, four times as many as at half the size. The call takes 3,097 ms, with 3,088 ms of CPU.",
        "4K": "At 4,000 lines SQL Server's Merge Join reads 2,000,007 rows and the call takes 12,242 ms. The UDF still runs for every pair the join reads, on one thread."
      }
    },
    "ssCompat140At8k": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "SQLSERVER",
        "schemaTemplate": "CREATE TABLE contracts (id INT PRIMARY KEY, product CHAR(2) NOT NULL, expiration_date DATE NULL);\nINSERT INTO contracts (id, product, expiration_date)\nSELECT gs.value,\n       CHOOSE(gs.value % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       CASE WHEN gs.value <= 24 THEN NULL ELSE DATEADD(DAY, (gs.value - 1) / 8, CAST('2026-01-02' AS DATE)) END\nFROM GENERATE_SERIES(1, ${N}) gs;\nCREATE INDEX contracts_product_expiration ON contracts (product, expiration_date);\nCREATE TABLE contract_sheet (line_id INT PRIMARY KEY, product CHAR(2) NOT NULL, max_year DATE NOT NULL);\nINSERT INTO contract_sheet (line_id, product, max_year)\nSELECT gs.value,\n       CHOOSE(gs.value % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       DATEADD(DAY, ${N} / 8 + gs.value, CAST('2026-01-02' AS DATE))\nFROM GENERATE_SERIES(1, ${N}) gs;\nUPDATE STATISTICS contracts; UPDATE STATISTICS contract_sheet;\nCREATE FUNCTION dateOr99(@d DATE) RETURNS DATE AS\nBEGIN\n    RETURN ISNULL(@d, DATEFROMPARTS(9999, 1, 1));\nEND;",
        "scalePoints": [
          {
            "N": 8000
          }
        ],
        "query": "SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND ${SCHEMA}.dateOr99(c.expiration_date) > cs.max_year OPTION (USE HINT('QUERY_OPTIMIZER_COMPATIBILITY_LEVEL_140'))",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:28:24.358446520Z\",\"databaseType\":\"sqlserver\",\"sql\":\"SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND ${SCHEMA}.dateOr99(c.expiration_date) > cs.max_year OPTION (USE HINT('QUERY_OPTIMIZER_COMPATIBILITY_LEVEL_140'))\",\"warmCacheIterations\":0,\"compression\":\"low\",\"seed\":4065455470,\"seedSource\":\"default\",\"scalePointCount\":1,\"totalComputeSeconds\":48.46,\"results\":[{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":8000},\"output\":\"outliving\\n24000\",\"runtimeDurationMs\":47842,\"rowsAreCapped\":false,\"computeSeconds\":48.46,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=8.52937 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1005],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0048005 SubtreeCost=8.52937 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=47788 CPUms=47714)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1005\\n        Defined Values: Expr1005 = Count(*)\\n        ->  Merge Join (Inner Join)  (est Rows=8000 IO=0.000313 CPU=8.10912 SubtreeCost=8.52457 AvgRowSize=9) (actual Rows=24000 RowsRead=8000007 Executions=1 Elapsedms=47787 CPUms=47713)\\n              Node Id: 2  Mode: Row\\n              Many To Many: true\\n              Outer Side Join Columns: c.product\\n              Inner Side Join Columns: cs.product\\n              Residual: [contracts].[product] as [c].[product]=[contract_sheet].[product] as [cs].[product] AND [bench-azure-sql-slot-09222264-1b70-424f-bef0-3482de1f1672].[exo_temp_fb5220dc_45ff_45b1_951c_7c694de51091].[dateOr99]([contracts].[expiration_date] as [c].[expiration_date])>[contract_sheet].[max_year] as [cs].[max_year]\\n              I/O: Scans=8 LogicalReads=48087 EndOfScans=1\\n              ->  Index Scan [contracts_product_expiration] on contracts c  (est Rows=8000 RowsRead=8000 IO=0.0134954 CPU=0.008957 SubtreeCost=0.0224524 AvgRowSize=12) (actual Rows=8000 RowsRead=8000 Executions=1 Elapsedms=7 CPUms=7)\\n                    Node Id: 3  Mode: Row  Table Cardinality: 8000  Storage: RowStore  Ordered: FORWARD\\n                    I/O: Scans=1 LogicalReads=17 EndOfScans=1\\n                    Output List: c.product, c.expiration_date\\n                    Defined Values: c.product; c.expiration_date\\n              ->  Sort  (est Rows=8000 IO=0.0112613 CPU=0.346375 SubtreeCost=0.392681 AvgRowSize=12) (actual Rows=8000 Executions=1 Rebinds=1 Elapsedms=10 CPUms=10)\\n                    Node Id: 4  Mode: Row\\n                    Order By: cs.product\\n                    Memory Fractions: Input=1 Output=1\\n                    I/O: EndOfScans=1\\n                    Memory Grant: Input=1344kB Output=960kB Used=384kB\\n                    Output List: cs.product, cs.max_year\\n                    ->  Clustered Index Scan [PK__contract__F5AE5F626D5DA3B8] on contract_sheet cs  (est Rows=8000 RowsRead=8000 IO=0.026088 CPU=0.008957 SubtreeCost=0.035045 AvgRowSize=12) (actual Rows=8000 RowsRead=8000 Executions=1 Elapsedms=2 CPUms=2)\\n                          Node Id: 5  Mode: Row  Table Cardinality: 8000  Storage: RowStore\\n                          I/O: Scans=1 LogicalReads=34 EndOfScans=1\\n                          Output List: cs.product, cs.max_year\\n                          Defined Values: cs.product; cs.max_year\\nStatement: SELECT, optimization FULL, CE model 140\\nQuery Plan Hash: 0x19CEF97EDF69095F\\nDegree Of Parallelism: 0  Non-Parallel Reason: TSQLUserDefinedFunctionsNotParallelizable\\nMemory Grant: Granted=1344kB MaxUsed=384kB Required=512kB Desired=1344kB Requested=1344kB GrantWaitTime=0ms\\nWait Stats: SOS_SCHEDULER_YIELD WaitTimeMs=103 WaitCount=11908\\nWait Stats: RESOURCE_GOVERNOR_IDLE WaitTimeMs=67 WaitCount=14\\nCompile: Time=33ms CPU=25ms Memory=336kB CachedPlanSize=32kB\\nCPU Time: 47714 ms\\nExecution Time: 47788 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]}],\"workerId\":\"2de570aa-e0ea-4a76-a644-d8acec5208bf\",\"correlationId\":\"aa084336-06d8-45ac-95b5-f83d9247f873\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "SQL Server (Azure SQL Database) with the same compatibility level 140 hint, the SQL Server 2017 optimizer, at 8,000 sheet lines in a call of its own.",
      "planCaptions": {
        "8K": "At 8,000 sheet lines the hinted SQL Server plan merge-joins on product and reads 8,000,007 rows in the Merge Join, calling dateOr99 in the Residual for each pair. The call takes 47,788 ms on one thread, 47,714 ms of it on the CPU."
      }
    },
    "ssUdfInlined": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "SQLSERVER",
        "schemaTemplate": "CREATE TABLE contracts (id INT PRIMARY KEY, product CHAR(2) NOT NULL, expiration_date DATE NULL);\nINSERT INTO contracts (id, product, expiration_date)\nSELECT gs.value,\n       CHOOSE(gs.value % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       CASE WHEN gs.value <= 24 THEN NULL ELSE DATEADD(DAY, (gs.value - 1) / 8, CAST('2026-01-02' AS DATE)) END\nFROM GENERATE_SERIES(1, ${N}) gs;\nCREATE INDEX contracts_product_expiration ON contracts (product, expiration_date);\nCREATE TABLE contract_sheet (line_id INT PRIMARY KEY, product CHAR(2) NOT NULL, max_year DATE NOT NULL);\nINSERT INTO contract_sheet (line_id, product, max_year)\nSELECT gs.value,\n       CHOOSE(gs.value % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       DATEADD(DAY, ${N} / 8 + gs.value, CAST('2026-01-02' AS DATE))\nFROM GENERATE_SERIES(1, ${N}) gs;\nUPDATE STATISTICS contracts; UPDATE STATISTICS contract_sheet;\nCREATE FUNCTION dateOr99(@d DATE) RETURNS DATE AS\nBEGIN\n    RETURN ISNULL(@d, DATEFROMPARTS(9999, 1, 1));\nEND;",
        "scalePoints": [
          {
            "N": 1000
          },
          {
            "N": 2000
          },
          {
            "N": 4000
          },
          {
            "N": 8000
          }
        ],
        "query": "SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND ${SCHEMA}.dateOr99(c.expiration_date) > cs.max_year",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:28:30.423417168Z\",\"databaseType\":\"sqlserver\",\"sql\":\"SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND ${SCHEMA}.dateOr99(c.expiration_date) > cs.max_year\",\"warmCacheIterations\":0,\"compression\":\"low\",\"seed\":4088605343,\"seedSource\":\"default\",\"scalePointCount\":4,\"totalComputeSeconds\":3.455,\"results\":[{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":1000},\"output\":\"outliving\\n3000\",\"runtimeDurationMs\":45,\"rowsAreCapped\":false,\"computeSeconds\":0.628,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0.0000001 SubtreeCost=0.0625361 AvgRowSize=11)\\n  Node Id: 1  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[globalagg1006],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0006005 SubtreeCost=0.062536 AvgRowSize=15) (actual Rows=1 Executions=1 Elapsedms=12 CPUms=12)\\n        Node Id: 2  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: globalagg1006\\n        Defined Values: globalagg1006 = SUM([partialagg1005])\\n        ->  Hash Match (Inner Join)  (est Rows=1000 IO=0 CPU=0.0255344 SubtreeCost=0.0619355 AvgRowSize=15) (actual Rows=1000 Executions=1 Elapsedms=12 CPUms=12)\\n              Node Id: 3  Mode: Row\\n              Hash Keys Build: c.product\\n              Hash Keys Probe: cs.product\\n              Probe Residual: [contracts].[product] as [c].[product]=[contract_sheet].[product] as [cs].[product] AND [Expr1003]>[contract_sheet].[max_year] as [cs].[max_year]\\n              Memory Fractions: Input=0.75 Output=1\\n              I/O: EndOfScans=1\\n              Memory Grant: Input=1072kB Output=1088kB Used=336kB\\n              Output List: partialagg1005\\n              ->  Hash Match (Aggregate)  (est Rows=8 IO=0 CPU=0.0245672 SubtreeCost=0.0297899 AvgRowSize=20) (actual Rows=984 Executions=1 Elapsedms=0 CPUms=0)\\n                    Node Id: 4  Mode: Row\\n                    Hash Keys Build: c.product, Expr1003\\n                    Build Residual: [contracts].[product] as [c].[product] = [contracts].[product] as [c].[product] AND [Expr1003] = [Expr1003]\\n                    Memory Fractions: Input=1 Output=0.25\\n                    I/O: EndOfScans=1\\n                    Memory Grant: Input=1088kB Output=1040kB Used=352kB\\n                    Output List: c.product, Expr1003, partialagg1005\\n                    Defined Values: partialagg1005 = COUNT(*)\\n                    ->  Compute Scalar  (est Rows=1000 IO=0 CPU=0.0001 SubtreeCost=0.00522274 AvgRowSize=12)\\n                          Node Id: 5  Mode: Row\\n                          Output List: c.product, Expr1003\\n                          Defined Values: Expr1003 = CONVERT_IMPLICIT(date,isnull([contracts].[expiration_date] as [c].[expiration_date],'9999-01-01'),0)\\n                          ->  Index Scan [contracts_product_expiration] on contracts c  (est Rows=1000 RowsRead=1000 IO=0.00386574 CPU=0.001257 SubtreeCost=0.00512274 AvgRowSize=12) (actual Rows=1000 RowsRead=1000 Executions=1 Elapsedms=0 CPUms=0)\\n                                Node Id: 6  Mode: Row  Table Cardinality: 1000  Storage: RowStore\\n                                I/O: Scans=1 LogicalReads=4 EndOfScans=1\\n                                Output List: c.product, c.expiration_date\\n                                Defined Values: c.product; c.expiration_date\\n              ->  Clustered Index Scan [PK__contract__F5AE5F624AFB300E] on contract_sheet cs  (est Rows=1000 RowsRead=1000 IO=0.00534722 CPU=0.001257 SubtreeCost=0.00660422 AvgRowSize=12) (actual Rows=1000 RowsRead=1000 Executions=1 Elapsedms=0 CPUms=0)\\n                    Node Id: 7  Mode: Row  Table Cardinality: 1000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=6 EndOfScans=1\\n                    Output List: cs.product, cs.max_year\\n                    Defined Values: cs.product; cs.max_year\\nStatement: SELECT, optimization FULL (early abort: GoodEnoughPlanFound), CE model 170\\nQuery Plan Hash: 0xC574B285387F8335\\nDegree Of Parallelism: 1\\nMemory Grant: Granted=2112kB MaxUsed=688kB Required=2048kB Desired=2112kB Requested=2112kB GrantWaitTime=0ms Feedback: No: First Execution\\nCompile: Time=15ms CPU=7ms Memory=456kB CachedPlanSize=72kB\\nextra: 1\\nCPU Time: 12 ms\\nExecution Time: 12 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]},{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":2000},\"output\":\"outliving\\n6000\",\"runtimeDurationMs\":81,\"rowsAreCapped\":false,\"computeSeconds\":0.607,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0.0000001 SubtreeCost=0.0841891 AvgRowSize=11)\\n  Node Id: 1  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[globalagg1006],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0012005 SubtreeCost=0.084189 AvgRowSize=15) (actual Rows=1 Executions=1 Elapsedms=48 CPUms=48)\\n        Node Id: 2  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: globalagg1006\\n        Defined Values: globalagg1006 = SUM([partialagg1005])\\n        ->  Hash Match (Inner Join)  (est Rows=2000 IO=0 CPU=0.0331644 SubtreeCost=0.0829885 AvgRowSize=15) (actual Rows=2000 Executions=1 Elapsedms=48 CPUms=48)\\n              Node Id: 3  Mode: Row\\n              Hash Keys Build: c.product\\n              Hash Keys Probe: cs.product\\n              Probe Residual: [contracts].[product] as [c].[product]=[contract_sheet].[product] as [cs].[product] AND [Expr1003]>[contract_sheet].[max_year] as [cs].[max_year]\\n              Memory Fractions: Input=0.777778 Output=1\\n              I/O: EndOfScans=1\\n              Memory Grant: Input=1080kB Output=1096kB Used=344kB\\n              Output List: partialagg1005\\n              ->  Hash Match (Aggregate)  (est Rows=8 IO=0 CPU=0.0312457 SubtreeCost=0.0391499 AvgRowSize=20) (actual Rows=1984 Executions=1 Elapsedms=1 CPUms=1)\\n                    Node Id: 4  Mode: Row\\n                    Hash Keys Build: c.product, Expr1003\\n                    Build Residual: [contracts].[product] as [c].[product] = [contracts].[product] as [c].[product] AND [Expr1003] = [Expr1003]\\n                    Memory Fractions: Input=1 Output=0.222222\\n                    I/O: EndOfScans=1\\n                    Memory Grant: Input=1096kB Output=1040kB Used=352kB\\n                    Output List: c.product, Expr1003, partialagg1005\\n                    Defined Values: partialagg1005 = COUNT(*)\\n                    ->  Compute Scalar  (est Rows=2000 IO=0 CPU=0.0002 SubtreeCost=0.00790422 AvgRowSize=12)\\n                          Node Id: 5  Mode: Row\\n                          Output List: c.product, Expr1003\\n                          Defined Values: Expr1003 = CONVERT_IMPLICIT(date,isnull([contracts].[expiration_date] as [c].[expiration_date],'9999-01-01'),0)\\n                          ->  Index Scan [contracts_product_expiration] on contracts c  (est Rows=2000 RowsRead=2000 IO=0.00534722 CPU=0.002357 SubtreeCost=0.00770422 AvgRowSize=12) (actual Rows=2000 RowsRead=2000 Executions=1 Elapsedms=0 CPUms=0)\\n                                Node Id: 6  Mode: Row  Table Cardinality: 2000  Storage: RowStore\\n                                I/O: Scans=1 LogicalReads=6 EndOfScans=1\\n                                Output List: c.product, c.expiration_date\\n                                Defined Values: c.product; c.expiration_date\\n              ->  Clustered Index Scan [PK__contract__F5AE5F625B9A8882] on contract_sheet cs  (est Rows=2000 RowsRead=2000 IO=0.00831019 CPU=0.002357 SubtreeCost=0.0106672 AvgRowSize=12) (actual Rows=2000 RowsRead=2000 Executions=1 Elapsedms=0 CPUms=0)\\n                    Node Id: 7  Mode: Row  Table Cardinality: 2000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=10 EndOfScans=1\\n                    Output List: cs.product, cs.max_year\\n                    Defined Values: cs.product; cs.max_year\\nStatement: SELECT, optimization FULL (early abort: GoodEnoughPlanFound), CE model 170\\nQuery Plan Hash: 0xFA22674CE1551988\\nDegree Of Parallelism: 1\\nMemory Grant: Granted=2120kB MaxUsed=696kB Required=2048kB Desired=2120kB Requested=2120kB GrantWaitTime=0ms Feedback: No: First Execution\\nCompile: Time=15ms CPU=9ms Memory=448kB CachedPlanSize=72kB\\nextra: 1\\nCPU Time: 48 ms\\nExecution Time: 48 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]},{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":4000},\"output\":\"outliving\\n12000\",\"runtimeDurationMs\":233,\"rowsAreCapped\":false,\"computeSeconds\":0.761,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0.0000001 SubtreeCost=0.127495 AvgRowSize=11)\\n  Node Id: 1  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[globalagg1006],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0024005 SubtreeCost=0.127495 AvgRowSize=15) (actual Rows=1 Executions=1 Elapsedms=189 CPUms=188)\\n        Node Id: 2  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: globalagg1006\\n        Defined Values: globalagg1006 = SUM([partialagg1005])\\n        ->  Hash Match (Inner Join)  (est Rows=4000 IO=0 CPU=0.0484244 SubtreeCost=0.125095 AvgRowSize=15) (actual Rows=4000 Executions=1 Elapsedms=188 CPUms=187)\\n              Node Id: 3  Mode: Row\\n              Hash Keys Build: c.product\\n              Hash Keys Probe: cs.product\\n              Probe Residual: [contracts].[product] as [c].[product]=[contract_sheet].[product] as [cs].[product] AND [Expr1003]>[contract_sheet].[max_year] as [cs].[max_year]\\n              Memory Fractions: Input=0.818182 Output=1\\n              I/O: EndOfScans=1\\n              Memory Grant: Input=1096kB Output=1112kB Used=392kB\\n              Output List: partialagg1005\\n              ->  Hash Match (Aggregate)  (est Rows=8 IO=0 CPU=0.0446029 SubtreeCost=0.0578701 AvgRowSize=20) (actual Rows=3984 Executions=1 Elapsedms=2 CPUms=2)\\n                    Node Id: 4  Mode: Row\\n                    Hash Keys Build: c.product, Expr1003\\n                    Build Residual: [contracts].[product] as [c].[product] = [contracts].[product] as [c].[product] AND [Expr1003] = [Expr1003]\\n                    Memory Fractions: Input=1 Output=0.181818\\n                    I/O: EndOfScans=1\\n                    Memory Grant: Input=1112kB Output=1032kB Used=416kB\\n                    Output List: c.product, Expr1003, partialagg1005\\n                    Defined Values: partialagg1005 = COUNT(*)\\n                    ->  Compute Scalar  (est Rows=4000 IO=0 CPU=0.0004 SubtreeCost=0.0132672 AvgRowSize=12)\\n                          Node Id: 5  Mode: Row\\n                          Output List: c.product, Expr1003\\n                          Defined Values: Expr1003 = CONVERT_IMPLICIT(date,isnull([contracts].[expiration_date] as [c].[expiration_date],'9999-01-01'),0)\\n                          ->  Index Scan [contracts_product_expiration] on contracts c  (est Rows=4000 RowsRead=4000 IO=0.00831019 CPU=0.004557 SubtreeCost=0.0128672 AvgRowSize=12) (actual Rows=4000 RowsRead=4000 Executions=1 Elapsedms=0 CPUms=0)\\n                                Node Id: 6  Mode: Row  Table Cardinality: 4000  Storage: RowStore\\n                                I/O: Scans=1 LogicalReads=10 EndOfScans=1\\n                                Output List: c.product, c.expiration_date\\n                                Defined Values: c.product; c.expiration_date\\n              ->  Clustered Index Scan [PK__contract__F5AE5F622DC11566] on contract_sheet cs  (est Rows=4000 RowsRead=4000 IO=0.0142361 CPU=0.004557 SubtreeCost=0.0187931 AvgRowSize=12) (actual Rows=4000 RowsRead=4000 Executions=1 Elapsedms=1 CPUms=1)\\n                    Node Id: 7  Mode: Row  Table Cardinality: 4000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=18 EndOfScans=1\\n                    Output List: cs.product, cs.max_year\\n                    Defined Values: cs.product; cs.max_year\\nStatement: SELECT, optimization FULL (early abort: GoodEnoughPlanFound), CE model 170\\nQuery Plan Hash: 0x2D09CDED4B2114A6\\nDegree Of Parallelism: 1\\nMemory Grant: Granted=2136kB MaxUsed=808kB Required=2048kB Desired=2136kB Requested=2136kB GrantWaitTime=0ms Feedback: No: First Execution\\nWait Stats: SOS_SCHEDULER_YIELD WaitTimeMs=1 WaitCount=47\\nCompile: Time=25ms CPU=14ms Memory=416kB CachedPlanSize=72kB\\nextra: 1\\nCPU Time: 188 ms\\nExecution Time: 189 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]},{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":8000},\"output\":\"outliving\\n24000\",\"runtimeDurationMs\":857,\"rowsAreCapped\":false,\"computeSeconds\":1.459,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0.0000001 SubtreeCost=0.213366 AvgRowSize=11)\\n  Node Id: 1  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[globalagg1006],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0048005 SubtreeCost=0.213366 AvgRowSize=15) (actual Rows=1 Executions=1 Elapsedms=815 CPUms=814)\\n        Node Id: 2  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: globalagg1006\\n        Defined Values: globalagg1006 = SUM([partialagg1005])\\n        ->  Hash Match (Inner Join)  (est Rows=8000 IO=0 CPU=0.0789444 SubtreeCost=0.208566 AvgRowSize=15) (actual Rows=8000 Executions=1 Elapsedms=814 CPUms=814)\\n              Node Id: 3  Mode: Row\\n              Hash Keys Build: c.product\\n              Hash Keys Probe: cs.product\\n              Probe Residual: [contracts].[product] as [c].[product]=[contract_sheet].[product] as [cs].[product] AND [Expr1003]>[contract_sheet].[max_year] as [cs].[max_year]\\n              Memory Fractions: Input=0.846154 Output=1\\n              I/O: EndOfScans=1\\n              Memory Grant: Input=1112kB Output=1128kB Used=536kB\\n              Output List: partialagg1005\\n              ->  Hash Match (Aggregate)  (est Rows=8 IO=0 CPU=0.0713172 SubtreeCost=0.0945695 AvgRowSize=20) (actual Rows=7984 Executions=1 Elapsedms=5 CPUms=5)\\n                    Node Id: 4  Mode: Row\\n                    Hash Keys Build: c.product, Expr1003\\n                    Build Residual: [contracts].[product] as [c].[product] = [contracts].[product] as [c].[product] AND [Expr1003] = [Expr1003]\\n                    Memory Fractions: Input=1 Output=0.153846\\n                    I/O: EndOfScans=1\\n                    Memory Grant: Input=1128kB Output=1040kB Used=480kB\\n                    Output List: c.product, Expr1003, partialagg1005\\n                    Defined Values: partialagg1005 = COUNT(*)\\n                    ->  Compute Scalar  (est Rows=8000 IO=0 CPU=0.0008 SubtreeCost=0.0232524 AvgRowSize=12)\\n                          Node Id: 5  Mode: Row\\n                          Output List: c.product, Expr1003\\n                          Defined Values: Expr1003 = CONVERT_IMPLICIT(date,isnull([contracts].[expiration_date] as [c].[expiration_date],'9999-01-01'),0)\\n                          ->  Index Scan [contracts_product_expiration] on contracts c  (est Rows=8000 RowsRead=8000 IO=0.0134954 CPU=0.008957 SubtreeCost=0.0224524 AvgRowSize=12) (actual Rows=8000 RowsRead=8000 Executions=1 Elapsedms=1 CPUms=1)\\n                                Node Id: 6  Mode: Row  Table Cardinality: 8000  Storage: RowStore\\n                                I/O: Scans=1 LogicalReads=17 EndOfScans=1\\n                                Output List: c.product, c.expiration_date\\n                                Defined Values: c.product; c.expiration_date\\n              ->  Clustered Index Scan [PK__contract__F5AE5F62C034D9A3] on contract_sheet cs  (est Rows=8000 RowsRead=8000 IO=0.026088 CPU=0.008957 SubtreeCost=0.035045 AvgRowSize=12) (actual Rows=8000 RowsRead=8000 Executions=1 Elapsedms=3 CPUms=3)\\n                    Node Id: 7  Mode: Row  Table Cardinality: 8000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=34 EndOfScans=1\\n                    Output List: cs.product, cs.max_year\\n                    Defined Values: cs.product; cs.max_year\\nStatement: SELECT, optimization FULL (early abort: GoodEnoughPlanFound), CE model 170\\nQuery Plan Hash: 0x97E9AEAB5DA5ADC6\\nDegree Of Parallelism: 1\\nMemory Grant: Granted=2152kB MaxUsed=1016kB Required=2048kB Desired=2152kB Requested=2152kB GrantWaitTime=0ms Feedback: No: First Execution\\nWait Stats: SOS_SCHEDULER_YIELD WaitTimeMs=1 WaitCount=204\\nCompile: Time=24ms CPU=17ms Memory=416kB CachedPlanSize=72kB\\nextra: 1\\nCPU Time: 814 ms\\nExecution Time: 815 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]}],\"workerId\":\"426ba954-012c-4b5c-be0b-199a72aae08a\",\"correlationId\":\"2bb22223-b2c3-4541-a9f2-5cbe3e0e631d\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "SQL Server (Azure SQL Database) with dateOr99 inlined, as SQL Server 2019 and later do by default: the same join at 1,000 to 8,000 sheet lines, the function turned into an expression the optimizer can see.",
      "planCaptions": {
        "1K": "At 1,000 sheet lines SQL Server has no call to dateOr99 left: a Compute Scalar computes isnull(expiration_date, '9999-01-01') for each contract, and a Hash Match (Aggregate) groups contracts by product and that date, 984 groups. The Probe Residual compares each sheet line with every group of its product, and the call takes 12 ms.",
        "2K": "At 2,000 lines SQL Server's aggregate leaves 1,984 groups and the call takes 48 ms, four times as long as at half the size.",
        "4K": "At 4,000 lines SQL Server takes 189 ms for 3,984 groups. Inlining removed the function call, but each sheet line is still compared with every distinct expiration date on its product.",
        "8K": "At 8,000 lines SQL Server's 7,984 groups take 815 ms, more than four times as long as at half the size, on one thread. The date comparison still runs for every sheet line against every date on its product, so the time keeps growing with the square of the lines."
      }
    },
    "ssUdfInlined80k": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "SQLSERVER",
        "schemaTemplate": "CREATE TABLE contracts (id INT PRIMARY KEY, product CHAR(2) NOT NULL, expiration_date DATE NULL);\nINSERT INTO contracts (id, product, expiration_date)\nSELECT gs.value,\n       CHOOSE(gs.value % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       CASE WHEN gs.value <= 24 THEN NULL ELSE DATEADD(DAY, (gs.value - 1) / 8, CAST('2026-01-02' AS DATE)) END\nFROM GENERATE_SERIES(1, ${N}) gs;\nCREATE INDEX contracts_product_expiration ON contracts (product, expiration_date);\nCREATE TABLE contract_sheet (line_id INT PRIMARY KEY, product CHAR(2) NOT NULL, max_year DATE NOT NULL);\nINSERT INTO contract_sheet (line_id, product, max_year)\nSELECT gs.value,\n       CHOOSE(gs.value % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       DATEADD(DAY, ${N} / 8 + gs.value, CAST('2026-01-02' AS DATE))\nFROM GENERATE_SERIES(1, ${N}) gs;\nUPDATE STATISTICS contracts; UPDATE STATISTICS contract_sheet;\nCREATE FUNCTION dateOr99(@d DATE) RETURNS DATE AS\nBEGIN\n    RETURN ISNULL(@d, DATEFROMPARTS(9999, 1, 1));\nEND;",
        "scalePoints": [
          {
            "N": 8000
          },
          {
            "N": 80000
          }
        ],
        "query": "SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND ${SCHEMA}.dateOr99(c.expiration_date) > cs.max_year",
        "exobenchServerVersion": "1.4.27"
      },
      "result": "{\"timestamp\":\"2026-11-20T17:03:26.291700606Z\",\"databaseType\":\"sqlserver\",\"sql\":\"SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND ${SCHEMA}.dateOr99(c.expiration_date) > cs.max_year\",\"warmCacheIterations\":0,\"compression\":\"low\",\"seed\":1531766013,\"seedSource\":\"default\",\"scalePointCount\":2,\"totalComputeSeconds\":66.304,\"results\":[{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":8000},\"output\":\"outliving\\n24000\",\"runtimeDurationMs\":670,\"rowsAreCapped\":false,\"computeSeconds\":1.243,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0.0000001 SubtreeCost=0.213366 AvgRowSize=11)\\n  Node Id: 1  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[globalagg1006],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0048005 SubtreeCost=0.213366 AvgRowSize=15) (actual Rows=1 Executions=1 Elapsedms=629 CPUms=629)\\n        Node Id: 2  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: globalagg1006\\n        Defined Values: globalagg1006 = SUM([partialagg1005])\\n        ->  Hash Match (Inner Join)  (est Rows=8000 IO=0 CPU=0.0789444 SubtreeCost=0.208566 AvgRowSize=15) (actual Rows=8000 Executions=1 Elapsedms=629 CPUms=628)\\n              Node Id: 3  Mode: Row\\n              Hash Keys Build: c.product\\n              Hash Keys Probe: cs.product\\n              Probe Residual: [contracts].[product] as [c].[product]=[contract_sheet].[product] as [cs].[product] AND [Expr1003]>[contract_sheet].[max_year] as [cs].[max_year]\\n              Memory Fractions: Input=0.846154 Output=1\\n              I/O: EndOfScans=1\\n              Memory Grant: Input=1112kB Output=1128kB Used=536kB\\n              Output List: partialagg1005\\n              ->  Hash Match (Aggregate)  (est Rows=8 IO=0 CPU=0.0713172 SubtreeCost=0.0945695 AvgRowSize=20) (actual Rows=7984 Executions=1 Elapsedms=4 CPUms=4)\\n                    Node Id: 4  Mode: Row\\n                    Hash Keys Build: c.product, Expr1003\\n                    Build Residual: [contracts].[product] as [c].[product] = [contracts].[product] as [c].[product] AND [Expr1003] = [Expr1003]\\n                    Memory Fractions: Input=1 Output=0.153846\\n                    I/O: EndOfScans=1\\n                    Memory Grant: Input=1128kB Output=1040kB Used=480kB\\n                    Output List: c.product, Expr1003, partialagg1005\\n                    Defined Values: partialagg1005 = COUNT(*)\\n                    ->  Compute Scalar  (est Rows=8000 IO=0 CPU=0.0008 SubtreeCost=0.0232524 AvgRowSize=12)\\n                          Node Id: 5  Mode: Row\\n                          Output List: c.product, Expr1003\\n                          Defined Values: Expr1003 = CONVERT_IMPLICIT(date,isnull([contracts].[expiration_date] as [c].[expiration_date],'9999-01-01'),0)\\n                          ->  Index Scan [contracts_product_expiration] on contracts c  (est Rows=8000 RowsRead=8000 IO=0.0134954 CPU=0.008957 SubtreeCost=0.0224524 AvgRowSize=12) (actual Rows=8000 RowsRead=8000 Executions=1 Elapsedms=1 CPUms=1)\\n                                Node Id: 6  Mode: Row  Table Cardinality: 8000  Storage: RowStore\\n                                I/O: Scans=1 LogicalReads=17 EndOfScans=1\\n                                Output List: c.product, c.expiration_date\\n                                Defined Values: c.product; c.expiration_date\\n              ->  Clustered Index Scan [PK__contract__F5AE5F6222ADD6F6] on contract_sheet cs  (est Rows=8000 RowsRead=8000 IO=0.026088 CPU=0.008957 SubtreeCost=0.035045 AvgRowSize=12) (actual Rows=8000 RowsRead=8000 Executions=1 Elapsedms=3 CPUms=3)\\n                    Node Id: 7  Mode: Row  Table Cardinality: 8000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=34 EndOfScans=1\\n                    Output List: cs.product, cs.max_year\\n                    Defined Values: cs.product; cs.max_year\\nStatement: SELECT, optimization FULL (early abort: GoodEnoughPlanFound), CE model 170\\nQuery Plan Hash: 0x4FEA93B9882DFCA5\\nDegree Of Parallelism: 1\\nMemory Grant: Granted=2152kB MaxUsed=1016kB Required=2048kB Desired=2152kB Requested=2152kB GrantWaitTime=0ms Feedback: No: First Execution\\nWait Stats: SOS_SCHEDULER_YIELD WaitTimeMs=1 WaitCount=157\\nCompile: Time=22ms CPU=16ms Memory=416kB CachedPlanSize=72kB\\nextra: 1\\nCPU Time: 629 ms\\nExecution Time: 630 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]},{\"kind\":\"simple_row_set\",\"scalePoint\":{\"N\":80000},\"output\":\"outliving\\n240000\",\"runtimeDurationMs\":64018,\"rowsAreCapped\":false,\"computeSeconds\":65.061,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0.0000001 SubtreeCost=1.76498 AvgRowSize=11)\\n  Node Id: 1  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[globalagg1006],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0480005 SubtreeCost=1.76498 AvgRowSize=15) (actual Rows=1 Executions=1 Elapsedms=63772 CPUms=63124)\\n        Node Id: 2  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: globalagg1006\\n        Defined Values: globalagg1006 = SUM([partialagg1005])\\n        ->  Hash Match (Inner Join)  (est Rows=80000 IO=0 CPU=0.628304 SubtreeCost=1.71698 AvgRowSize=15) (actual Rows=80000 Executions=1 Elapsedms=63764 CPUms=63117)\\n              Node Id: 3  Mode: Row\\n              Hash Keys Build: c.product\\n              Hash Keys Probe: cs.product\\n              Probe Residual: [contracts].[product] as [c].[product]=[contract_sheet].[product] as [cs].[product] AND [Expr1003]>[contract_sheet].[max_year] as [cs].[max_year]\\n              Memory Fractions: Input=0.916667 Output=1\\n              I/O: Scans=14 LogicalReads=384 PhysicalReads=63 ReadAheads=728 EndOfScans=1\\n              Memory Grant: Input=1200kB Output=1216kB Used=1096kB\\n              Spill: Level=3 SpilledThreads=1\\n              Hash Spill: GrantedMemoryKb=1152 UsedMemoryKb=1096 WritesToTempDb=728 ReadsFromTempDb=728\\n              Output List: partialagg1005\\n              ->  Hash Match (Aggregate)  (est Rows=8 IO=0 CPU=0.552174 SubtreeCost=0.763308 AvgRowSize=20) (actual Rows=79984 Executions=1 Elapsedms=465 CPUms=117)\\n                    Node Id: 4  Mode: Row\\n                    Hash Keys Build: c.product, Expr1003\\n                    Build Residual: [contracts].[product] as [c].[product] = [contracts].[product] as [c].[product] AND [Expr1003] = [Expr1003]\\n                    Memory Fractions: Input=1 Output=0.0833333\\n                    I/O: Scans=12 LogicalReads=256 PhysicalReads=33 ReadAheads=456 EndOfScans=1\\n                    Memory Grant: Input=1216kB Output=1040kB Used=1160kB\\n                    Spill: Level=2 SpilledThreads=1\\n                    Hash Spill: GrantedMemoryKb=1216 UsedMemoryKb=1160 WritesToTempDb=456 ReadsFromTempDb=456\\n                    Output List: c.product, Expr1003, partialagg1005\\n                    Defined Values: partialagg1005 = COUNT(*)\\n                    ->  Compute Scalar  (est Rows=80000 IO=0 CPU=0.008 SubtreeCost=0.211134 AvgRowSize=12)\\n                          Node Id: 5  Mode: Row\\n                          Output List: c.product, Expr1003\\n                          Defined Values: Expr1003 = CONVERT_IMPLICIT(date,isnull([contracts].[expiration_date] as [c].[expiration_date],'9999-01-01'),0)\\n                          ->  Index Scan [contracts_product_expiration] on contracts c  (est Rows=80000 RowsRead=80000 IO=0.114977 CPU=0.088157 SubtreeCost=0.203134 AvgRowSize=12) (actual Rows=80000 RowsRead=80000 Executions=1 Elapsedms=12 CPUms=12)\\n                                Node Id: 6  Mode: Row  Table Cardinality: 80000  Storage: RowStore\\n                                I/O: Scans=1 LogicalReads=154 EndOfScans=1\\n                                Output List: c.product, c.expiration_date\\n                                Defined Values: c.product; c.expiration_date\\n              ->  Clustered Index Scan [PK__contract__F5AE5F6216C57684] on contract_sheet cs  (est Rows=80000 RowsRead=80000 IO=0.237199 CPU=0.088157 SubtreeCost=0.325356 AvgRowSize=12) (actual Rows=80000 RowsRead=80000 Executions=1 Elapsedms=42 CPUms=34)\\n                    Node Id: 7  Mode: Row  Table Cardinality: 80000  Storage: RowStore\\n                    I/O: Scans=1 LogicalReads=319 EndOfScans=1\\n                    Output List: cs.product, cs.max_year\\n                    Defined Values: cs.product; cs.max_year\\nStatement: SELECT, optimization FULL, CE model 170\\nQuery Plan Hash: 0x3CFDFA1A71F19490\\nDegree Of Parallelism: 1\\nMemory Grant: Granted=2240kB MaxUsed=2024kB Required=2048kB Desired=2240kB Requested=2240kB GrantWaitTime=0ms Feedback: No: First Execution\\nMissing Index: contract_sheet (EQUALITY product; INEQUALITY max_year) Impact=53.1004\\nWait Stats: SOS_SCHEDULER_YIELD WaitTimeMs=90 WaitCount=15745\\nWait Stats: PAGEIOLATCH_SH WaitTimeMs=8 WaitCount=1\\nWait Stats: RESERVED_MEMORY_ALLOCATION_EXT WaitTimeMs=1 WaitCount=1322\\nCompile: Time=229ms CPU=122ms Memory=408kB CachedPlanSize=72kB\\nextra: 1\\nCPU Time: 63124 ms\\nExecution Time: 63772 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]}],\"workerId\":\"8eed4efa-5971-4b68-a8d1-dfddc82daf9f\",\"correlationId\":\"92b4ca86-1965-44cb-9dfb-be926f2a4981\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "SQL Server (Azure SQL Database) with dateOr99 inlined, the main run's query and tables, in a later call at 8,000 and 80,000 sheet lines: the inlined UDF at ten times the story's largest size.",
      "planCaptions": {
        "8K": "At 8,000 sheet lines SQL Server runs the main run's plan on one thread: a Hash Match (Aggregate) leaves 7,984 groups of product and isnull date, and the Probe Residual compares each sheet line with every group on its product. The call takes 630 ms.",
        "80K": "At 80,000 lines the plan is the same, still on one thread. The aggregate leaves 79,984 groups, each sheet line is compared with every group on its product, and the call takes 63,772 ms, with 63,124 ms of CPU Time: about a hundred times as long for ten times the lines."
      }
    },
    "pg18Plpgsql": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "POSTGRES_18",
        "schemaTemplate": "CREATE TABLE contracts (id int PRIMARY KEY, product char(2) NOT NULL, expiration_date date);\nINSERT INTO contracts\nSELECT i, (ARRAY['CL','BZ','NG','HO','RB','QM','QG','HH'])[i % 8 + 1],\n       CASE WHEN i <= 24 THEN NULL ELSE DATE '2026-01-02' + (i - 1) / 8 END\nFROM generate_series(1, ${N}) i;\nCREATE INDEX contracts_product_expiration ON contracts (product, expiration_date);\nCREATE TABLE contract_sheet (line_id int PRIMARY KEY, product char(2) NOT NULL, max_year date NOT NULL);\nINSERT INTO contract_sheet\nSELECT i, (ARRAY['CL','BZ','NG','HO','RB','QM','QG','HH'])[i % 8 + 1], DATE '2026-01-02' + (${N} / 8 + i)\nFROM generate_series(1, ${N}) i;\nCREATE FUNCTION dateOr99(d date) RETURNS date LANGUAGE plpgsql AS $$ BEGIN RETURN COALESCE(d, DATE '9999-01-01'); END $$;\nVACUUM ANALYZE;",
        "scalePoints": [
          {
            "N": 1000
          },
          {
            "N": 2000
          },
          {
            "N": 4000
          },
          {
            "N": 8000
          }
        ],
        "query": "EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND dateOr99(c.expiration_date) > cs.max_year",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:30:06.096786726Z\",\"databaseType\":\"postgres_18\",\"sql\":\"EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND dateOr99(c.expiration_date) > cs.max_year\",\"warmCacheIterations\":0,\"seed\":139549149,\"seedSource\":\"default\",\"scalePointCount\":4,\"totalComputeSeconds\":5.965,\"results\":[{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":1000},\"output\":\"QUERY PLAN\\nAggregate  (cost=33119.92..33119.93 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=12\\n  ->  Hash Join  (cost=28.50..33015.75 rows=41667 width=0) (actual rows=3000.00 loops=1)\\n        Hash Cond: (cs.product = c.product)\\n        Join Filter: (dateor99(c.expiration_date) > cs.max_year)\\n        Rows Removed by Join Filter: 122000\\n        Buffers: shared hit=12\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..16.00 rows=1000 width=7) (actual rows=1000.00 loops=1)\\n              Buffers: shared hit=6\\n        ->  Hash  (cost=16.00..16.00 rows=1000 width=7) (actual rows=1000.00 loops=1)\\n              Buckets: 1024  Batches: 1  Memory Usage: 47kB\\n              Buffers: shared hit=6\\n              ->  Seq Scan on contracts c  (cost=0.00..16.00 rows=1000 width=7) (actual rows=1000.00 loops=1)\\n                    Buffers: shared hit=6\\nPlanning:\\n  Buffers: shared hit=136\\nPlanning Time: 0.268 ms\\nExecution Time: 31.497 ms\",\"runtimeDurationMs\":47,\"rowsAreCapped\":false,\"computeSeconds\":0.868},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":2000},\"output\":\"QUERY PLAN\\nAggregate  (cost=132383.67..132383.68 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=22\\n  ->  Hash Join  (cost=56.00..131967.00 rows=166667 width=0) (actual rows=6000.00 loops=1)\\n        Hash Cond: (cs.product = c.product)\\n        Join Filter: (dateor99(c.expiration_date) > cs.max_year)\\n        Rows Removed by Join Filter: 494000\\n        Buffers: shared hit=22\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..31.00 rows=2000 width=7) (actual rows=2000.00 loops=1)\\n              Buffers: shared hit=11\\n        ->  Hash  (cost=31.00..31.00 rows=2000 width=7) (actual rows=2000.00 loops=1)\\n              Buckets: 2048  Batches: 1  Memory Usage: 95kB\\n              Buffers: shared hit=11\\n              ->  Seq Scan on contracts c  (cost=0.00..31.00 rows=2000 width=7) (actual rows=2000.00 loops=1)\\n                    Buffers: shared hit=11\\nPlanning:\\n  Buffers: shared hit=136\\nPlanning Time: 0.267 ms\\nExecution Time: 122.351 ms\",\"runtimeDurationMs\":137,\"rowsAreCapped\":false,\"computeSeconds\":0.958},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":4000},\"output\":\"QUERY PLAN\\nAggregate  (cost=529350.67..529350.68 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=44\\n  ->  Hash Join  (cost=112.00..527684.00 rows=666667 width=0) (actual rows=12000.00 loops=1)\\n        Hash Cond: (cs.product = c.product)\\n        Join Filter: (dateor99(c.expiration_date) > cs.max_year)\\n        Rows Removed by Join Filter: 1988000\\n        Buffers: shared hit=44\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..62.00 rows=4000 width=7) (actual rows=4000.00 loops=1)\\n              Buffers: shared hit=22\\n        ->  Hash  (cost=62.00..62.00 rows=4000 width=7) (actual rows=4000.00 loops=1)\\n              Buckets: 4096  Batches: 1  Memory Usage: 189kB\\n              Buffers: shared hit=22\\n              ->  Seq Scan on contracts c  (cost=0.00..62.00 rows=4000 width=7) (actual rows=4000.00 loops=1)\\n                    Buffers: shared hit=22\\nPlanning:\\n  Buffers: shared hit=136\\nPlanning Time: 0.243 ms\\nExecution Time: 486.804 ms\",\"runtimeDurationMs\":503,\"rowsAreCapped\":false,\"computeSeconds\":1.34},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":8000},\"output\":\"QUERY PLAN\\nAggregate  (cost=2117034.67..2117034.68 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=88\\n  ->  Hash Join  (cost=224.00..2110368.00 rows=2666667 width=0) (actual rows=24000.00 loops=1)\\n        Hash Cond: (cs.product = c.product)\\n        Join Filter: (dateor99(c.expiration_date) > cs.max_year)\\n        Rows Removed by Join Filter: 7976000\\n        Buffers: shared hit=88\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..124.00 rows=8000 width=7) (actual rows=8000.00 loops=1)\\n              Buffers: shared hit=44\\n        ->  Hash  (cost=124.00..124.00 rows=8000 width=7) (actual rows=8000.00 loops=1)\\n              Buckets: 8192  Batches: 1  Memory Usage: 377kB\\n              Buffers: shared hit=44\\n              ->  Seq Scan on contracts c  (cost=0.00..124.00 rows=8000 width=7) (actual rows=8000.00 loops=1)\\n                    Buffers: shared hit=44\\nPlanning:\\n  Buffers: shared hit=136\\nPlanning Time: 0.262 ms\\nExecution Time: 1922.966 ms\",\"runtimeDurationMs\":1938,\"rowsAreCapped\":false,\"computeSeconds\":2.799}],\"workerId\":\"468f7eaa-86a5-433e-910a-45f376c25ae5\",\"correlationId\":\"ad064b59-4a65-4dae-8600-80ecb7ea197d\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "PG18 (PostgreSQL 18.7) with dateOr99 as a PL/pgSQL function at the default VOLATILE, which PostgreSQL never inlines: the same join at 1,000 to 8,000 sheet lines, one execution per size.",
      "planCaptions": {
        "1K": "At 1,000 sheet lines PG18 hashes the contracts on product and calls dateor99(c.expiration_date) in the Join Filter on every sheet line and contract that share a product. It removes 122,000 pairs in 31.497 ms.",
        "2K": "At 2,000 lines PG18's Join Filter removes 494,000 pairs and the call takes 122.351 ms, close to four times as long as at half the size.",
        "4K": "At 4,000 lines PG18's Hash Join removes 1,988,000 pairs in the Join Filter, a PL/pgSQL call for each pair it tests, and takes 486.804 ms.",
        "8K": "At 8,000 lines PG18's Join Filter removes 7,976,000 pairs and the call takes 1,922.966 ms. The plan is the same Hash Join at every size; only the pairs, and the function calls with them, grow."
      }
    },
    "pg18SqlFunction": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "POSTGRES_18",
        "schemaTemplate": "CREATE TABLE contracts (id int PRIMARY KEY, product char(2) NOT NULL, expiration_date date);\nINSERT INTO contracts\nSELECT i, (ARRAY['CL','BZ','NG','HO','RB','QM','QG','HH'])[i % 8 + 1],\n       CASE WHEN i <= 24 THEN NULL ELSE DATE '2026-01-02' + (i - 1) / 8 END\nFROM generate_series(1, ${N}) i;\nCREATE INDEX contracts_product_expiration ON contracts (product, expiration_date);\nCREATE TABLE contract_sheet (line_id int PRIMARY KEY, product char(2) NOT NULL, max_year date NOT NULL);\nINSERT INTO contract_sheet\nSELECT i, (ARRAY['CL','BZ','NG','HO','RB','QM','QG','HH'])[i % 8 + 1], DATE '2026-01-02' + (${N} / 8 + i)\nFROM generate_series(1, ${N}) i;\nCREATE FUNCTION dateOr99(d date) RETURNS date LANGUAGE sql AS $$ SELECT COALESCE(d, DATE '9999-01-01') $$;\nVACUUM ANALYZE;",
        "scalePoints": [
          {
            "N": 1000
          },
          {
            "N": 2000
          },
          {
            "N": 4000
          },
          {
            "N": 8000
          }
        ],
        "query": "EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND dateOr99(c.expiration_date) > cs.max_year",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:30:12.291682166Z\",\"databaseType\":\"postgres_18\",\"sql\":\"EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND dateOr99(c.expiration_date) > cs.max_year\",\"warmCacheIterations\":0,\"seed\":2068582539,\"seedSource\":\"default\",\"scalePointCount\":4,\"totalComputeSeconds\":3.9219999999999997,\"results\":[{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":1000},\"output\":\"QUERY PLAN\\nAggregate  (cost=1869.92..1869.93 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=12\\n  ->  Hash Join  (cost=28.50..1765.75 rows=41667 width=0) (actual rows=3000.00 loops=1)\\n        Hash Cond: (cs.product = c.product)\\n        Join Filter: (COALESCE(c.expiration_date, '9999-01-01'::date) > cs.max_year)\\n        Rows Removed by Join Filter: 122000\\n        Buffers: shared hit=12\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..16.00 rows=1000 width=7) (actual rows=1000.00 loops=1)\\n              Buffers: shared hit=6\\n        ->  Hash  (cost=16.00..16.00 rows=1000 width=7) (actual rows=1000.00 loops=1)\\n              Buckets: 1024  Batches: 1  Memory Usage: 47kB\\n              Buffers: shared hit=6\\n              ->  Seq Scan on contracts c  (cost=0.00..16.00 rows=1000 width=7) (actual rows=1000.00 loops=1)\\n                    Buffers: shared hit=6\\nPlanning:\\n  Buffers: shared hit=136\\nPlanning Time: 0.266 ms\\nExecution Time: 6.792 ms\",\"runtimeDurationMs\":22,\"rowsAreCapped\":false,\"computeSeconds\":0.849},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":2000},\"output\":\"QUERY PLAN\\nAggregate  (cost=7383.67..7383.68 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=22\\n  ->  Hash Join  (cost=56.00..6967.00 rows=166667 width=0) (actual rows=6000.00 loops=1)\\n        Hash Cond: (cs.product = c.product)\\n        Join Filter: (COALESCE(c.expiration_date, '9999-01-01'::date) > cs.max_year)\\n        Rows Removed by Join Filter: 494000\\n        Buffers: shared hit=22\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..31.00 rows=2000 width=7) (actual rows=2000.00 loops=1)\\n              Buffers: shared hit=11\\n        ->  Hash  (cost=31.00..31.00 rows=2000 width=7) (actual rows=2000.00 loops=1)\\n              Buckets: 2048  Batches: 1  Memory Usage: 95kB\\n              Buffers: shared hit=11\\n              ->  Seq Scan on contracts c  (cost=0.00..31.00 rows=2000 width=7) (actual rows=2000.00 loops=1)\\n                    Buffers: shared hit=11\\nPlanning:\\n  Buffers: shared hit=136\\nPlanning Time: 0.285 ms\\nExecution Time: 26.011 ms\",\"runtimeDurationMs\":42,\"rowsAreCapped\":false,\"computeSeconds\":0.861},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":4000},\"output\":\"QUERY PLAN\\nAggregate  (cost=29350.67..29350.68 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=44\\n  ->  Hash Join  (cost=112.00..27684.00 rows=666667 width=0) (actual rows=12000.00 loops=1)\\n        Hash Cond: (cs.product = c.product)\\n        Join Filter: (COALESCE(c.expiration_date, '9999-01-01'::date) > cs.max_year)\\n        Rows Removed by Join Filter: 1988000\\n        Buffers: shared hit=44\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..62.00 rows=4000 width=7) (actual rows=4000.00 loops=1)\\n              Buffers: shared hit=22\\n        ->  Hash  (cost=62.00..62.00 rows=4000 width=7) (actual rows=4000.00 loops=1)\\n              Buckets: 4096  Batches: 1  Memory Usage: 189kB\\n              Buffers: shared hit=22\\n              ->  Seq Scan on contracts c  (cost=0.00..62.00 rows=4000 width=7) (actual rows=4000.00 loops=1)\\n                    Buffers: shared hit=22\\nPlanning:\\n  Buffers: shared hit=136\\nPlanning Time: 0.291 ms\\nExecution Time: 110.228 ms\",\"runtimeDurationMs\":125,\"rowsAreCapped\":false,\"computeSeconds\":0.94},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":8000},\"output\":\"QUERY PLAN\\nAggregate  (cost=117034.67..117034.68 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=88\\n  ->  Hash Join  (cost=224.00..110368.00 rows=2666667 width=0) (actual rows=24000.00 loops=1)\\n        Hash Cond: (cs.product = c.product)\\n        Join Filter: (COALESCE(c.expiration_date, '9999-01-01'::date) > cs.max_year)\\n        Rows Removed by Join Filter: 7976000\\n        Buffers: shared hit=88\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..124.00 rows=8000 width=7) (actual rows=8000.00 loops=1)\\n              Buffers: shared hit=44\\n        ->  Hash  (cost=124.00..124.00 rows=8000 width=7) (actual rows=8000.00 loops=1)\\n              Buckets: 8192  Batches: 1  Memory Usage: 377kB\\n              Buffers: shared hit=44\\n              ->  Seq Scan on contracts c  (cost=0.00..124.00 rows=8000 width=7) (actual rows=8000.00 loops=1)\\n                    Buffers: shared hit=44\\nPlanning:\\n  Buffers: shared hit=136\\nPlanning Time: 0.297 ms\\nExecution Time: 408.572 ms\",\"runtimeDurationMs\":424,\"rowsAreCapped\":false,\"computeSeconds\":1.272}],\"workerId\":\"699e8abe-9a3f-4432-9a03-d859bbcb296d\",\"correlationId\":\"5881de17-9694-4e71-8108-152e864c6f17\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "PG18 (PostgreSQL 18.7) with dateOr99 as a one-line LANGUAGE sql function at the default VOLATILE, which PostgreSQL inlines: the same join at 1,000 to 8,000 sheet lines, one execution per size.",
      "planCaptions": {
        "1K": "At 1,000 sheet lines the plan has no dateor99 in it: PG18 inlined the function, and the Join Filter tests COALESCE(c.expiration_date, '9999-01-01'::date) > cs.max_year on every pair. It removes 122,000 of them in 6.792 ms.",
        "2K": "At 2,000 lines PG18 runs the same Hash Join on product with the COALESCE in the Join Filter, which removes 494,000 pairs, in 26.011 ms.",
        "4K": "At 4,000 lines PG18's filter removes 1,988,000 pairs in 110.228 ms. Inlining removed the function call, but the date test still runs on every pair.",
        "8K": "At 8,000 lines PG18's Join Filter removes 7,976,000 pairs and the call takes 408.572 ms, close to four times as long as at half the size."
      }
    },
    "pg18UnionAll": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "POSTGRES_18",
        "schemaTemplate": "CREATE TABLE contracts (id int PRIMARY KEY, product char(2) NOT NULL, expiration_date date);\nINSERT INTO contracts\nSELECT i, (ARRAY['CL','BZ','NG','HO','RB','QM','QG','HH'])[i % 8 + 1],\n       CASE WHEN i <= 24 THEN NULL ELSE DATE '2026-01-02' + (i - 1) / 8 END\nFROM generate_series(1, ${N}) i;\nCREATE INDEX contracts_product_expiration ON contracts (product, expiration_date);\nCREATE TABLE contract_sheet (line_id int PRIMARY KEY, product char(2) NOT NULL, max_year date NOT NULL);\nINSERT INTO contract_sheet\nSELECT i, (ARRAY['CL','BZ','NG','HO','RB','QM','QG','HH'])[i % 8 + 1], DATE '2026-01-02' + (${N} / 8 + i)\nFROM generate_series(1, ${N}) i;\nCREATE FUNCTION dateOr99(d date) RETURNS date LANGUAGE plpgsql AS $$ BEGIN RETURN COALESCE(d, DATE '9999-01-01'); END $$;\nVACUUM ANALYZE;",
        "scalePoints": [
          {
            "N": 1000
          },
          {
            "N": 2000
          },
          {
            "N": 4000
          },
          {
            "N": 8000
          }
        ],
        "query": "EXPLAIN (ANALYZE, TIMING OFF) SELECT sum(n) AS outliving FROM (SELECT count(*) AS n FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND c.expiration_date IS NULL UNION ALL SELECT count(*) FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND c.expiration_date > cs.max_year) t",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:29:57.309274392Z\",\"databaseType\":\"postgres_18\",\"sql\":\"EXPLAIN (ANALYZE, TIMING OFF) SELECT sum(n) AS outliving FROM (SELECT count(*) AS n FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND c.expiration_date IS NULL UNION ALL SELECT count(*) FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND c.expiration_date > cs.max_year) t\",\"warmCacheIterations\":0,\"seed\":3166316958,\"seedSource\":\"default\",\"scalePointCount\":4,\"totalComputeSeconds\":3.423,\"results\":[{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":1000},\"output\":\"QUERY PLAN\\nAggregate  (cost=1751.89..1751.90 rows=1 width=32) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=3033 read=4\\n  ->  Append  (cost=76.68..1751.88 rows=2 width=8) (actual rows=2.00 loops=1)\\n        Buffers: shared hit=3033 read=4\\n        ->  Aggregate  (cost=76.68..76.69 rows=1 width=8) (actual rows=1.00 loops=1)\\n              Buffers: shared hit=27 read=4\\n              ->  Nested Loop  (cost=0.29..69.18 rows=3000 width=0) (actual rows=3000.00 loops=1)\\n                    Buffers: shared hit=27 read=4\\n                    ->  Seq Scan on contract_sheet cs  (cost=0.00..16.00 rows=1000 width=3) (actual rows=1000.00 loops=1)\\n                          Buffers: shared hit=6\\n                    ->  Memoize  (cost=0.29..0.36 rows=3 width=3) (actual rows=3.00 loops=1000)\\n                          Cache Key: cs.product\\n                          Cache Mode: logical\\n                          Hits: 992  Misses: 8  Evictions: 0  Overflows: 0  Memory Usage: 2kB\\n                          Buffers: shared hit=21 read=4\\n                          ->  Index Only Scan using contracts_product_expiration on contracts c  (cost=0.28..0.35 rows=3 width=3) (actual rows=3.00 loops=8)\\n                                Index Cond: ((product = cs.product) AND (expiration_date IS NULL))\\n                                Heap Fetches: 0\\n                                Index Searches: 8\\n                                Buffers: shared hit=21 read=4\\n        ->  Aggregate  (cost=1675.17..1675.18 rows=1 width=8) (actual rows=1.00 loops=1)\\n              Buffers: shared hit=3006\\n              ->  Nested Loop  (cost=0.28..1571.00 rows=41667 width=0) (actual rows=0.00 loops=1)\\n                    Buffers: shared hit=3006\\n                    ->  Seq Scan on contract_sheet cs_1  (cost=0.00..16.00 rows=1000 width=7) (actual rows=1000.00 loops=1)\\n                          Buffers: shared hit=6\\n                    ->  Index Only Scan using contracts_product_expiration on contracts c_1  (cost=0.28..1.14 rows=42 width=7) (actual rows=0.00 loops=1000)\\n                          Index Cond: ((product = cs_1.product) AND (expiration_date > cs_1.max_year))\\n                          Heap Fetches: 0\\n                          Index Searches: 1000\\n                          Buffers: shared hit=3000\\nPlanning:\\n  Buffers: shared hit=148\\nPlanning Time: 0.349 ms\\nExecution Time: 1.548 ms\",\"runtimeDurationMs\":17,\"rowsAreCapped\":false,\"computeSeconds\":0.872},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":2000},\"output\":\"QUERY PLAN\\nAggregate  (cost=6163.88..6163.89 rows=1 width=32) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=6040 read=7\\n  ->  Append  (cost=149.17..6163.87 rows=2 width=8) (actual rows=2.00 loops=1)\\n        Buffers: shared hit=6040 read=7\\n        ->  Aggregate  (cost=149.17..149.18 rows=1 width=8) (actual rows=1.00 loops=1)\\n              Buffers: shared hit=29 read=7\\n              ->  Nested Loop  (cost=0.29..134.17 rows=6000 width=0) (actual rows=6000.00 loops=1)\\n                    Buffers: shared hit=29 read=7\\n                    ->  Seq Scan on contract_sheet cs  (cost=0.00..31.00 rows=2000 width=3) (actual rows=2000.00 loops=1)\\n                          Buffers: shared hit=11\\n                    ->  Memoize  (cost=0.29..0.36 rows=3 width=3) (actual rows=3.00 loops=2000)\\n                          Cache Key: cs.product\\n                          Cache Mode: logical\\n                          Hits: 1992  Misses: 8  Evictions: 0  Overflows: 0  Memory Usage: 2kB\\n                          Buffers: shared hit=18 read=7\\n                          ->  Index Only Scan using contracts_product_expiration on contracts c  (cost=0.28..0.35 rows=3 width=3) (actual rows=3.00 loops=8)\\n                                Index Cond: ((product = cs.product) AND (expiration_date IS NULL))\\n                                Heap Fetches: 0\\n                                Index Searches: 8\\n                                Buffers: shared hit=18 read=7\\n        ->  Aggregate  (cost=6014.67..6014.68 rows=1 width=8) (actual rows=1.00 loops=1)\\n              Buffers: shared hit=6011\\n              ->  Nested Loop  (cost=0.28..5598.00 rows=166667 width=0) (actual rows=0.00 loops=1)\\n                    Buffers: shared hit=6011\\n                    ->  Seq Scan on contract_sheet cs_1  (cost=0.00..31.00 rows=2000 width=7) (actual rows=2000.00 loops=1)\\n                          Buffers: shared hit=11\\n                    ->  Index Only Scan using contracts_product_expiration on contracts c_1  (cost=0.28..1.95 rows=83 width=7) (actual rows=0.00 loops=2000)\\n                          Index Cond: ((product = cs_1.product) AND (expiration_date > cs_1.max_year))\\n                          Heap Fetches: 0\\n                          Index Searches: 2000\\n                          Buffers: shared hit=6000\\nPlanning:\\n  Buffers: shared hit=148\\nPlanning Time: 0.320 ms\\nExecution Time: 3.087 ms\",\"runtimeDurationMs\":19,\"rowsAreCapped\":false,\"computeSeconds\":0.828},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":4000},\"output\":\"QUERY PLAN\\nAggregate  (cost=23235.87..23235.88 rows=1 width=32) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=12060 read=9\\n  ->  Append  (cost=295.17..23235.86 rows=2 width=8) (actual rows=2.00 loops=1)\\n        Buffers: shared hit=12060 read=9\\n        ->  Aggregate  (cost=295.17..295.18 rows=1 width=8) (actual rows=1.00 loops=1)\\n              Buffers: shared hit=38 read=9\\n              ->  Nested Loop  (cost=0.29..265.17 rows=12000 width=0) (actual rows=12000.00 loops=1)\\n                    Buffers: shared hit=38 read=9\\n                    ->  Seq Scan on contract_sheet cs  (cost=0.00..62.00 rows=4000 width=3) (actual rows=4000.00 loops=1)\\n                          Buffers: shared hit=22\\n                    ->  Memoize  (cost=0.29..0.36 rows=3 width=3) (actual rows=3.00 loops=4000)\\n                          Cache Key: cs.product\\n                          Cache Mode: logical\\n                          Hits: 3992  Misses: 8  Evictions: 0  Overflows: 0  Memory Usage: 2kB\\n                          Buffers: shared hit=16 read=9\\n                          ->  Index Only Scan using contracts_product_expiration on contracts c  (cost=0.28..0.35 rows=3 width=3) (actual rows=3.00 loops=8)\\n                                Index Cond: ((product = cs.product) AND (expiration_date IS NULL))\\n                                Heap Fetches: 0\\n                                Index Searches: 8\\n                                Buffers: shared hit=16 read=9\\n        ->  Aggregate  (cost=22940.67..22940.68 rows=1 width=8) (actual rows=1.00 loops=1)\\n              Buffers: shared hit=12022\\n              ->  Nested Loop  (cost=0.28..21274.00 rows=666667 width=0) (actual rows=0.00 loops=1)\\n                    Buffers: shared hit=12022\\n                    ->  Seq Scan on contract_sheet cs_1  (cost=0.00..62.00 rows=4000 width=7) (actual rows=4000.00 loops=1)\\n                          Buffers: shared hit=22\\n                    ->  Index Only Scan using contracts_product_expiration on contracts c_1  (cost=0.28..3.63 rows=167 width=7) (actual rows=0.00 loops=4000)\\n                          Index Cond: ((product = cs_1.product) AND (expiration_date > cs_1.max_year))\\n                          Heap Fetches: 0\\n                          Index Searches: 4000\\n                          Buffers: shared hit=12000\\nPlanning:\\n  Buffers: shared hit=148\\nPlanning Time: 0.359 ms\\nExecution Time: 6.370 ms\",\"runtimeDurationMs\":22,\"rowsAreCapped\":false,\"computeSeconds\":0.843},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":8000},\"output\":\"QUERY PLAN\\nAggregate  (cost=89653.89..89653.90 rows=1 width=32) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=24104 read=9\\n  ->  Append  (cost=587.18..89653.88 rows=2 width=8) (actual rows=2.00 loops=1)\\n        Buffers: shared hit=24104 read=9\\n        ->  Aggregate  (cost=587.18..587.19 rows=1 width=8) (actual rows=1.00 loops=1)\\n              Buffers: shared hit=60 read=9\\n              ->  Nested Loop  (cost=0.29..527.18 rows=24000 width=0) (actual rows=24000.00 loops=1)\\n                    Buffers: shared hit=60 read=9\\n                    ->  Seq Scan on contract_sheet cs  (cost=0.00..124.00 rows=8000 width=3) (actual rows=8000.00 loops=1)\\n                          Buffers: shared hit=44\\n                    ->  Memoize  (cost=0.29..0.36 rows=3 width=3) (actual rows=3.00 loops=8000)\\n                          Cache Key: cs.product\\n                          Cache Mode: logical\\n                          Hits: 7992  Misses: 8  Evictions: 0  Overflows: 0  Memory Usage: 2kB\\n                          Buffers: shared hit=16 read=9\\n                          ->  Index Only Scan using contracts_product_expiration on contracts c  (cost=0.28..0.35 rows=3 width=3) (actual rows=3.00 loops=8)\\n                                Index Cond: ((product = cs.product) AND (expiration_date IS NULL))\\n                                Heap Fetches: 0\\n                                Index Searches: 8\\n                                Buffers: shared hit=16 read=9\\n        ->  Aggregate  (cost=89066.67..89066.68 rows=1 width=8) (actual rows=1.00 loops=1)\\n              Buffers: shared hit=24044\\n              ->  Nested Loop  (cost=0.28..82400.00 rows=2666667 width=0) (actual rows=0.00 loops=1)\\n                    Buffers: shared hit=24044\\n                    ->  Seq Scan on contract_sheet cs_1  (cost=0.00..124.00 rows=8000 width=7) (actual rows=8000.00 loops=1)\\n                          Buffers: shared hit=44\\n                    ->  Index Only Scan using contracts_product_expiration on contracts c_1  (cost=0.28..6.95 rows=333 width=7) (actual rows=0.00 loops=8000)\\n                          Index Cond: ((product = cs_1.product) AND (expiration_date > cs_1.max_year))\\n                          Heap Fetches: 0\\n                          Index Searches: 8000\\n                          Buffers: shared hit=24000\\nPlanning:\\n  Buffers: shared hit=148\\nPlanning Time: 0.359 ms\\nExecution Time: 13.226 ms\",\"runtimeDurationMs\":29,\"rowsAreCapped\":false,\"computeSeconds\":0.88}],\"workerId\":\"d6a0e86c-1e08-4905-82b2-a14f3966af86\",\"correlationId\":\"c429942e-eeed-43eb-a988-b8adfa2e2ac4\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "PG18 (PostgreSQL 18.7) with the condition split into a UNION ALL of two counts, expiration_date IS NULL and expiration_date > cs.max_year, summed, and no function anywhere: the same join at 1,000 to 8,000 sheet lines.",
      "planCaptions": {
        "1K": "At 1,000 sheet lines PG18 gives each half its own Nested Loop with its condition in the Index Cond on contracts_product_expiration, and the IS NULL half sits behind a Memoize keyed on product, 8 misses and 992 hits. The call takes 1.548 ms.",
        "2K": "At 2,000 lines PG18's Memoize answers 1,992 of the IS NULL half's lookups from its cache, and the > half makes 2,000 index searches. Those find nothing, since every max_year lies past the last listed date, and the call takes 3.087 ms.",
        "4K": "At 4,000 lines PG18's IS NULL half hits the cache 3,992 times and the > half searches the index 4,000 times. The call takes 6.370 ms, twice as long as at half the size.",
        "8K": "At 8,000 lines PG18's > half makes 8,000 index searches and the IS NULL half's cache takes 7,992 hits. The call takes 13.226 ms: one search per sheet line, nothing tested pair by pair."
      }
    },
    "pg18ExpressionIndex800k": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "POSTGRES_18",
        "schemaTemplate": "CREATE TABLE contracts (id int PRIMARY KEY, product char(2) NOT NULL, expiration_date date);\nINSERT INTO contracts\nSELECT i, (ARRAY['CL','BZ','NG','HO','RB','QM','QG','HH'])[i % 8 + 1],\n       CASE WHEN i <= 24 THEN NULL ELSE DATE '2026-01-02' + (i - 1) / 8 END\nFROM generate_series(1, ${N}) i;\nCREATE INDEX contracts_product_expiration ON contracts (product, expiration_date);\nCREATE TABLE contract_sheet (line_id int PRIMARY KEY, product char(2) NOT NULL, max_year date NOT NULL);\nINSERT INTO contract_sheet\nSELECT i, (ARRAY['CL','BZ','NG','HO','RB','QM','QG','HH'])[i % 8 + 1], DATE '2026-01-02' + (${N} / 8 + i)\nFROM generate_series(1, ${N}) i;\nCREATE FUNCTION dateOr99(d date) RETURNS date LANGUAGE sql IMMUTABLE AS $$ SELECT COALESCE(d, DATE '9999-01-01') $$;\nCREATE INDEX contracts_product_expiration99 ON contracts (product, dateOr99(expiration_date));\nVACUUM ANALYZE;",
        "scalePoints": [
          {
            "N": 8000
          },
          {
            "N": 80000
          },
          {
            "N": 800000
          }
        ],
        "query": "EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND dateOr99(c.expiration_date) > cs.max_year",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "c0c2143c-3dc7-4e99-9e26-13a4fddef82c"
      },
      "result": "{\"timestamp\":\"2026-11-20T16:19:18.860239673Z\",\"databaseType\":\"postgres_18\",\"sql\":\"EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND dateOr99(c.expiration_date) > cs.max_year\",\"warmCacheIterations\":0,\"seed\":1089959459,\"seedSource\":\"default\",\"scalePointCount\":3,\"totalComputeSeconds\":8.006,\"results\":[{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":8000},\"output\":\"QUERY PLAN\\nAggregate  (cost=89242.67..89242.68 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=24035 read=9\\n  ->  Nested Loop  (cost=0.28..82576.00 rows=2666667 width=0) (actual rows=24000.00 loops=1)\\n        Buffers: shared hit=24035 read=9\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..124.00 rows=8000 width=7) (actual rows=8000.00 loops=1)\\n              Buffers: shared hit=44\\n        ->  Index Scan using contracts_product_expiration99 on contracts c  (cost=0.28..6.98 rows=333 width=7) (actual rows=3.00 loops=8000)\\n              Index Cond: ((product = cs.product) AND (COALESCE(expiration_date, '9999-01-01'::date) > cs.max_year))\\n              Index Searches: 8000\\n              Buffers: shared hit=23991 read=9\\nPlanning:\\n  Buffers: shared hit=143\\nPlanning Time: 0.292 ms\\nExecution Time: 13.400 ms\",\"runtimeDurationMs\":30,\"rowsAreCapped\":false,\"computeSeconds\":0.975},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":80000},\"output\":\"QUERY PLAN\\nAggregate  (cost=8693050.04..8693050.05 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=240424 read=9\\n  ->  Nested Loop  (cost=0.29..8026449.00 rows=266640417 width=0) (actual rows=240000.00 loops=1)\\n        Buffers: shared hit=240424 read=9\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..1233.00 rows=80000 width=7) (actual rows=80000.00 loops=1)\\n              Buffers: shared hit=433\\n        ->  Index Scan using contracts_product_expiration99 on contracts c  (cost=0.29..66.99 rows=3333 width=7) (actual rows=3.00 loops=80000)\\n              Index Cond: ((product = cs.product) AND (COALESCE(expiration_date, '9999-01-01'::date) > cs.max_year))\\n              Index Searches: 80000\\n              Buffers: shared hit=239991 read=9\\nPlanning:\\n  Buffers: shared hit=143\\nPlanning Time: 0.317 ms\\nExecution Time: 136.601 ms\",\"runtimeDurationMs\":152,\"rowsAreCapped\":false,\"computeSeconds\":1.393},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":800000},\"output\":\"QUERY PLAN\\nAggregate  (cost=867027183.28..867027183.29 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=3204308 read=17\\n  ->  Nested Loop  (cost=0.42..800370409.00 rows=26662709713 width=0) (actual rows=2400000.00 loops=1)\\n        Buffers: shared hit=3204308 read=17\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..12325.00 rows=800000 width=7) (actual rows=800000.00 loops=1)\\n              Buffers: shared hit=4325\\n        ->  Index Scan using contracts_product_expiration99 on contracts c  (cost=0.42..667.12 rows=33333 width=7) (actual rows=3.00 loops=800000)\\n              Index Cond: ((product = cs.product) AND (COALESCE(expiration_date, '9999-01-01'::date) > cs.max_year))\\n              Index Searches: 800000\\n              Buffers: shared hit=3199983 read=17\\nPlanning:\\n  Buffers: shared hit=143\\nPlanning Time: 0.303 ms\\nExecution Time: 1571.637 ms\",\"runtimeDurationMs\":1587,\"rowsAreCapped\":false,\"computeSeconds\":5.638}],\"workerId\":\"59e99939-9ee7-460a-b089-c728873ffe20\",\"correlationId\":\"8455284b-1584-453d-9f0b-b889a7d1f099\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "PG18 (PostgreSQL 18.7) with dateOr99 declared IMMUTABLE and the index on (product, dateOr99(expiration_date)), the main run's query and tables, at 8,000, 80,000 and 800,000 sheet lines in a later call.",
      "planCaptions": {
        "8K": "At 8,000 sheet lines PG18 runs the same Nested Loop as in the main run: 8,000 searches of contracts_product_expiration99, each returning the 3 contracts that never expire, in 13.400 ms.",
        "80K": "At 80,000 lines PG18 keeps the plan: 80,000 index searches, one per sheet line, each returning 3 contracts, and the call takes 136.601 ms, about ten times as long for ten times the lines.",
        "800K": "At 800,000 lines PG18 still searches the index once per sheet line, 800,000 times, and the call takes 1,571.637 ms. The searches' buffer hits come to 3,199,983, about four per search."
      }
    },
    "pg17Plpgsql": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "POSTGRES",
        "schemaTemplate": "CREATE TABLE contracts (id int PRIMARY KEY, product char(2) NOT NULL, expiration_date date);\nINSERT INTO contracts\nSELECT i, (ARRAY['CL','BZ','NG','HO','RB','QM','QG','HH'])[i % 8 + 1],\n       CASE WHEN i <= 24 THEN NULL ELSE DATE '2026-01-02' + (i - 1) / 8 END\nFROM generate_series(1, ${N}) i;\nCREATE INDEX contracts_product_expiration ON contracts (product, expiration_date);\nCREATE TABLE contract_sheet (line_id int PRIMARY KEY, product char(2) NOT NULL, max_year date NOT NULL);\nINSERT INTO contract_sheet\nSELECT i, (ARRAY['CL','BZ','NG','HO','RB','QM','QG','HH'])[i % 8 + 1], DATE '2026-01-02' + (${N} / 8 + i)\nFROM generate_series(1, ${N}) i;\nCREATE FUNCTION dateOr99(d date) RETURNS date LANGUAGE plpgsql AS $$ BEGIN RETURN COALESCE(d, DATE '9999-01-01'); END $$;\nVACUUM ANALYZE;",
        "scalePoints": [
          {
            "N": 1000
          },
          {
            "N": 2000
          },
          {
            "N": 4000
          },
          {
            "N": 8000
          }
        ],
        "query": "EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND dateOr99(c.expiration_date) > cs.max_year",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:30:30.034808413Z\",\"databaseType\":\"postgres\",\"sql\":\"EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND dateOr99(c.expiration_date) > cs.max_year\",\"warmCacheIterations\":0,\"seed\":3001268219,\"seedSource\":\"default\",\"scalePointCount\":4,\"totalComputeSeconds\":3.597,\"results\":[{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":1000},\"output\":\"QUERY PLAN\\nAggregate  (cost=33119.92..33119.93 rows=1 width=8) (actual rows=1 loops=1)\\n  ->  Hash Join  (cost=28.50..33015.75 rows=41667 width=0) (actual rows=3000 loops=1)\\n        Hash Cond: (cs.product = c.product)\\n        Join Filter: (dateor99(c.expiration_date) > cs.max_year)\\n        Rows Removed by Join Filter: 122000\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..16.00 rows=1000 width=7) (actual rows=1000 loops=1)\\n        ->  Hash  (cost=16.00..16.00 rows=1000 width=7) (actual rows=1000 loops=1)\\n              Buckets: 1024  Batches: 1  Memory Usage: 47kB\\n              ->  Seq Scan on contracts c  (cost=0.00..16.00 rows=1000 width=7) (actual rows=1000 loops=1)\\nPlanning Time: 0.259 ms\\nExecution Time: 29.912 ms\",\"runtimeDurationMs\":33,\"rowsAreCapped\":false,\"computeSeconds\":0.301},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":2000},\"output\":\"QUERY PLAN\\nAggregate  (cost=132383.67..132383.68 rows=1 width=8) (actual rows=1 loops=1)\\n  ->  Hash Join  (cost=56.00..131967.00 rows=166667 width=0) (actual rows=6000 loops=1)\\n        Hash Cond: (cs.product = c.product)\\n        Join Filter: (dateor99(c.expiration_date) > cs.max_year)\\n        Rows Removed by Join Filter: 494000\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..31.00 rows=2000 width=7) (actual rows=2000 loops=1)\\n        ->  Hash  (cost=31.00..31.00 rows=2000 width=7) (actual rows=2000 loops=1)\\n              Buckets: 2048  Batches: 1  Memory Usage: 95kB\\n              ->  Seq Scan on contracts c  (cost=0.00..31.00 rows=2000 width=7) (actual rows=2000 loops=1)\\nPlanning Time: 0.238 ms\\nExecution Time: 118.339 ms\",\"runtimeDurationMs\":122,\"rowsAreCapped\":false,\"computeSeconds\":0.376},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":4000},\"output\":\"QUERY PLAN\\nAggregate  (cost=529350.67..529350.68 rows=1 width=8) (actual rows=1 loops=1)\\n  ->  Hash Join  (cost=112.00..527684.00 rows=666667 width=0) (actual rows=12000 loops=1)\\n        Hash Cond: (cs.product = c.product)\\n        Join Filter: (dateor99(c.expiration_date) > cs.max_year)\\n        Rows Removed by Join Filter: 1988000\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..62.00 rows=4000 width=7) (actual rows=4000 loops=1)\\n        ->  Hash  (cost=62.00..62.00 rows=4000 width=7) (actual rows=4000 loops=1)\\n              Buckets: 4096  Batches: 1  Memory Usage: 189kB\\n              ->  Seq Scan on contracts c  (cost=0.00..62.00 rows=4000 width=7) (actual rows=4000 loops=1)\\nPlanning Time: 0.220 ms\\nExecution Time: 467.583 ms\",\"runtimeDurationMs\":471,\"rowsAreCapped\":false,\"computeSeconds\":0.75},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":8000},\"output\":\"QUERY PLAN\\nAggregate  (cost=2117034.67..2117034.68 rows=1 width=8) (actual rows=1 loops=1)\\n  ->  Hash Join  (cost=224.00..2110368.00 rows=2666667 width=0) (actual rows=24000 loops=1)\\n        Hash Cond: (cs.product = c.product)\\n        Join Filter: (dateor99(c.expiration_date) > cs.max_year)\\n        Rows Removed by Join Filter: 7976000\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..124.00 rows=8000 width=7) (actual rows=8000 loops=1)\\n        ->  Hash  (cost=124.00..124.00 rows=8000 width=7) (actual rows=8000 loops=1)\\n              Buckets: 8192  Batches: 1  Memory Usage: 377kB\\n              ->  Seq Scan on contracts c  (cost=0.00..124.00 rows=8000 width=7) (actual rows=8000 loops=1)\\nPlanning Time: 0.247 ms\\nExecution Time: 1857.687 ms\",\"runtimeDurationMs\":1861,\"rowsAreCapped\":false,\"computeSeconds\":2.17}],\"workerId\":\"2fab77be-e882-4450-928c-3f271cb921ea\",\"correlationId\":\"3f862ddf-79db-4212-b43e-30d5b3160421\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "PG17 (PostgreSQL 17.12) with dateOr99 as a PL/pgSQL function at the default VOLATILE: the same join at 1,000 to 8,000 sheet lines, one execution per size, for comparison with PG18.",
      "planCaptions": {
        "1K": "At 1,000 sheet lines PG17 hashes the contracts on product and calls dateor99(c.expiration_date) in the Join Filter on every pair. It removes 122,000 of them in 29.912 ms.",
        "2K": "At 2,000 lines PG17's Join Filter removes 494,000 pairs and the call takes 118.339 ms, about four times as long as at half the size.",
        "4K": "At 4,000 lines PG17's Hash Join removes 1,988,000 pairs, with a PL/pgSQL call for every pair it tests, in 467.583 ms.",
        "8K": "At 8,000 lines PG17 removes 7,976,000 pairs in the Join Filter and takes 1,857.687 ms, four times as long as at half the size."
      }
    },
    "pg17SqlFunction": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "POSTGRES",
        "schemaTemplate": "CREATE TABLE contracts (id int PRIMARY KEY, product char(2) NOT NULL, expiration_date date);\nINSERT INTO contracts\nSELECT i, (ARRAY['CL','BZ','NG','HO','RB','QM','QG','HH'])[i % 8 + 1],\n       CASE WHEN i <= 24 THEN NULL ELSE DATE '2026-01-02' + (i - 1) / 8 END\nFROM generate_series(1, ${N}) i;\nCREATE INDEX contracts_product_expiration ON contracts (product, expiration_date);\nCREATE TABLE contract_sheet (line_id int PRIMARY KEY, product char(2) NOT NULL, max_year date NOT NULL);\nINSERT INTO contract_sheet\nSELECT i, (ARRAY['CL','BZ','NG','HO','RB','QM','QG','HH'])[i % 8 + 1], DATE '2026-01-02' + (${N} / 8 + i)\nFROM generate_series(1, ${N}) i;\nCREATE FUNCTION dateOr99(d date) RETURNS date LANGUAGE sql AS $$ SELECT COALESCE(d, DATE '9999-01-01') $$;\nVACUUM ANALYZE;",
        "scalePoints": [
          {
            "N": 1000
          },
          {
            "N": 2000
          },
          {
            "N": 4000
          },
          {
            "N": 8000
          }
        ],
        "query": "EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND dateOr99(c.expiration_date) > cs.max_year",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:30:34.196662625Z\",\"databaseType\":\"postgres\",\"sql\":\"EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND dateOr99(c.expiration_date) > cs.max_year\",\"warmCacheIterations\":0,\"seed\":3809711464,\"seedSource\":\"default\",\"scalePointCount\":4,\"totalComputeSeconds\":1.584,\"results\":[{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":1000},\"output\":\"QUERY PLAN\\nAggregate  (cost=1869.92..1869.93 rows=1 width=8) (actual rows=1 loops=1)\\n  ->  Hash Join  (cost=28.50..1765.75 rows=41667 width=0) (actual rows=3000 loops=1)\\n        Hash Cond: (cs.product = c.product)\\n        Join Filter: (COALESCE(c.expiration_date, '9999-01-01'::date) > cs.max_year)\\n        Rows Removed by Join Filter: 122000\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..16.00 rows=1000 width=7) (actual rows=1000 loops=1)\\n        ->  Hash  (cost=16.00..16.00 rows=1000 width=7) (actual rows=1000 loops=1)\\n              Buckets: 1024  Batches: 1  Memory Usage: 47kB\\n              ->  Seq Scan on contracts c  (cost=0.00..16.00 rows=1000 width=7) (actual rows=1000 loops=1)\\nPlanning Time: 0.225 ms\\nExecution Time: 6.460 ms\",\"runtimeDurationMs\":10,\"rowsAreCapped\":false,\"computeSeconds\":0.247},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":2000},\"output\":\"QUERY PLAN\\nAggregate  (cost=7383.67..7383.68 rows=1 width=8) (actual rows=1 loops=1)\\n  ->  Hash Join  (cost=56.00..6967.00 rows=166667 width=0) (actual rows=6000 loops=1)\\n        Hash Cond: (cs.product = c.product)\\n        Join Filter: (COALESCE(c.expiration_date, '9999-01-01'::date) > cs.max_year)\\n        Rows Removed by Join Filter: 494000\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..31.00 rows=2000 width=7) (actual rows=2000 loops=1)\\n        ->  Hash  (cost=31.00..31.00 rows=2000 width=7) (actual rows=2000 loops=1)\\n              Buckets: 2048  Batches: 1  Memory Usage: 95kB\\n              ->  Seq Scan on contracts c  (cost=0.00..31.00 rows=2000 width=7) (actual rows=2000 loops=1)\\nPlanning Time: 0.256 ms\\nExecution Time: 25.227 ms\",\"runtimeDurationMs\":29,\"rowsAreCapped\":false,\"computeSeconds\":0.29},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":4000},\"output\":\"QUERY PLAN\\nAggregate  (cost=29350.67..29350.68 rows=1 width=8) (actual rows=1 loops=1)\\n  ->  Hash Join  (cost=112.00..27684.00 rows=666667 width=0) (actual rows=12000 loops=1)\\n        Hash Cond: (cs.product = c.product)\\n        Join Filter: (COALESCE(c.expiration_date, '9999-01-01'::date) > cs.max_year)\\n        Rows Removed by Join Filter: 1988000\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..62.00 rows=4000 width=7) (actual rows=4000 loops=1)\\n        ->  Hash  (cost=62.00..62.00 rows=4000 width=7) (actual rows=4000 loops=1)\\n              Buckets: 4096  Batches: 1  Memory Usage: 189kB\\n              ->  Seq Scan on contracts c  (cost=0.00..62.00 rows=4000 width=7) (actual rows=4000 loops=1)\\nPlanning Time: 0.234 ms\\nExecution Time: 101.325 ms\",\"runtimeDurationMs\":104,\"rowsAreCapped\":false,\"computeSeconds\":0.366},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":8000},\"output\":\"QUERY PLAN\\nAggregate  (cost=117034.67..117034.68 rows=1 width=8) (actual rows=1 loops=1)\\n  ->  Hash Join  (cost=224.00..110368.00 rows=2666667 width=0) (actual rows=24000 loops=1)\\n        Hash Cond: (cs.product = c.product)\\n        Join Filter: (COALESCE(c.expiration_date, '9999-01-01'::date) > cs.max_year)\\n        Rows Removed by Join Filter: 7976000\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..124.00 rows=8000 width=7) (actual rows=8000 loops=1)\\n        ->  Hash  (cost=124.00..124.00 rows=8000 width=7) (actual rows=8000 loops=1)\\n              Buckets: 8192  Batches: 1  Memory Usage: 377kB\\n              ->  Seq Scan on contracts c  (cost=0.00..124.00 rows=8000 width=7) (actual rows=8000 loops=1)\\nPlanning Time: 0.255 ms\\nExecution Time: 396.726 ms\",\"runtimeDurationMs\":401,\"rowsAreCapped\":false,\"computeSeconds\":0.681}],\"workerId\":\"570b4878-34c9-48e4-ac74-78e535ce6e7c\",\"correlationId\":\"d8e5b37c-a42c-45a9-9556-56c0bf38381a\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "PG17 (PostgreSQL 17.12) with dateOr99 as a one-line LANGUAGE sql function at the default VOLATILE, inlined: the same join at 1,000 to 8,000 sheet lines, one execution per size.",
      "planCaptions": {
        "1K": "At 1,000 sheet lines PG17 inlines the function, so the Join Filter tests COALESCE(c.expiration_date, '9999-01-01'::date) > cs.max_year on every pair. It removes 122,000 pairs in 6.460 ms.",
        "2K": "At 2,000 lines PG17's Hash Join on product removes 494,000 pairs in the Join Filter and takes 25.227 ms.",
        "4K": "At 4,000 lines PG17's Join Filter removes 1,988,000 pairs and the call takes 101.325 ms, with no function call left anywhere in the plan.",
        "8K": "At 8,000 lines PG17's filter removes 7,976,000 pairs and the call takes 396.726 ms; the date test still runs on every pair."
      }
    },
    "pg17HandWritten": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "POSTGRES",
        "schemaTemplate": "CREATE TABLE contracts (id int PRIMARY KEY, product char(2) NOT NULL, expiration_date date);\nINSERT INTO contracts\nSELECT i, (ARRAY['CL','BZ','NG','HO','RB','QM','QG','HH'])[i % 8 + 1],\n       CASE WHEN i <= 24 THEN NULL ELSE DATE '2026-01-02' + (i - 1) / 8 END\nFROM generate_series(1, ${N}) i;\nCREATE INDEX contracts_product_expiration ON contracts (product, expiration_date);\nCREATE TABLE contract_sheet (line_id int PRIMARY KEY, product char(2) NOT NULL, max_year date NOT NULL);\nINSERT INTO contract_sheet\nSELECT i, (ARRAY['CL','BZ','NG','HO','RB','QM','QG','HH'])[i % 8 + 1], DATE '2026-01-02' + (${N} / 8 + i)\nFROM generate_series(1, ${N}) i;\nCREATE FUNCTION dateOr99(d date) RETURNS date LANGUAGE plpgsql AS $$ BEGIN RETURN COALESCE(d, DATE '9999-01-01'); END $$;\nVACUUM ANALYZE;",
        "scalePoints": [
          {
            "N": 1000
          },
          {
            "N": 2000
          },
          {
            "N": 4000
          },
          {
            "N": 8000
          }
        ],
        "query": "EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND (c.expiration_date IS NULL OR c.expiration_date > cs.max_year)",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:30:38.560754502Z\",\"databaseType\":\"postgres\",\"sql\":\"EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND (c.expiration_date IS NULL OR c.expiration_date > cs.max_year)\",\"warmCacheIterations\":0,\"seed\":531074741,\"seedSource\":\"default\",\"scalePointCount\":4,\"totalComputeSeconds\":1.73,\"results\":[{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":1000},\"output\":\"QUERY PLAN\\nAggregate  (cost=1874.92..1874.93 rows=1 width=8) (actual rows=1 loops=1)\\n  ->  Hash Join  (cost=28.50..1765.75 rows=43667 width=0) (actual rows=3000 loops=1)\\n        Hash Cond: (cs.product = c.product)\\n        Join Filter: ((c.expiration_date IS NULL) OR (c.expiration_date > cs.max_year))\\n        Rows Removed by Join Filter: 122000\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..16.00 rows=1000 width=7) (actual rows=1000 loops=1)\\n        ->  Hash  (cost=16.00..16.00 rows=1000 width=7) (actual rows=1000 loops=1)\\n              Buckets: 1024  Batches: 1  Memory Usage: 47kB\\n              ->  Seq Scan on contracts c  (cost=0.00..16.00 rows=1000 width=7) (actual rows=1000 loops=1)\\nPlanning Time: 0.232 ms\\nExecution Time: 6.629 ms\",\"runtimeDurationMs\":10,\"rowsAreCapped\":false,\"computeSeconds\":0.262},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":2000},\"output\":\"QUERY PLAN\\nAggregate  (cost=7393.67..7393.68 rows=1 width=8) (actual rows=1 loops=1)\\n  ->  Hash Join  (cost=56.00..6967.00 rows=170667 width=0) (actual rows=6000 loops=1)\\n        Hash Cond: (cs.product = c.product)\\n        Join Filter: ((c.expiration_date IS NULL) OR (c.expiration_date > cs.max_year))\\n        Rows Removed by Join Filter: 494000\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..31.00 rows=2000 width=7) (actual rows=2000 loops=1)\\n        ->  Hash  (cost=31.00..31.00 rows=2000 width=7) (actual rows=2000 loops=1)\\n              Buckets: 2048  Batches: 1  Memory Usage: 95kB\\n              ->  Seq Scan on contracts c  (cost=0.00..31.00 rows=2000 width=7) (actual rows=2000 loops=1)\\nPlanning Time: 0.214 ms\\nExecution Time: 26.961 ms\",\"runtimeDurationMs\":31,\"rowsAreCapped\":false,\"computeSeconds\":0.274},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":4000},\"output\":\"QUERY PLAN\\nAggregate  (cost=29370.67..29370.68 rows=1 width=8) (actual rows=1 loops=1)\\n  ->  Hash Join  (cost=112.00..27684.00 rows=674667 width=0) (actual rows=12000 loops=1)\\n        Hash Cond: (cs.product = c.product)\\n        Join Filter: ((c.expiration_date IS NULL) OR (c.expiration_date > cs.max_year))\\n        Rows Removed by Join Filter: 1988000\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..62.00 rows=4000 width=7) (actual rows=4000 loops=1)\\n        ->  Hash  (cost=62.00..62.00 rows=4000 width=7) (actual rows=4000 loops=1)\\n              Buckets: 4096  Batches: 1  Memory Usage: 189kB\\n              ->  Seq Scan on contracts c  (cost=0.00..62.00 rows=4000 width=7) (actual rows=4000 loops=1)\\nPlanning Time: 0.262 ms\\nExecution Time: 103.174 ms\",\"runtimeDurationMs\":108,\"rowsAreCapped\":false,\"computeSeconds\":0.428},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":8000},\"output\":\"QUERY PLAN\\nAggregate  (cost=117074.67..117074.68 rows=1 width=8) (actual rows=1 loops=1)\\n  ->  Hash Join  (cost=224.00..110368.00 rows=2682667 width=0) (actual rows=24000 loops=1)\\n        Hash Cond: (cs.product = c.product)\\n        Join Filter: ((c.expiration_date IS NULL) OR (c.expiration_date > cs.max_year))\\n        Rows Removed by Join Filter: 7976000\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..124.00 rows=8000 width=7) (actual rows=8000 loops=1)\\n        ->  Hash  (cost=124.00..124.00 rows=8000 width=7) (actual rows=8000 loops=1)\\n              Buckets: 8192  Batches: 1  Memory Usage: 377kB\\n              ->  Seq Scan on contracts c  (cost=0.00..124.00 rows=8000 width=7) (actual rows=8000 loops=1)\\nPlanning Time: 0.285 ms\\nExecution Time: 414.908 ms\",\"runtimeDurationMs\":419,\"rowsAreCapped\":false,\"computeSeconds\":0.766}],\"workerId\":\"46bc760d-3cec-4299-999e-05041b224c23\",\"correlationId\":\"f80c9277-6d7d-48e2-8d3f-d59b9314a43f\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "PG17 (PostgreSQL 17.12) with the hand-written IS NULL OR >: the same join at 1,000 to 8,000 sheet lines, one execution per size.",
      "planCaptions": {
        "1K": "At 1,000 sheet lines PG17 hashes on product and puts the whole IS NULL OR > in the Join Filter, which removes 122,000 pairs in 6.629 ms.",
        "2K": "At 2,000 lines the OR in PG17's Join Filter removes 494,000 pairs and the call takes 26.961 ms, about four times as long as at half the size.",
        "4K": "At 4,000 lines PG17's Join Filter removes 1,988,000 pairs, and the call takes 103.174 ms.",
        "8K": "At 8,000 lines the OR removes 7,976,000 pairs and the call takes 414.908 ms; PG17 reads contracts with a Seq Scan and tests the condition on every pair."
      }
    },
    "pg17ExpressionIndex": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "POSTGRES",
        "schemaTemplate": "CREATE TABLE contracts (id int PRIMARY KEY, product char(2) NOT NULL, expiration_date date);\nINSERT INTO contracts\nSELECT i, (ARRAY['CL','BZ','NG','HO','RB','QM','QG','HH'])[i % 8 + 1],\n       CASE WHEN i <= 24 THEN NULL ELSE DATE '2026-01-02' + (i - 1) / 8 END\nFROM generate_series(1, ${N}) i;\nCREATE INDEX contracts_product_expiration ON contracts (product, expiration_date);\nCREATE TABLE contract_sheet (line_id int PRIMARY KEY, product char(2) NOT NULL, max_year date NOT NULL);\nINSERT INTO contract_sheet\nSELECT i, (ARRAY['CL','BZ','NG','HO','RB','QM','QG','HH'])[i % 8 + 1], DATE '2026-01-02' + (${N} / 8 + i)\nFROM generate_series(1, ${N}) i;\nCREATE FUNCTION dateOr99(d date) RETURNS date LANGUAGE sql IMMUTABLE AS $$ SELECT COALESCE(d, DATE '9999-01-01') $$;\nCREATE INDEX contracts_product_expiration99 ON contracts (product, dateOr99(expiration_date));\nVACUUM ANALYZE;",
        "scalePoints": [
          {
            "N": 1000
          },
          {
            "N": 2000
          },
          {
            "N": 4000
          },
          {
            "N": 8000
          }
        ],
        "query": "EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND dateOr99(c.expiration_date) > cs.max_year",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:30:43.132683892Z\",\"databaseType\":\"postgres\",\"sql\":\"EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND dateOr99(c.expiration_date) > cs.max_year\",\"warmCacheIterations\":0,\"seed\":163803353,\"seedSource\":\"default\",\"scalePointCount\":4,\"totalComputeSeconds\":2.086,\"results\":[{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":1000},\"output\":\"QUERY PLAN\\nAggregate  (cost=1699.17..1699.18 rows=1 width=8) (actual rows=1 loops=1)\\n  ->  Nested Loop  (cost=0.28..1595.00 rows=41667 width=0) (actual rows=3000 loops=1)\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..16.00 rows=1000 width=7) (actual rows=1000 loops=1)\\n        ->  Index Scan using contracts_product_expiration99 on contracts c  (cost=0.28..1.16 rows=42 width=7) (actual rows=3 loops=1000)\\n              Index Cond: ((product = cs.product) AND (COALESCE(expiration_date, '9999-01-01'::date) > cs.max_year))\\nPlanning Time: 0.308 ms\\nExecution Time: 1.487 ms\",\"runtimeDurationMs\":5,\"rowsAreCapped\":false,\"computeSeconds\":0.283},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":2000},\"output\":\"QUERY PLAN\\nAggregate  (cost=6058.67..6058.68 rows=1 width=8) (actual rows=1 loops=1)\\n  ->  Nested Loop  (cost=0.28..5642.00 rows=166667 width=0) (actual rows=6000 loops=1)\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..31.00 rows=2000 width=7) (actual rows=2000 loops=1)\\n        ->  Index Scan using contracts_product_expiration99 on contracts c  (cost=0.28..1.98 rows=83 width=7) (actual rows=3 loops=2000)\\n              Index Cond: ((product = cs.product) AND (COALESCE(expiration_date, '9999-01-01'::date) > cs.max_year))\\nPlanning Time: 0.331 ms\\nExecution Time: 3.072 ms\",\"runtimeDurationMs\":7,\"rowsAreCapped\":false,\"computeSeconds\":0.266},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":4000},\"output\":\"QUERY PLAN\\nAggregate  (cost=23028.67..23028.68 rows=1 width=8) (actual rows=1 loops=1)\\n  ->  Nested Loop  (cost=0.28..21362.00 rows=666667 width=0) (actual rows=12000 loops=1)\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..62.00 rows=4000 width=7) (actual rows=4000 loops=1)\\n        ->  Index Scan using contracts_product_expiration99 on contracts c  (cost=0.28..3.66 rows=167 width=7) (actual rows=3 loops=4000)\\n              Index Cond: ((product = cs.product) AND (COALESCE(expiration_date, '9999-01-01'::date) > cs.max_year))\\nPlanning Time: 0.318 ms\\nExecution Time: 6.059 ms\",\"runtimeDurationMs\":9,\"rowsAreCapped\":false,\"computeSeconds\":0.28},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"N\":8000},\"output\":\"QUERY PLAN\\nAggregate  (cost=89242.67..89242.68 rows=1 width=8) (actual rows=1 loops=1)\\n  ->  Nested Loop  (cost=0.28..82576.00 rows=2666667 width=0) (actual rows=24000 loops=1)\\n        ->  Seq Scan on contract_sheet cs  (cost=0.00..124.00 rows=8000 width=7) (actual rows=8000 loops=1)\\n        ->  Index Scan using contracts_product_expiration99 on contracts c  (cost=0.28..6.98 rows=333 width=7) (actual rows=3 loops=8000)\\n              Index Cond: ((product = cs.product) AND (COALESCE(expiration_date, '9999-01-01'::date) > cs.max_year))\\nPlanning Time: 0.321 ms\\nExecution Time: 12.126 ms\",\"runtimeDurationMs\":15,\"rowsAreCapped\":false,\"computeSeconds\":1.257}],\"workerId\":\"950f7863-1079-4709-be89-3e5443d8e25d\",\"correlationId\":\"a2f93e0e-2c20-4fc5-8665-1740918a3f1a\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "PG17 (PostgreSQL 17.12) with dateOr99 as a LANGUAGE sql function declared IMMUTABLE and an index on (product, dateOr99(expiration_date)): the same join at 1,000 to 8,000 sheet lines, one execution per size.",
      "planCaptions": {
        "1K": "At 1,000 sheet lines PG17 searches contracts_product_expiration99 once per sheet line with the COALESCE inside the Index Cond, 3 rows per search, in 1.487 ms.",
        "2K": "At 2,000 lines PG17's Nested Loop runs the index scan 2,000 times and takes 3.072 ms, about twice as long as at half the size.",
        "4K": "At 4,000 lines PG17 runs the index scan 4,000 times and the call takes 6.059 ms; the time still follows the sheet lines, not the pairs.",
        "8K": "At 8,000 lines PG17 makes one index search per sheet line, 8,000 in all, and takes 12.126 ms."
      }
    },
    "mysqlNotDeterministic": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "MYSQL",
        "schemaTemplate": "SET SESSION cte_max_recursion_depth = 4294967295;\nCREATE TABLE contracts (id INT PRIMARY KEY, product CHAR(2) NOT NULL, expiration_date DATE NULL, INDEX contracts_product_expiration (product, expiration_date));\nINSERT INTO contracts (id, product, expiration_date)\nWITH RECURSIVE s(i) AS (SELECT 1 UNION ALL SELECT i + 1 FROM s WHERE i < ${N})\nSELECT i, ELT(i % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       CASE WHEN i <= 24 THEN NULL ELSE DATE_ADD('2026-01-02', INTERVAL (i - 1) DIV 8 DAY) END\nFROM s;\nCREATE TABLE contract_sheet (line_id INT PRIMARY KEY, product CHAR(2) NOT NULL, max_year DATE NOT NULL);\nINSERT INTO contract_sheet (line_id, product, max_year)\nWITH RECURSIVE s(i) AS (SELECT 1 UNION ALL SELECT i + 1 FROM s WHERE i < ${N})\nSELECT i, ELT(i % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'), DATE_ADD('2026-01-02', INTERVAL (${N} DIV 8 + i) DAY)\nFROM s;\nCREATE FUNCTION dateOr99(d DATE) RETURNS DATE NO SQL RETURN COALESCE(d, '9999-01-01');\nANALYZE TABLE contracts, contract_sheet;",
        "scalePoints": [
          {
            "N": 1000
          },
          {
            "N": 2000
          },
          {
            "N": 4000
          },
          {
            "N": 8000
          }
        ],
        "query": "EXPLAIN ANALYZE SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND dateOr99(c.expiration_date) > cs.max_year",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:29:08.545270886Z\",\"databaseType\":\"mysql\",\"sql\":\"EXPLAIN ANALYZE SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND dateOr99(c.expiration_date) > cs.max_year\",\"warmCacheIterations\":0,\"seed\":2243249030,\"seedSource\":\"default\",\"seedNote\":\"MySQL has no session-level random seed (RAND(N) is per statement); the seed was recorded but RAND() was not seeded.\",\"scalePointCount\":4,\"totalComputeSeconds\":23.324,\"results\":[{\"kind\":\"mysql_explain_analyze\",\"scalePoint\":{\"N\":1000},\"output\":\"EXPLAIN\\n-> Aggregate: count(0)  (cost=25411 rows=1) (actual time=302..302 rows=1 loops=1)\\n    -> Nested loop inner join  (cost=12911 rows=125000) (actual time=0.0618..301 rows=3000 loops=1)\\n        -> Table scan on cs  (cost=101 rows=1000) (actual time=0.0164..0.301 rows=1000 loops=1)\\n        -> Filter: (dateOr99(c.expiration_date) > cs.max_year)  (cost=0.323 rows=125) (actual time=0.017..0.301 rows=3 loops=1000)\\n            -> Covering index lookup on c using contracts_product_expiration (product=cs.product)  (cost=0.323 rows=125) (actual time=0.0147..0.0313 rows=125 loops=1000)\\n\",\"runtimeDurationMs\":305,\"rowsAreCapped\":false,\"computeSeconds\":0.658},{\"kind\":\"mysql_explain_analyze\",\"scalePoint\":{\"N\":2000},\"output\":\"EXPLAIN\\n-> Aggregate: count(0)  (cost=100944 rows=1) (actual time=1018..1018 rows=1 loops=1)\\n    -> Nested loop inner join  (cost=50944 rows=500000) (actual time=0.0552..1017 rows=6000 loops=1)\\n        -> Table scan on cs  (cost=202 rows=2000) (actual time=0.0144..0.471 rows=2000 loops=1)\\n        -> Filter: (dateOr99(c.expiration_date) > cs.max_year)  (cost=0.384 rows=250) (actual time=0.0166..0.508 rows=3 loops=2000)\\n            -> Covering index lookup on c using contracts_product_expiration (product=cs.product)  (cost=0.384 rows=250) (actual time=0.0144..0.0562 rows=250 loops=2000)\\n\",\"runtimeDurationMs\":1020,\"rowsAreCapped\":false,\"computeSeconds\":1.335},{\"kind\":\"mysql_explain_analyze\",\"scalePoint\":{\"N\":4000},\"output\":\"EXPLAIN\\n-> Aggregate: count(0)  (cost=402375 rows=1) (actual time=4146..4146 rows=1 loops=1)\\n    -> Nested loop inner join  (cost=202375 rows=2e+6) (actual time=0.0563..4145 rows=12000 loops=1)\\n        -> Table scan on cs  (cost=402 rows=4000) (actual time=0.0153..1.11 rows=4000 loops=1)\\n        -> Filter: (dateOr99(c.expiration_date) > cs.max_year)  (cost=0.506 rows=500) (actual time=0.0159..1.04 rows=3 loops=4000)\\n            -> Covering index lookup on c using contracts_product_expiration (product=cs.product)  (cost=0.506 rows=500) (actual time=0.0137..0.109 rows=500 loops=4000)\\n\",\"runtimeDurationMs\":4149,\"rowsAreCapped\":false,\"computeSeconds\":4.49},{\"kind\":\"mysql_explain_analyze\",\"scalePoint\":{\"N\":8000},\"output\":\"EXPLAIN\\n-> Aggregate: count(0)  (cost=1.61e+6 rows=1) (actual time=16459..16459 rows=1 loops=1)\\n    -> Nested loop inner join  (cost=806699 rows=8e+6) (actual time=0.0545..16457 rows=24000 loops=1)\\n        -> Table scan on cs  (cost=804 rows=8000) (actual time=0.0146..2.13 rows=8000 loops=1)\\n        -> Filter: (dateOr99(c.expiration_date) > cs.max_year)  (cost=0.749 rows=1000) (actual time=0.016..2.06 rows=3 loops=8000)\\n            -> Covering index lookup on c using contracts_product_expiration (product=cs.product)  (cost=0.749 rows=1000) (actual time=0.0138..0.219 rows=1000 loops=8000)\\n\",\"runtimeDurationMs\":16461,\"rowsAreCapped\":false,\"computeSeconds\":16.841}],\"workerId\":\"fb7ce57e-acea-443f-ade9-d5e9a10ef404\",\"correlationId\":\"f6415673-958e-40a8-a550-119cef06ae66\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "MySQL 8.0.39 (Aurora 3.08.0) with dateOr99 as a stored function, NOT DETERMINISTIC by default. The same join at 1,000 to 8,000 sheet lines, EXPLAIN ANALYZE, times from the plan's root line.",
      "planCaptions": {
        "1K": "At 1,000 sheet lines MySQL looks up each line's product in contracts_product_expiration and runs dateOr99(c.expiration_date) > cs.max_year as a Filter on each of the 125 contracts it gets back. The root line reports 302 ms.",
        "2K": "At 2,000 lines each MySQL lookup returns 250 contracts, the stored function runs on every one, and the Filter keeps 3. The root line reports 1,018 ms.",
        "4K": "At 4,000 lines MySQL's Filter calls the function on 500 contracts per sheet line, and the root line reports 4,146 ms, about four times as long as at half the size.",
        "8K": "At 8,000 lines MySQL's Filter runs the stored function on all 1,000 contracts of a line's product, for every sheet line. The root line reports 16,459 ms."
      }
    },
    "mysqlDeterministic": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "MYSQL",
        "schemaTemplate": "SET SESSION cte_max_recursion_depth = 4294967295;\nCREATE TABLE contracts (id INT PRIMARY KEY, product CHAR(2) NOT NULL, expiration_date DATE NULL, INDEX contracts_product_expiration (product, expiration_date));\nINSERT INTO contracts (id, product, expiration_date)\nWITH RECURSIVE s(i) AS (SELECT 1 UNION ALL SELECT i + 1 FROM s WHERE i < ${N})\nSELECT i, ELT(i % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       CASE WHEN i <= 24 THEN NULL ELSE DATE_ADD('2026-01-02', INTERVAL (i - 1) DIV 8 DAY) END\nFROM s;\nCREATE TABLE contract_sheet (line_id INT PRIMARY KEY, product CHAR(2) NOT NULL, max_year DATE NOT NULL);\nINSERT INTO contract_sheet (line_id, product, max_year)\nWITH RECURSIVE s(i) AS (SELECT 1 UNION ALL SELECT i + 1 FROM s WHERE i < ${N})\nSELECT i, ELT(i % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'), DATE_ADD('2026-01-02', INTERVAL (${N} DIV 8 + i) DAY)\nFROM s;\nCREATE FUNCTION dateOr99(d DATE) RETURNS DATE DETERMINISTIC NO SQL RETURN COALESCE(d, '9999-01-01');\nANALYZE TABLE contracts, contract_sheet;",
        "scalePoints": [
          {
            "N": 1000
          },
          {
            "N": 2000
          },
          {
            "N": 4000
          },
          {
            "N": 8000
          }
        ],
        "query": "EXPLAIN ANALYZE SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND dateOr99(c.expiration_date) > cs.max_year",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:29:32.109958602Z\",\"databaseType\":\"mysql\",\"sql\":\"EXPLAIN ANALYZE SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND dateOr99(c.expiration_date) > cs.max_year\",\"warmCacheIterations\":0,\"seed\":1152602080,\"seedSource\":\"default\",\"seedNote\":\"MySQL has no session-level random seed (RAND(N) is per statement); the seed was recorded but RAND() was not seeded.\",\"scalePointCount\":4,\"totalComputeSeconds\":22.602999999999998,\"results\":[{\"kind\":\"mysql_explain_analyze\",\"scalePoint\":{\"N\":1000},\"output\":\"EXPLAIN\\n-> Aggregate: count(0)  (cost=25411 rows=1) (actual time=256..256 rows=1 loops=1)\\n    -> Nested loop inner join  (cost=12911 rows=125000) (actual time=0.0519..256 rows=3000 loops=1)\\n        -> Table scan on cs  (cost=101 rows=1000) (actual time=0.0149..0.2 rows=1000 loops=1)\\n        -> Filter: (dateOr99(c.expiration_date) > cs.max_year)  (cost=0.323 rows=125) (actual time=0.0153..0.255 rows=3 loops=1000)\\n            -> Covering index lookup on c using contracts_product_expiration (product=cs.product)  (cost=0.323 rows=125) (actual time=0.0131..0.0284 rows=125 loops=1000)\\n\",\"runtimeDurationMs\":259,\"rowsAreCapped\":false,\"computeSeconds\":0.494},{\"kind\":\"mysql_explain_analyze\",\"scalePoint\":{\"N\":2000},\"output\":\"EXPLAIN\\n-> Aggregate: count(0)  (cost=100944 rows=1) (actual time=1010..1010 rows=1 loops=1)\\n    -> Nested loop inner join  (cost=50944 rows=500000) (actual time=0.0561..1010 rows=6000 loops=1)\\n        -> Table scan on cs  (cost=202 rows=2000) (actual time=0.0146..0.415 rows=2000 loops=1)\\n        -> Filter: (dateOr99(c.expiration_date) > cs.max_year)  (cost=0.384 rows=250) (actual time=0.0155..0.504 rows=3 loops=2000)\\n            -> Covering index lookup on c using contracts_product_expiration (product=cs.product)  (cost=0.384 rows=250) (actual time=0.0133..0.0548 rows=250 loops=2000)\\n\",\"runtimeDurationMs\":1012,\"rowsAreCapped\":false,\"computeSeconds\":1.28},{\"kind\":\"mysql_explain_analyze\",\"scalePoint\":{\"N\":4000},\"output\":\"EXPLAIN\\n-> Aggregate: count(0)  (cost=402375 rows=1) (actual time=4076..4076 rows=1 loops=1)\\n    -> Nested loop inner join  (cost=202375 rows=2e+6) (actual time=0.0563..4075 rows=12000 loops=1)\\n        -> Table scan on cs  (cost=402 rows=4000) (actual time=0.0172..0.961 rows=4000 loops=1)\\n        -> Filter: (dateOr99(c.expiration_date) > cs.max_year)  (cost=0.506 rows=500) (actual time=0.0158..1.02 rows=3 loops=4000)\\n            -> Covering index lookup on c using contracts_product_expiration (product=cs.product)  (cost=0.506 rows=500) (actual time=0.0136..0.108 rows=500 loops=4000)\\n\",\"runtimeDurationMs\":4079,\"rowsAreCapped\":false,\"computeSeconds\":4.391},{\"kind\":\"mysql_explain_analyze\",\"scalePoint\":{\"N\":8000},\"output\":\"EXPLAIN\\n-> Aggregate: count(0)  (cost=1.61e+6 rows=1) (actual time=16074..16074 rows=1 loops=1)\\n    -> Nested loop inner join  (cost=806699 rows=8e+6) (actual time=0.0668..16072 rows=24000 loops=1)\\n        -> Table scan on cs  (cost=804 rows=8000) (actual time=0.0155..1.9 rows=8000 loops=1)\\n        -> Filter: (dateOr99(c.expiration_date) > cs.max_year)  (cost=0.749 rows=1000) (actual time=0.0157..2.01 rows=3 loops=8000)\\n            -> Covering index lookup on c using contracts_product_expiration (product=cs.product)  (cost=0.749 rows=1000) (actual time=0.0135..0.213 rows=1000 loops=8000)\\n\",\"runtimeDurationMs\":16076,\"rowsAreCapped\":false,\"computeSeconds\":16.438}],\"workerId\":\"dab5f64a-a172-44ae-be5a-78dfe8bd16b5\",\"correlationId\":\"92c7b24f-b273-424a-9853-db162c6ec29b\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "MySQL 8.0.39 (Aurora 3.08.0) with the same stored function declared DETERMINISTIC, a promise MySQL doesn't check. The same join at 1,000 to 8,000 sheet lines, times from the plan's root line.",
      "planCaptions": {
        "1K": "At 1,000 sheet lines, declared DETERMINISTIC, the function still runs in MySQL's Filter on all 125 contracts each product lookup returns. The root line reports 256 ms.",
        "2K": "At 2,000 lines each MySQL lookup returns 250 contracts, all of them through the function, and the Filter keeps 3. The root line reports 1,010 ms.",
        "4K": "At 4,000 lines MySQL's root line reports 4,076 ms, about four times as long as at half the size: DETERMINISTIC can't save calls when the argument changes on every pair.",
        "8K": "At 8,000 lines MySQL runs the DETERMINISTIC function on all 1,000 contracts per sheet line, and the root line reports 16,074 ms."
      }
    },
    "mysqlFunctionalIndex": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "MYSQL",
        "schemaTemplate": "SET SESSION cte_max_recursion_depth = 4294967295;\nCREATE TABLE contracts (id INT PRIMARY KEY, product CHAR(2) NOT NULL, expiration_date DATE NULL, INDEX contracts_product_expiration (product, expiration_date));\nINSERT INTO contracts (id, product, expiration_date)\nWITH RECURSIVE s(i) AS (SELECT 1 UNION ALL SELECT i + 1 FROM s WHERE i < ${N})\nSELECT i, ELT(i % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       CASE WHEN i <= 24 THEN NULL ELSE DATE_ADD('2026-01-02', INTERVAL (i - 1) DIV 8 DAY) END\nFROM s;\nCREATE TABLE contract_sheet (line_id INT PRIMARY KEY, product CHAR(2) NOT NULL, max_year DATE NOT NULL);\nINSERT INTO contract_sheet (line_id, product, max_year)\nWITH RECURSIVE s(i) AS (SELECT 1 UNION ALL SELECT i + 1 FROM s WHERE i < ${N})\nSELECT i, ELT(i % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'), DATE_ADD('2026-01-02', INTERVAL (${N} DIV 8 + i) DAY)\nFROM s;\nCREATE FUNCTION dateOr99(d DATE) RETURNS DATE NO SQL RETURN COALESCE(d, '9999-01-01');\nCREATE INDEX contracts_product_expiration99 ON contracts (product, (COALESCE(expiration_date, DATE '9999-01-01')));\nANALYZE TABLE contracts, contract_sheet;",
        "scalePoints": [
          {
            "N": 1000
          },
          {
            "N": 2000
          },
          {
            "N": 4000
          },
          {
            "N": 8000
          }
        ],
        "query": "EXPLAIN ANALYZE SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND COALESCE(c.expiration_date, DATE '9999-01-01') > cs.max_year",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:29:44.784486029Z\",\"databaseType\":\"mysql\",\"sql\":\"EXPLAIN ANALYZE SELECT COUNT(*) AS outliving FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND COALESCE(c.expiration_date, DATE '9999-01-01') > cs.max_year\",\"warmCacheIterations\":0,\"seed\":2301607997,\"seedSource\":\"default\",\"seedNote\":\"MySQL has no session-level random seed (RAND(N) is per statement); the seed was recorded but RAND() was not seeded.\",\"scalePointCount\":4,\"totalComputeSeconds\":4.229,\"results\":[{\"kind\":\"mysql_explain_analyze\",\"scalePoint\":{\"N\":1000},\"output\":\"EXPLAIN\\n-> Aggregate: count(0)  (cost=25411 rows=1) (actual time=35.5..35.5 rows=1 loops=1)\\n    -> Nested loop inner join  (cost=12911 rows=125000) (actual time=0.0424..35.3 rows=3000 loops=1)\\n        -> Table scan on cs  (cost=101 rows=1000) (actual time=0.0181..0.202 rows=1000 loops=1)\\n        -> Filter: (coalesce(c.expiration_date,DATE'9999-01-01') > cs.max_year)  (cost=0.323 rows=125) (actual time=0.0129..0.0348 rows=3 loops=1000)\\n            -> Covering index lookup on c using contracts_product_expiration (product=cs.product)  (cost=0.323 rows=125) (actual time=0.0128..0.0272 rows=125 loops=1000)\\n\",\"runtimeDurationMs\":39,\"rowsAreCapped\":false,\"computeSeconds\":0.321},{\"kind\":\"mysql_explain_analyze\",\"scalePoint\":{\"N\":2000},\"output\":\"EXPLAIN\\n-> Aggregate: count(0)  (cost=100944 rows=1) (actual time=137..137 rows=1 loops=1)\\n    -> Nested loop inner join  (cost=50944 rows=500000) (actual time=0.039..136 rows=6000 loops=1)\\n        -> Table scan on cs  (cost=202 rows=2000) (actual time=0.0161..0.382 rows=2000 loops=1)\\n        -> Filter: (coalesce(c.expiration_date,DATE'9999-01-01') > cs.max_year)  (cost=0.384 rows=250) (actual time=0.0131..0.0676 rows=3 loops=2000)\\n            -> Covering index lookup on c using contracts_product_expiration (product=cs.product)  (cost=0.384 rows=250) (actual time=0.0129..0.0526 rows=250 loops=2000)\\n\",\"runtimeDurationMs\":139,\"rowsAreCapped\":false,\"computeSeconds\":0.434},{\"kind\":\"mysql_explain_analyze\",\"scalePoint\":{\"N\":4000},\"output\":\"EXPLAIN\\n-> Aggregate: count(0)  (cost=402375 rows=1) (actual time=535..535 rows=1 loops=1)\\n    -> Nested loop inner join  (cost=202375 rows=2e+6) (actual time=0.0422..534 rows=12000 loops=1)\\n        -> Table scan on cs  (cost=402 rows=4000) (actual time=0.018..0.748 rows=4000 loops=1)\\n        -> Filter: (coalesce(c.expiration_date,DATE'9999-01-01') > cs.max_year)  (cost=0.506 rows=500) (actual time=0.0132..0.133 rows=3 loops=4000)\\n            -> Covering index lookup on c using contracts_product_expiration (product=cs.product)  (cost=0.506 rows=500) (actual time=0.013..0.103 rows=500 loops=4000)\\n\",\"runtimeDurationMs\":537,\"rowsAreCapped\":false,\"computeSeconds\":0.894},{\"kind\":\"mysql_explain_analyze\",\"scalePoint\":{\"N\":8000},\"output\":\"EXPLAIN\\n-> Aggregate: count(0)  (cost=1.61e+6 rows=1) (actual time=2117..2117 rows=1 loops=1)\\n    -> Nested loop inner join  (cost=806699 rows=8e+6) (actual time=0.0445..2116 rows=24000 loops=1)\\n        -> Table scan on cs  (cost=804 rows=8000) (actual time=0.0195..1.51 rows=8000 loops=1)\\n        -> Filter: (coalesce(c.expiration_date,DATE'9999-01-01') > cs.max_year)  (cost=0.749 rows=1000) (actual time=0.0132..0.264 rows=3 loops=8000)\\n            -> Covering index lookup on c using contracts_product_expiration (product=cs.product)  (cost=0.749 rows=1000) (actual time=0.013..0.205 rows=1000 loops=8000)\\n\",\"runtimeDurationMs\":2123,\"rowsAreCapped\":false,\"computeSeconds\":2.58}],\"workerId\":\"79a5b7c8-9982-40ed-ab41-5bf19bc12fb7\",\"correlationId\":\"d3f9bfd2-255f-431f-8c2b-1e06b4d06ab8\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "MySQL 8.0.39 (Aurora 3.08.0) with the function written out as a COALESCE in the join and a functional index on product and that same COALESCE. The same join at 1,000 to 8,000 sheet lines, times from the plan's root line.",
      "planCaptions": {
        "1K": "At 1,000 sheet lines MySQL doesn't touch the functional index: it looks product up in contracts_product_expiration and checks coalesce(c.expiration_date,DATE'9999-01-01') > cs.max_year in a Filter on 125 contracts per line. The root line reports 35.5 ms.",
        "2K": "At 2,000 lines MySQL runs the same lookup on product and the same Filter, now on 250 contracts per line, and the root line reports 137 ms.",
        "4K": "At 4,000 lines MySQL's Filter checks the COALESCE on 500 contracts per sheet line; the root line reports 535 ms, close to four times as long as at half the size.",
        "8K": "At 8,000 lines MySQL's Filter checks the COALESCE on 1,000 contracts per sheet line and the root line reports 2,117 ms, while the index built on that very expression, contracts_product_expiration99, never appears in the plan."
      }
    },
    "mysqlUnionAll": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "MYSQL",
        "schemaTemplate": "SET SESSION cte_max_recursion_depth = 4294967295;\nCREATE TABLE contracts (id INT PRIMARY KEY, product CHAR(2) NOT NULL, expiration_date DATE NULL, INDEX contracts_product_expiration (product, expiration_date));\nINSERT INTO contracts (id, product, expiration_date)\nWITH RECURSIVE s(i) AS (SELECT 1 UNION ALL SELECT i + 1 FROM s WHERE i < ${N})\nSELECT i, ELT(i % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'),\n       CASE WHEN i <= 24 THEN NULL ELSE DATE_ADD('2026-01-02', INTERVAL (i - 1) DIV 8 DAY) END\nFROM s;\nCREATE TABLE contract_sheet (line_id INT PRIMARY KEY, product CHAR(2) NOT NULL, max_year DATE NOT NULL);\nINSERT INTO contract_sheet (line_id, product, max_year)\nWITH RECURSIVE s(i) AS (SELECT 1 UNION ALL SELECT i + 1 FROM s WHERE i < ${N})\nSELECT i, ELT(i % 8 + 1, 'CL', 'BZ', 'NG', 'HO', 'RB', 'QM', 'QG', 'HH'), DATE_ADD('2026-01-02', INTERVAL (${N} DIV 8 + i) DAY)\nFROM s;\nCREATE FUNCTION dateOr99(d DATE) RETURNS DATE NO SQL RETURN COALESCE(d, '9999-01-01');\nANALYZE TABLE contracts, contract_sheet;",
        "scalePoints": [
          {
            "N": 1000
          },
          {
            "N": 2000
          },
          {
            "N": 4000
          },
          {
            "N": 8000
          }
        ],
        "query": "EXPLAIN ANALYZE SELECT SUM(n) AS outliving FROM (SELECT COUNT(*) AS n FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND c.expiration_date IS NULL UNION ALL SELECT COUNT(*) FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND c.expiration_date > cs.max_year) t",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:29:50.839885295Z\",\"databaseType\":\"mysql\",\"sql\":\"EXPLAIN ANALYZE SELECT SUM(n) AS outliving FROM (SELECT COUNT(*) AS n FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND c.expiration_date IS NULL UNION ALL SELECT COUNT(*) FROM contract_sheet cs JOIN contracts c ON c.product = cs.product AND c.expiration_date > cs.max_year) t\",\"warmCacheIterations\":0,\"seed\":274475413,\"seedSource\":\"default\",\"seedNote\":\"MySQL has no session-level random seed (RAND(N) is per statement); the seed was recorded but RAND() was not seeded.\",\"scalePointCount\":4,\"totalComputeSeconds\":4.007,\"results\":[{\"kind\":\"mysql_explain_analyze\",\"scalePoint\":{\"N\":1000},\"output\":\"EXPLAIN\\n-> Aggregate: sum(t.n)  (cost=17635..17635 rows=1) (actual time=37.2..37.2 rows=1 loops=1)\\n    -> Table scan on t  (cost=17633..17635 rows=2) (actual time=37.2..37.2 rows=2 loops=1)\\n        -> Union all materialize  (cost=17632..17632 rows=2) (actual time=37.1..37.1 rows=2 loops=1)\\n            -> Aggregate: count(0)  (cost=554 rows=1) (actual time=3.38..3.38 rows=1 loops=1)\\n                -> Nested loop inner join  (cost=453 rows=1016) (actual time=0.0267..3.22 rows=3000 loops=1)\\n                    -> Table scan on cs  (cost=101 rows=1000) (actual time=0.0156..0.182 rows=1000 loops=1)\\n                    -> Filter: (c.expiration_date is null)  (cost=0.25 rows=1.02) (actual time=0.00192..0.00273 rows=3 loops=1000)\\n                        -> Covering index lookup on c using contracts_product_expiration (product=cs.product, expiration_date=NULL)  (cost=0.25 rows=1.02) (actual time=0.00179..0.0024 rows=3 loops=1000)\\n            -> Aggregate: count(0)  (cost=17078 rows=1) (actual time=33.8..33.8 rows=1 loops=1)\\n                -> Nested loop inner join  (cost=12911 rows=41662) (actual time=33.8..33.8 rows=0 loops=1)\\n                    -> Table scan on cs  (cost=101 rows=1000) (actual time=0.0102..0.183 rows=1000 loops=1)\\n                    -> Filter: (c.expiration_date > cs.max_year)  (cost=0.315 rows=41.7) (actual time=0.0335..0.0335 rows=0 loops=1000)\\n                        -> Covering index lookup on c using contracts_product_expiration (product=cs.product)  (cost=0.315 rows=125) (actual time=0.0128..0.0269 rows=125 loops=1000)\\n\",\"runtimeDurationMs\":40,\"rowsAreCapped\":false,\"computeSeconds\":0.298},{\"kind\":\"mysql_explain_analyze\",\"scalePoint\":{\"N\":2000},\"output\":\"EXPLAIN\\n-> Aggregate: sum(t.n)  (cost=68717..68717 rows=1) (actual time=139..139 rows=1 loops=1)\\n    -> Table scan on t  (cost=68715..68717 rows=2) (actual time=139..139 rows=2 loops=1)\\n        -> Union all materialize  (cost=68714..68714 rows=2) (actual time=139..139 rows=2 loops=1)\\n            -> Aggregate: count(0)  (cost=1105 rows=1) (actual time=7.06..7.06 rows=1 loops=1)\\n                -> Nested loop inner join  (cost=903 rows=2016) (actual time=0.0261..6.75 rows=6000 loops=1)\\n                    -> Table scan on cs  (cost=202 rows=2000) (actual time=0.015..0.342 rows=2000 loops=1)\\n                    -> Filter: (c.expiration_date is null)  (cost=0.25 rows=1.01) (actual time=0.00208..0.00289 rows=3 loops=2000)\\n                        -> Covering index lookup on c using contracts_product_expiration (product=cs.product, expiration_date=NULL)  (cost=0.25 rows=1.01) (actual time=0.00193..0.00253 rows=3 loops=2000)\\n            -> Aggregate: count(0)  (cost=67609 rows=1) (actual time=132..132 rows=1 loops=1)\\n                -> Nested loop inner join  (cost=50944 rows=166650) (actual time=132..132 rows=0 loops=1)\\n                    -> Table scan on cs  (cost=202 rows=2000) (actual time=0.0107..0.393 rows=2000 loops=1)\\n                    -> Filter: (c.expiration_date > cs.max_year)  (cost=0.376 rows=83.3) (actual time=0.0656..0.0656 rows=0 loops=2000)\\n                        -> Covering index lookup on c using contracts_product_expiration (product=cs.product)  (cost=0.376 rows=250) (actual time=0.0131..0.0525 rows=250 loops=2000)\\n\",\"runtimeDurationMs\":142,\"rowsAreCapped\":false,\"computeSeconds\":0.401},{\"kind\":\"mysql_explain_analyze\",\"scalePoint\":{\"N\":4000},\"output\":\"EXPLAIN\\n-> Aggregate: sum(t.n)  (cost=271243..271243 rows=1) (actual time=528..528 rows=1 loops=1)\\n    -> Table scan on t  (cost=271242..271243 rows=2) (actual time=528..528 rows=2 loops=1)\\n        -> Union all materialize  (cost=271241..271241 rows=2) (actual time=528..528 rows=2 loops=1)\\n            -> Aggregate: count(0)  (cost=2205 rows=1) (actual time=14.2..14.2 rows=1 loops=1)\\n                -> Nested loop inner join  (cost=1804 rows=4016) (actual time=0.0278..13.6 rows=12000 loops=1)\\n                    -> Table scan on cs  (cost=402 rows=4000) (actual time=0.0166..0.693 rows=4000 loops=1)\\n                    -> Filter: (c.expiration_date is null)  (cost=0.25 rows=1) (actual time=0.00212..0.00292 rows=3 loops=4000)\\n                        -> Covering index lookup on c using contracts_product_expiration (product=cs.product, expiration_date=NULL)  (cost=0.25 rows=1) (actual time=0.00198..0.00259 rows=3 loops=4000)\\n            -> Aggregate: count(0)  (cost=269035 rows=1) (actual time=514..514 rows=1 loops=1)\\n                -> Nested loop inner join  (cost=202375 rows=666600) (actual time=514..514 rows=0 loops=1)\\n                    -> Table scan on cs  (cost=402 rows=4000) (actual time=0.0118..0.751 rows=4000 loops=1)\\n                    -> Filter: (c.expiration_date > cs.max_year)  (cost=0.497 rows=167) (actual time=0.128..0.128 rows=0 loops=4000)\\n                        -> Covering index lookup on c using contracts_product_expiration (product=cs.product)  (cost=0.497 rows=500) (actual time=0.013..0.102 rows=500 loops=4000)\\n\",\"runtimeDurationMs\":532,\"rowsAreCapped\":false,\"computeSeconds\":0.866},{\"kind\":\"mysql_explain_analyze\",\"scalePoint\":{\"N\":8000},\"output\":\"EXPLAIN\\n-> Aggregate: sum(t.n)  (cost=1.08e+6..1.08e+6 rows=1) (actual time=2075..2075 rows=1 loops=1)\\n    -> Table scan on t  (cost=1.08e+6..1.08e+6 rows=2) (actual time=2075..2075 rows=2 loops=1)\\n        -> Union all materialize  (cost=1.08e+6..1.08e+6 rows=2) (actual time=2075..2075 rows=2 loops=1)\\n            -> Aggregate: count(0)  (cost=4407 rows=1) (actual time=28.8..28.8 rows=1 loops=1)\\n                -> Nested loop inner join  (cost=3606 rows=8016) (actual time=0.0275..27.5 rows=24000 loops=1)\\n                    -> Table scan on cs  (cost=804 rows=8000) (actual time=0.0156..1.36 rows=8000 loops=1)\\n                    -> Filter: (c.expiration_date is null)  (cost=0.25 rows=1) (actual time=0.00213..0.00296 rows=3 loops=8000)\\n                        -> Covering index lookup on c using contracts_product_expiration (product=cs.product, expiration_date=NULL)  (cost=0.25 rows=1) (actual time=0.002..0.00262 rows=3 loops=8000)\\n            -> Aggregate: count(0)  (cost=1.07e+6 rows=1) (actual time=2047..2047 rows=1 loops=1)\\n                -> Nested loop inner join  (cost=806699 rows=2.67e+6) (actual time=2047..2047 rows=0 loops=1)\\n                    -> Table scan on cs  (cost=804 rows=8000) (actual time=0.0112..1.49 rows=8000 loops=1)\\n                    -> Filter: (c.expiration_date > cs.max_year)  (cost=0.741 rows=333) (actual time=0.256..0.256 rows=0 loops=8000)\\n                        -> Covering index lookup on c using contracts_product_expiration (product=cs.product)  (cost=0.741 rows=1000) (actual time=0.0131..0.203 rows=1000 loops=8000)\\n\",\"runtimeDurationMs\":2079,\"rowsAreCapped\":false,\"computeSeconds\":2.442}],\"workerId\":\"a36f0913-c87e-40cb-8517-348dd0e18726\",\"correlationId\":\"6256bec3-3d77-47b6-b016-b67031409626\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "MySQL 8.0.39 (Aurora 3.08.0) with the condition split into a UNION ALL of two counts, IS NULL and > max_year, summed. The same join at 1,000 to 8,000 sheet lines, times from the plan's root line.",
      "planCaptions": {
        "1K": "At 1,000 sheet lines MySQL runs the IS NULL half as an index lookup on (product=cs.product, expiration_date=NULL) that returns the 3 contracts per line, while the > half looks up product alone and filters 125 contracts per line. The root line reports 37.2 ms.",
        "2K": "At 2,000 lines MySQL's > half checks 250 contracts per line in its Filter and keeps none of them, and the root line reports 139 ms.",
        "4K": "At 4,000 lines the IS NULL half's Aggregate line in MySQL's plan reports 14.2 ms and the > half's 514 ms. The root line reports 528 ms.",
        "8K": "At 8,000 lines the IS NULL half's Aggregate line in MySQL's plan reports 28.8 ms and the > half's 2,047 ms. Nearly all of the root line's 2,075 ms is the > comparison, still made on every contract of a line's product."
      }
    },
    "pg18EqualityInline": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "POSTGRES_18",
        "schemaTemplate": "CREATE TABLE crm (id int PRIMARY KEY, email text NOT NULL);\nCREATE TABLE billing (id int PRIMARY KEY, email text NOT NULL);\nINSERT INTO crm SELECT i, 'user' || i || '@example.com' FROM generate_series(1, ${M}) i;\nINSERT INTO billing SELECT i, '  USER' || i || '@Example.COM ' FROM generate_series(1, ${M}) i;\nVACUUM ANALYZE;",
        "scalePoints": [
          {
            "M": 500
          },
          {
            "M": 1000
          },
          {
            "M": 2000
          }
        ],
        "query": "EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS matched FROM crm a JOIN billing b ON lower(trim(a.email)) = lower(trim(b.email))",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:30:47.792767191Z\",\"databaseType\":\"postgres_18\",\"sql\":\"EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS matched FROM crm a JOIN billing b ON lower(trim(a.email)) = lower(trim(b.email))\",\"warmCacheIterations\":0,\"seed\":1870352128,\"seedSource\":\"default\",\"scalePointCount\":3,\"totalComputeSeconds\":2.2439999999999998,\"results\":[{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"M\":500},\"output\":\"QUERY PLAN\\nAggregate  (cost=104.70..104.71 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=8\\n  ->  Merge Join  (cost=62.83..101.58 rows=1250 width=0) (actual rows=500.00 loops=1)\\n        Merge Cond: ((lower(TRIM(BOTH FROM a.email))) = (lower(TRIM(BOTH FROM b.email))))\\n        Buffers: shared hit=8\\n        ->  Sort  (cost=31.41..32.66 rows=500 width=19) (actual rows=500.00 loops=1)\\n              Sort Key: (lower(TRIM(BOTH FROM a.email)))\\n              Sort Method: quicksort  Memory: 52kB\\n              Buffers: shared hit=4\\n              ->  Seq Scan on crm a  (cost=0.00..9.00 rows=500 width=19) (actual rows=500.00 loops=1)\\n                    Buffers: shared hit=4\\n        ->  Sort  (cost=31.41..32.66 rows=500 width=22) (actual rows=500.00 loops=1)\\n              Sort Key: (lower(TRIM(BOTH FROM b.email)))\\n              Sort Method: quicksort  Memory: 56kB\\n              Buffers: shared hit=4\\n              ->  Seq Scan on billing b  (cost=0.00..9.00 rows=500 width=22) (actual rows=500.00 loops=1)\\n                    Buffers: shared hit=4\\nPlanning:\\n  Buffers: shared hit=84\\nPlanning Time: 0.232 ms\\nExecution Time: 0.515 ms\",\"runtimeDurationMs\":15,\"rowsAreCapped\":false,\"computeSeconds\":0.734},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"M\":1000},\"output\":\"QUERY PLAN\\nAggregate  (cost=287.16..287.17 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=15\\n  ->  Merge Join  (cost=134.66..274.66 rows=5000 width=0) (actual rows=1000.00 loops=1)\\n        Merge Cond: ((lower(TRIM(BOTH FROM a.email))) = (lower(TRIM(BOTH FROM b.email))))\\n        Buffers: shared hit=15\\n        ->  Sort  (cost=66.83..69.33 rows=1000 width=19) (actual rows=1000.00 loops=1)\\n              Sort Key: (lower(TRIM(BOTH FROM a.email)))\\n              Sort Method: quicksort  Memory: 79kB\\n              Buffers: shared hit=7\\n              ->  Seq Scan on crm a  (cost=0.00..17.00 rows=1000 width=19) (actual rows=1000.00 loops=1)\\n                    Buffers: shared hit=7\\n        ->  Sort  (cost=67.83..70.33 rows=1000 width=22) (actual rows=1000.00 loops=1)\\n              Sort Key: (lower(TRIM(BOTH FROM b.email)))\\n              Sort Method: quicksort  Memory: 87kB\\n              Buffers: shared hit=8\\n              ->  Seq Scan on billing b  (cost=0.00..18.00 rows=1000 width=22) (actual rows=1000.00 loops=1)\\n                    Buffers: shared hit=8\\nPlanning:\\n  Buffers: shared hit=84\\nPlanning Time: 0.226 ms\\nExecution Time: 0.947 ms\",\"runtimeDurationMs\":17,\"rowsAreCapped\":false,\"computeSeconds\":0.748},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"M\":2000},\"output\":\"QUERY PLAN\\nAggregate  (cost=868.32..868.33 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=29\\n  ->  Merge Join  (cost=288.32..818.32 rows=20000 width=0) (actual rows=2000.00 loops=1)\\n        Merge Cond: ((lower(TRIM(BOTH FROM a.email))) = (lower(TRIM(BOTH FROM b.email))))\\n        Buffers: shared hit=29\\n        ->  Sort  (cost=143.66..148.66 rows=2000 width=20) (actual rows=2000.00 loops=1)\\n              Sort Key: (lower(TRIM(BOTH FROM a.email)))\\n              Sort Method: quicksort  Memory: 166kB\\n              Buffers: shared hit=14\\n              ->  Seq Scan on crm a  (cost=0.00..34.00 rows=2000 width=20) (actual rows=2000.00 loops=1)\\n                    Buffers: shared hit=14\\n        ->  Sort  (cost=144.66..149.66 rows=2000 width=23) (actual rows=2000.00 loops=1)\\n              Sort Key: (lower(TRIM(BOTH FROM b.email)))\\n              Sort Method: quicksort  Memory: 173kB\\n              Buffers: shared hit=15\\n              ->  Seq Scan on billing b  (cost=0.00..35.00 rows=2000 width=23) (actual rows=2000.00 loops=1)\\n                    Buffers: shared hit=15\\nPlanning:\\n  Buffers: shared hit=84\\nPlanning Time: 0.260 ms\\nExecution Time: 1.856 ms\",\"runtimeDurationMs\":18,\"rowsAreCapped\":false,\"computeSeconds\":0.762}],\"workerId\":\"4531f12d-531e-40d8-b89d-70e6e73db102\",\"correlationId\":\"6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "PG18 (PostgreSQL 18.7) joining the two email lists on lower(trim()) written inline on both sides, no function: 500 to 2,000 rows a side, one execution per size.",
      "planCaptions": {
        "500": "At 500 rows a side PG18 sorts both lists on lower(TRIM(BOTH FROM email)) and merge-joins them on the two expressions, in 0.515 ms.",
        "1K": "At 1,000 rows a side PG18 runs the same Merge Join on the two expressions, 1,000 matches, in 0.947 ms.",
        "2K": "At 2,000 rows a side PG18's sorts and merge take 1.856 ms, about twice as long as at half the rows: the cost of sorting rows, not of testing pairs."
      }
    },
    "pg18EqualitySql": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "POSTGRES_18",
        "schemaTemplate": "CREATE TABLE crm (id int PRIMARY KEY, email text NOT NULL);\nCREATE TABLE billing (id int PRIMARY KEY, email text NOT NULL);\nINSERT INTO crm SELECT i, 'user' || i || '@example.com' FROM generate_series(1, ${M}) i;\nINSERT INTO billing SELECT i, '  USER' || i || '@Example.COM ' FROM generate_series(1, ${M}) i;\nCREATE FUNCTION norm_email(e text) RETURNS text LANGUAGE sql AS $$ SELECT lower(trim(e)) $$;\nVACUUM ANALYZE;",
        "scalePoints": [
          {
            "M": 500
          },
          {
            "M": 1000
          },
          {
            "M": 2000
          }
        ],
        "query": "EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS matched FROM crm a JOIN billing b ON norm_email(a.email) = norm_email(b.email)",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:30:51.975059670Z\",\"databaseType\":\"postgres_18\",\"sql\":\"EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS matched FROM crm a JOIN billing b ON norm_email(a.email) = norm_email(b.email)\",\"warmCacheIterations\":0,\"seed\":1870352128,\"seedSource\":\"default\",\"scalePointCount\":3,\"totalComputeSeconds\":2.245,\"results\":[{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"M\":500},\"output\":\"QUERY PLAN\\nAggregate  (cost=104.70..104.71 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=8\\n  ->  Merge Join  (cost=62.83..101.58 rows=1250 width=0) (actual rows=500.00 loops=1)\\n        Merge Cond: ((lower(TRIM(BOTH FROM a.email))) = (lower(TRIM(BOTH FROM b.email))))\\n        Buffers: shared hit=8\\n        ->  Sort  (cost=31.41..32.66 rows=500 width=19) (actual rows=500.00 loops=1)\\n              Sort Key: (lower(TRIM(BOTH FROM a.email)))\\n              Sort Method: quicksort  Memory: 52kB\\n              Buffers: shared hit=4\\n              ->  Seq Scan on crm a  (cost=0.00..9.00 rows=500 width=19) (actual rows=500.00 loops=1)\\n                    Buffers: shared hit=4\\n        ->  Sort  (cost=31.41..32.66 rows=500 width=22) (actual rows=500.00 loops=1)\\n              Sort Key: (lower(TRIM(BOTH FROM b.email)))\\n              Sort Method: quicksort  Memory: 56kB\\n              Buffers: shared hit=4\\n              ->  Seq Scan on billing b  (cost=0.00..9.00 rows=500 width=22) (actual rows=500.00 loops=1)\\n                    Buffers: shared hit=4\\nPlanning:\\n  Buffers: shared hit=94\\nPlanning Time: 0.275 ms\\nExecution Time: 0.520 ms\",\"runtimeDurationMs\":15,\"rowsAreCapped\":false,\"computeSeconds\":0.79},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"M\":1000},\"output\":\"QUERY PLAN\\nAggregate  (cost=287.16..287.17 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=15\\n  ->  Merge Join  (cost=134.66..274.66 rows=5000 width=0) (actual rows=1000.00 loops=1)\\n        Merge Cond: ((lower(TRIM(BOTH FROM a.email))) = (lower(TRIM(BOTH FROM b.email))))\\n        Buffers: shared hit=15\\n        ->  Sort  (cost=66.83..69.33 rows=1000 width=19) (actual rows=1000.00 loops=1)\\n              Sort Key: (lower(TRIM(BOTH FROM a.email)))\\n              Sort Method: quicksort  Memory: 79kB\\n              Buffers: shared hit=7\\n              ->  Seq Scan on crm a  (cost=0.00..17.00 rows=1000 width=19) (actual rows=1000.00 loops=1)\\n                    Buffers: shared hit=7\\n        ->  Sort  (cost=67.83..70.33 rows=1000 width=22) (actual rows=1000.00 loops=1)\\n              Sort Key: (lower(TRIM(BOTH FROM b.email)))\\n              Sort Method: quicksort  Memory: 87kB\\n              Buffers: shared hit=8\\n              ->  Seq Scan on billing b  (cost=0.00..18.00 rows=1000 width=22) (actual rows=1000.00 loops=1)\\n                    Buffers: shared hit=8\\nPlanning:\\n  Buffers: shared hit=94\\nPlanning Time: 0.355 ms\\nExecution Time: 0.978 ms\",\"runtimeDurationMs\":15,\"rowsAreCapped\":false,\"computeSeconds\":0.73},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"M\":2000},\"output\":\"QUERY PLAN\\nAggregate  (cost=868.32..868.33 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=29\\n  ->  Merge Join  (cost=288.32..818.32 rows=20000 width=0) (actual rows=2000.00 loops=1)\\n        Merge Cond: ((lower(TRIM(BOTH FROM a.email))) = (lower(TRIM(BOTH FROM b.email))))\\n        Buffers: shared hit=29\\n        ->  Sort  (cost=143.66..148.66 rows=2000 width=20) (actual rows=2000.00 loops=1)\\n              Sort Key: (lower(TRIM(BOTH FROM a.email)))\\n              Sort Method: quicksort  Memory: 166kB\\n              Buffers: shared hit=14\\n              ->  Seq Scan on crm a  (cost=0.00..34.00 rows=2000 width=20) (actual rows=2000.00 loops=1)\\n                    Buffers: shared hit=14\\n        ->  Sort  (cost=144.66..149.66 rows=2000 width=23) (actual rows=2000.00 loops=1)\\n              Sort Key: (lower(TRIM(BOTH FROM b.email)))\\n              Sort Method: quicksort  Memory: 173kB\\n              Buffers: shared hit=15\\n              ->  Seq Scan on billing b  (cost=0.00..35.00 rows=2000 width=23) (actual rows=2000.00 loops=1)\\n                    Buffers: shared hit=15\\nPlanning:\\n  Buffers: shared hit=94\\nPlanning Time: 0.286 ms\\nExecution Time: 1.860 ms\",\"runtimeDurationMs\":15,\"rowsAreCapped\":false,\"computeSeconds\":0.725}],\"workerId\":\"9ee1359d-76bf-4c57-ad15-1677923b87bc\",\"correlationId\":\"6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "PG18 (PostgreSQL 18.7) joining on norm_email() as a one-line LANGUAGE sql function at the default VOLATILE, which PostgreSQL inlines: 500 to 2,000 rows a side, one execution per size.",
      "planCaptions": {
        "500": "At 500 rows a side the plan has no norm_email in it: PG18 inlined it to lower(TRIM(BOTH FROM email)) and merge-joins on that in 0.520 ms.",
        "1K": "At 1,000 rows a side PG18 runs a Merge Join on the inlined expression, sorted on both sides, in 0.978 ms.",
        "2K": "At 2,000 rows a side PG18's sort-and-merge takes 1.860 ms, though the query names a VOLATILE function that inlining made disappear."
      }
    },
    "pg18EqualityImmutable": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "POSTGRES_18",
        "schemaTemplate": "CREATE TABLE crm (id int PRIMARY KEY, email text NOT NULL);\nCREATE TABLE billing (id int PRIMARY KEY, email text NOT NULL);\nINSERT INTO crm SELECT i, 'user' || i || '@example.com' FROM generate_series(1, ${M}) i;\nINSERT INTO billing SELECT i, '  USER' || i || '@Example.COM ' FROM generate_series(1, ${M}) i;\nCREATE FUNCTION norm_email(e text) RETURNS text LANGUAGE plpgsql IMMUTABLE AS $$ BEGIN RETURN lower(trim(e)); END $$;\nVACUUM ANALYZE;",
        "scalePoints": [
          {
            "M": 500
          },
          {
            "M": 1000
          },
          {
            "M": 2000
          }
        ],
        "query": "EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS matched FROM crm a JOIN billing b ON norm_email(a.email) = norm_email(b.email)",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:31:04.284786312Z\",\"databaseType\":\"postgres_18\",\"sql\":\"EXPLAIN (ANALYZE, TIMING OFF) SELECT count(*) AS matched FROM crm a JOIN billing b ON norm_email(a.email) = norm_email(b.email)\",\"warmCacheIterations\":0,\"seed\":1870352128,\"seedSource\":\"default\",\"scalePointCount\":3,\"totalComputeSeconds\":2.153,\"results\":[{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"M\":500},\"output\":\"QUERY PLAN\\nAggregate  (cost=962.20..962.21 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=24\\n  ->  Merge Join  (cost=62.83..959.08 rows=1250 width=0) (actual rows=500.00 loops=1)\\n        Merge Cond: ((norm_email(a.email)) = (norm_email(b.email)))\\n        Buffers: shared hit=24\\n        ->  Sort  (cost=31.41..32.66 rows=500 width=19) (actual rows=500.00 loops=1)\\n              Sort Key: (norm_email(a.email))\\n              Sort Method: quicksort  Memory: 52kB\\n              Buffers: shared hit=20\\n              ->  Seq Scan on crm a  (cost=0.00..9.00 rows=500 width=19) (actual rows=500.00 loops=1)\\n                    Buffers: shared hit=20\\n        ->  Sort  (cost=31.41..32.66 rows=500 width=22) (actual rows=500.00 loops=1)\\n              Sort Key: (norm_email(b.email))\\n              Sort Method: quicksort  Memory: 56kB\\n              Buffers: shared hit=4\\n              ->  Seq Scan on billing b  (cost=0.00..9.00 rows=500 width=22) (actual rows=500.00 loops=1)\\n                    Buffers: shared hit=4\\nPlanning:\\n  Buffers: shared hit=84\\nPlanning Time: 0.232 ms\\nExecution Time: 0.938 ms\",\"runtimeDurationMs\":14,\"rowsAreCapped\":false,\"computeSeconds\":0.706},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"M\":1000},\"output\":\"QUERY PLAN\\nAggregate  (cost=3227.16..3227.17 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=31\\n  ->  Merge Join  (cost=134.66..3214.66 rows=5000 width=0) (actual rows=1000.00 loops=1)\\n        Merge Cond: ((norm_email(a.email)) = (norm_email(b.email)))\\n        Buffers: shared hit=31\\n        ->  Sort  (cost=66.83..69.33 rows=1000 width=19) (actual rows=1000.00 loops=1)\\n              Sort Key: (norm_email(a.email))\\n              Sort Method: quicksort  Memory: 79kB\\n              Buffers: shared hit=23\\n              ->  Seq Scan on crm a  (cost=0.00..17.00 rows=1000 width=19) (actual rows=1000.00 loops=1)\\n                    Buffers: shared hit=23\\n        ->  Sort  (cost=67.83..70.33 rows=1000 width=22) (actual rows=1000.00 loops=1)\\n              Sort Key: (norm_email(b.email))\\n              Sort Method: quicksort  Memory: 87kB\\n              Buffers: shared hit=8\\n              ->  Seq Scan on billing b  (cost=0.00..18.00 rows=1000 width=22) (actual rows=1000.00 loops=1)\\n                    Buffers: shared hit=8\\nPlanning:\\n  Buffers: shared hit=84\\nPlanning Time: 0.215 ms\\nExecution Time: 1.641 ms\",\"runtimeDurationMs\":16,\"rowsAreCapped\":false,\"computeSeconds\":0.745},{\"kind\":\"postgres_explain_analyze\",\"scalePoint\":{\"M\":2000},\"output\":\"QUERY PLAN\\nAggregate  (cost=11648.32..11648.33 rows=1 width=8) (actual rows=1.00 loops=1)\\n  Buffers: shared hit=45\\n  ->  Merge Join  (cost=288.32..11598.32 rows=20000 width=0) (actual rows=2000.00 loops=1)\\n        Merge Cond: ((norm_email(a.email)) = (norm_email(b.email)))\\n        Buffers: shared hit=45\\n        ->  Sort  (cost=143.66..148.66 rows=2000 width=20) (actual rows=2000.00 loops=1)\\n              Sort Key: (norm_email(a.email))\\n              Sort Method: quicksort  Memory: 166kB\\n              Buffers: shared hit=30\\n              ->  Seq Scan on crm a  (cost=0.00..34.00 rows=2000 width=20) (actual rows=2000.00 loops=1)\\n                    Buffers: shared hit=30\\n        ->  Sort  (cost=144.66..149.66 rows=2000 width=23) (actual rows=2000.00 loops=1)\\n              Sort Key: (norm_email(b.email))\\n              Sort Method: quicksort  Memory: 173kB\\n              Buffers: shared hit=15\\n              ->  Seq Scan on billing b  (cost=0.00..35.00 rows=2000 width=23) (actual rows=2000.00 loops=1)\\n                    Buffers: shared hit=15\\nPlanning:\\n  Buffers: shared hit=84\\nPlanning Time: 0.226 ms\\nExecution Time: 3.166 ms\",\"runtimeDurationMs\":16,\"rowsAreCapped\":false,\"computeSeconds\":0.702}],\"workerId\":\"2abdf89e-8319-4265-82a9-d62a49877ca7\",\"correlationId\":\"6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "PG18 (PostgreSQL 18.7) joining on the PL/pgSQL norm_email() declared IMMUTABLE: 500 to 2,000 rows a side, one execution per size.",
      "planCaptions": {
        "500": "At 500 rows a side PG18's plan still calls norm_email, since PL/pgSQL is never inlined, but as IMMUTABLE it can be a Merge Cond: PG18 sorts both lists on it and merges them in 0.938 ms.",
        "1K": "At 1,000 rows a side PG18's Merge Join takes 1.641 ms, the function computed as a sort key per row rather than tested per pair.",
        "2K": "At 2,000 rows a side PG18's IMMUTABLE PL/pgSQL join takes 3.166 ms, about twice as long as at half the rows."
      }
    },
    "ssEqualityNoInline": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "SQLSERVER",
        "schemaTemplate": "CREATE TABLE crm (id INT PRIMARY KEY, email VARCHAR(200) NOT NULL);\nCREATE TABLE billing (id INT PRIMARY KEY, email VARCHAR(200) NOT NULL);\nINSERT INTO crm (id, email) SELECT gs.value, CONCAT('user', gs.value, '@example.com') FROM GENERATE_SERIES(1, ${M}) gs;\nINSERT INTO billing (id, email) SELECT gs.value, CONCAT('  USER', gs.value, '@Example.COM ') FROM GENERATE_SERIES(1, ${M}) gs;\nUPDATE STATISTICS crm; UPDATE STATISTICS billing;\nCREATE FUNCTION norm_email(@e VARCHAR(200)) RETURNS VARCHAR(200) WITH INLINE = OFF AS\nBEGIN\n    RETURN LOWER(TRIM(@e));\nEND;",
        "scalePoints": [
          {
            "M": 500
          },
          {
            "M": 1000
          },
          {
            "M": 2000
          }
        ],
        "query": "SELECT COUNT(*) AS matched FROM crm a JOIN billing b ON ${SCHEMA}.norm_email(a.email) = ${SCHEMA}.norm_email(b.email)",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:31:08.124787082Z\",\"databaseType\":\"sqlserver\",\"sql\":\"SELECT COUNT(*) AS matched FROM crm a JOIN billing b ON ${SCHEMA}.norm_email(a.email) = ${SCHEMA}.norm_email(b.email)\",\"warmCacheIterations\":0,\"compression\":\"low\",\"seed\":1870352128,\"seedSource\":\"default\",\"scalePointCount\":3,\"totalComputeSeconds\":1.627,\"results\":[{\"kind\":\"simple_row_set\",\"scalePoint\":{\"M\":500},\"output\":\"matched\\n500\",\"runtimeDurationMs\":32,\"rowsAreCapped\":false,\"computeSeconds\":0.613,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0.0732698 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1007],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0003005 SubtreeCost=0.0732698 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=4 CPUms=4)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1007\\n        Defined Values: Expr1007 = Count(*)\\n        ->  Hash Match (Inner Join)  (est Rows=500 IO=0 CPU=0.0607579 SubtreeCost=0.0729693 AvgRowSize=9) (actual Rows=500 Executions=1 Elapsedms=4 CPUms=4)\\n              Node Id: 2  Mode: Row\\n              Hash Keys Build: Expr1006\\n              Hash Keys Probe: Expr1005\\n              Probe Residual: [Expr1006]=[Expr1005]\\n              Memory Fractions: Input=1 Output=1\\n              I/O: EndOfScans=1\\n              Memory Grant: Input=1376kB Output=1376kB Used=640kB\\n              ->  Compute Scalar  (est Rows=500 IO=0 CPU=0.00005 SubtreeCost=0.00610422 AvgRowSize=111) (actual Rows=500 Executions=1 Elapsedms=2 CPUms=2)\\n                    Node Id: 3  Mode: Row\\n                    I/O: EndOfScans=1\\n                    Output List: Expr1006\\n                    Defined Values: Expr1006 = [bench-azure-sql-slot-c9ebddf4-2c1c-4905-b506-057e151d5c61].[exo_temp_06f90068_ebf4_44d2_b96c_707c08580651].[norm_email]([crm].[email] as [a].[email])\\n                    ->  Clustered Index Scan [PK__crm__3213E83F53F25664] on crm a  (est Rows=500 RowsRead=500 IO=0.00534722 CPU=0.000707 SubtreeCost=0.00605422 AvgRowSize=29) (actual Rows=500 RowsRead=500 Executions=1 Elapsedms=0 CPUms=0)\\n                          Node Id: 4  Mode: Row  Table Cardinality: 500  Storage: RowStore\\n                          I/O: Scans=1 LogicalReads=6 EndOfScans=1\\n                          Output List: a.email\\n                          Defined Values: a.email\\n              ->  Compute Scalar  (est Rows=500 IO=0 CPU=0.00005 SubtreeCost=0.00610422 AvgRowSize=111) (actual Rows=500 Executions=1 Elapsedms=2 CPUms=2)\\n                    Node Id: 5  Mode: Row\\n                    I/O: EndOfScans=1\\n                    Output List: Expr1005\\n                    Defined Values: Expr1005 = [bench-azure-sql-slot-c9ebddf4-2c1c-4905-b506-057e151d5c61].[exo_temp_06f90068_ebf4_44d2_b96c_707c08580651].[norm_email]([billing].[email] as [b].[email])\\n                    ->  Clustered Index Scan [PK__billing__3213E83F06BCDFE1] on billing b  (est Rows=500 RowsRead=500 IO=0.00534722 CPU=0.000707 SubtreeCost=0.00605422 AvgRowSize=32) (actual Rows=500 RowsRead=500 Executions=1 Elapsedms=0 CPUms=0)\\n                          Node Id: 6  Mode: Row  Table Cardinality: 500  Storage: RowStore\\n                          I/O: Scans=1 LogicalReads=6 EndOfScans=1\\n                          Output List: b.email\\n                          Defined Values: b.email\\nStatement: SELECT, optimization FULL (early abort: GoodEnoughPlanFound), CE model 170\\nQuery Plan Hash: 0x8999A5E47C7E32FE\\nDegree Of Parallelism: 0  Non-Parallel Reason: TSQLUserDefinedFunctionsNotParallelizable\\nMemory Grant: Granted=1376kB MaxUsed=640kB Required=1024kB Desired=1376kB Requested=1376kB GrantWaitTime=0ms Feedback: No: First Execution\\nCompile: Time=17ms CPU=6ms Memory=408kB CachedPlanSize=48kB\\nCPU Time: 4 ms\\nExecution Time: 4 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]},{\"kind\":\"simple_row_set\",\"scalePoint\":{\"M\":1000},\"output\":\"matched\\n1000\",\"runtimeDurationMs\":35,\"rowsAreCapped\":false,\"computeSeconds\":0.524,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0.122222 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1007],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0006005 SubtreeCost=0.122222 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=9 CPUms=9)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1007\\n        Defined Values: Expr1007 = Count(*)\\n        ->  Hash Match (Inner Join)  (est Rows=1000 IO=0 CPU=0.103766 SubtreeCost=0.121622 AvgRowSize=9) (actual Rows=1000 Executions=1 Elapsedms=9 CPUms=9)\\n              Node Id: 2  Mode: Row\\n              Hash Keys Build: Expr1006\\n              Hash Keys Probe: Expr1005\\n              Probe Residual: [Expr1006]=[Expr1005]\\n              Memory Fractions: Input=1 Output=1\\n              I/O: EndOfScans=1\\n              Memory Grant: Input=1728kB Output=1728kB Used=656kB\\n              ->  Compute Scalar  (est Rows=1000 IO=0 CPU=0.0001 SubtreeCost=0.00892644 AvgRowSize=111) (actual Rows=1000 Executions=1 Elapsedms=4 CPUms=4)\\n                    Node Id: 3  Mode: Row\\n                    I/O: EndOfScans=1\\n                    Output List: Expr1006\\n                    Defined Values: Expr1006 = [bench-azure-sql-slot-c9ebddf4-2c1c-4905-b506-057e151d5c61].[exo_temp_715656af_4deb_4d5a_8a9e_1c02d41110ee].[norm_email]([crm].[email] as [a].[email])\\n                    ->  Clustered Index Scan [PK__crm__3213E83F794317F4] on crm a  (est Rows=1000 RowsRead=1000 IO=0.00756944 CPU=0.001257 SubtreeCost=0.00882644 AvgRowSize=29) (actual Rows=1000 RowsRead=1000 Executions=1 Elapsedms=0 CPUms=0)\\n                          Node Id: 4  Mode: Row  Table Cardinality: 1000  Storage: RowStore\\n                          I/O: Scans=1 LogicalReads=9 EndOfScans=1\\n                          Output List: a.email\\n                          Defined Values: a.email\\n              ->  Compute Scalar  (est Rows=1000 IO=0 CPU=0.0001 SubtreeCost=0.00892644 AvgRowSize=111) (actual Rows=1000 Executions=1 Elapsedms=4 CPUms=4)\\n                    Node Id: 5  Mode: Row\\n                    I/O: EndOfScans=1\\n                    Output List: Expr1005\\n                    Defined Values: Expr1005 = [bench-azure-sql-slot-c9ebddf4-2c1c-4905-b506-057e151d5c61].[exo_temp_715656af_4deb_4d5a_8a9e_1c02d41110ee].[norm_email]([billing].[email] as [b].[email])\\n                    ->  Clustered Index Scan [PK__billing__3213E83F25F89130] on billing b  (est Rows=1000 RowsRead=1000 IO=0.00756944 CPU=0.001257 SubtreeCost=0.00882644 AvgRowSize=32) (actual Rows=1000 RowsRead=1000 Executions=1 Elapsedms=0 CPUms=0)\\n                          Node Id: 6  Mode: Row  Table Cardinality: 1000  Storage: RowStore\\n                          I/O: Scans=1 LogicalReads=9 EndOfScans=1\\n                          Output List: b.email\\n                          Defined Values: b.email\\nStatement: SELECT, optimization FULL (early abort: GoodEnoughPlanFound), CE model 170\\nQuery Plan Hash: 0x137FD1738E0C6551\\nDegree Of Parallelism: 0  Non-Parallel Reason: TSQLUserDefinedFunctionsNotParallelizable\\nMemory Grant: Granted=1728kB MaxUsed=656kB Required=1024kB Desired=1728kB Requested=1728kB GrantWaitTime=0ms Feedback: No: First Execution\\nCompile: Time=14ms CPU=7ms Memory=408kB CachedPlanSize=48kB\\nCPU Time: 9 ms\\nExecution Time: 9 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]},{\"kind\":\"simple_row_set\",\"scalePoint\":{\"M\":2000},\"output\":\"matched\\n2000\",\"runtimeDurationMs\":46,\"rowsAreCapped\":false,\"computeSeconds\":0.49,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0.220867 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1007],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0012005 SubtreeCost=0.220867 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=18 CPUms=18)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1007\\n        Defined Values: Expr1007 = Count(*)\\n        ->  Hash Match (Inner Join)  (est Rows=2000 IO=0 CPU=0.189781 SubtreeCost=0.219667 AvgRowSize=9) (actual Rows=2000 Executions=1 Elapsedms=18 CPUms=18)\\n              Node Id: 2  Mode: Row\\n              Hash Keys Build: Expr1006\\n              Hash Keys Probe: Expr1005\\n              Probe Residual: [Expr1006]=[Expr1005]\\n              Memory Fractions: Input=1 Output=1\\n              I/O: EndOfScans=1\\n              Memory Grant: Input=1408kB Output=1408kB Used=704kB\\n              ->  Compute Scalar  (est Rows=2000 IO=0 CPU=0.0002 SubtreeCost=0.0145709 AvgRowSize=111) (actual Rows=2000 Executions=1 Elapsedms=8 CPUms=8)\\n                    Node Id: 3  Mode: Row\\n                    I/O: EndOfScans=1\\n                    Output List: Expr1006\\n                    Defined Values: Expr1006 = [bench-azure-sql-slot-c9ebddf4-2c1c-4905-b506-057e151d5c61].[exo_temp_50dcf924_a4a4_4da3_a4d8_f36d1a6fa914].[norm_email]([crm].[email] as [a].[email])\\n                    ->  Clustered Index Scan [PK__crm__3213E83FB303119C] on crm a  (est Rows=2000 RowsRead=2000 IO=0.0120139 CPU=0.002357 SubtreeCost=0.0143709 AvgRowSize=30) (actual Rows=2000 RowsRead=2000 Executions=1 Elapsedms=0 CPUms=0)\\n                          Node Id: 4  Mode: Row  Table Cardinality: 2000  Storage: RowStore\\n                          I/O: Scans=1 LogicalReads=15 EndOfScans=1\\n                          Output List: a.email\\n                          Defined Values: a.email\\n              ->  Compute Scalar  (est Rows=2000 IO=0 CPU=0.0002 SubtreeCost=0.0153116 AvgRowSize=111) (actual Rows=2000 Executions=1 Elapsedms=8 CPUms=8)\\n                    Node Id: 5  Mode: Row\\n                    I/O: EndOfScans=1\\n                    Output List: Expr1005\\n                    Defined Values: Expr1005 = [bench-azure-sql-slot-c9ebddf4-2c1c-4905-b506-057e151d5c61].[exo_temp_50dcf924_a4a4_4da3_a4d8_f36d1a6fa914].[norm_email]([billing].[email] as [b].[email])\\n                    ->  Clustered Index Scan [PK__billing__3213E83FE77EE913] on billing b  (est Rows=2000 RowsRead=2000 IO=0.0127546 CPU=0.002357 SubtreeCost=0.0151116 AvgRowSize=33) (actual Rows=2000 RowsRead=2000 Executions=1 Elapsedms=0 CPUms=0)\\n                          Node Id: 6  Mode: Row  Table Cardinality: 2000  Storage: RowStore\\n                          I/O: Scans=1 LogicalReads=16 EndOfScans=1\\n                          Output List: b.email\\n                          Defined Values: b.email\\nStatement: SELECT, optimization FULL (early abort: GoodEnoughPlanFound), CE model 170\\nQuery Plan Hash: 0x76776104E0D7614C\\nDegree Of Parallelism: 0  Non-Parallel Reason: TSQLUserDefinedFunctionsNotParallelizable\\nMemory Grant: Granted=1408kB MaxUsed=704kB Required=1024kB Desired=1408kB Requested=1408kB GrantWaitTime=0ms Feedback: No: First Execution\\nCompile: Time=16ms CPU=9ms Memory=400kB CachedPlanSize=48kB\\nCPU Time: 18 ms\\nExecution Time: 18 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]}],\"workerId\":\"6d22db2d-6d88-422b-97cb-048e64e7cbd9\",\"correlationId\":\"6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "SQL Server (Azure SQL Database) joining the two email lists on a norm_email() UDF with WITH INLINE = OFF, on both sides of the =: 500 to 2,000 rows a side.",
      "planCaptions": {
        "500": "At 500 rows a side SQL Server computes norm_email once per row in a Compute Scalar on each side and joins the results in a Hash Match. The plan is serial because of the UDF and takes 4 ms.",
        "1K": "At 1,000 rows a side SQL Server runs the same Hash Match on the function's results, 1,000 matches, one thread, 9 ms.",
        "2K": "At 2,000 rows a side SQL Server takes 18 ms: with the function computed once per row before the join, the time doubles with the rows even without inlining."
      }
    },
    "ssEqualityInlined": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "SQLSERVER",
        "schemaTemplate": "CREATE TABLE crm (id INT PRIMARY KEY, email VARCHAR(200) NOT NULL);\nCREATE TABLE billing (id INT PRIMARY KEY, email VARCHAR(200) NOT NULL);\nINSERT INTO crm (id, email) SELECT gs.value, CONCAT('user', gs.value, '@example.com') FROM GENERATE_SERIES(1, ${M}) gs;\nINSERT INTO billing (id, email) SELECT gs.value, CONCAT('  USER', gs.value, '@Example.COM ') FROM GENERATE_SERIES(1, ${M}) gs;\nUPDATE STATISTICS crm; UPDATE STATISTICS billing;\nCREATE FUNCTION norm_email(@e VARCHAR(200)) RETURNS VARCHAR(200) AS\nBEGIN\n    RETURN LOWER(TRIM(@e));\nEND;",
        "scalePoints": [
          {
            "M": 500
          },
          {
            "M": 1000
          },
          {
            "M": 2000
          }
        ],
        "query": "SELECT COUNT(*) AS matched FROM crm a JOIN billing b ON ${SCHEMA}.norm_email(a.email) = ${SCHEMA}.norm_email(b.email)",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:31:12.252207603Z\",\"databaseType\":\"sqlserver\",\"sql\":\"SELECT COUNT(*) AS matched FROM crm a JOIN billing b ON ${SCHEMA}.norm_email(a.email) = ${SCHEMA}.norm_email(b.email)\",\"warmCacheIterations\":0,\"compression\":\"low\",\"seed\":1870352128,\"seedSource\":\"default\",\"scalePointCount\":3,\"totalComputeSeconds\":1.494,\"results\":[{\"kind\":\"simple_row_set\",\"scalePoint\":{\"M\":500},\"output\":\"matched\\n500\",\"runtimeDurationMs\":26,\"rowsAreCapped\":false,\"computeSeconds\":0.504,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0.0732698 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1007],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0003005 SubtreeCost=0.0732698 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=0 CPUms=0)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1007\\n        Defined Values: Expr1007 = Count(*)\\n        ->  Hash Match (Inner Join)  (est Rows=500 IO=0 CPU=0.0607579 SubtreeCost=0.0729693 AvgRowSize=9) (actual Rows=500 Executions=1 Elapsedms=0 CPUms=0)\\n              Node Id: 2  Mode: Row\\n              Hash Keys Build: Expr1003\\n              Hash Keys Probe: Expr1004\\n              Probe Residual: [Expr1003]=[Expr1004]\\n              Memory Fractions: Input=1 Output=1\\n              I/O: EndOfScans=1\\n              Memory Grant: Input=1376kB Output=1376kB Used=640kB\\n              ->  Compute Scalar  (est Rows=500 IO=0 CPU=0.00005 SubtreeCost=0.00610422 AvgRowSize=111)\\n                    Node Id: 3  Mode: Row\\n                    Output List: Expr1003\\n                    Defined Values: Expr1003 = CONVERT_IMPLICIT(varchar(200),lower(Trim([crm].[email] as [a].[email])),0)\\n                    ->  Clustered Index Scan [PK__crm__3213E83F172839E8] on crm a  (est Rows=500 RowsRead=500 IO=0.00534722 CPU=0.000707 SubtreeCost=0.00605422 AvgRowSize=29) (actual Rows=500 RowsRead=500 Executions=1 Elapsedms=0 CPUms=0)\\n                          Node Id: 4  Mode: Row  Table Cardinality: 500  Storage: RowStore\\n                          I/O: Scans=1 LogicalReads=6 EndOfScans=1\\n                          Output List: a.email\\n                          Defined Values: a.email\\n              ->  Compute Scalar  (est Rows=500 IO=0 CPU=0.00005 SubtreeCost=0.00610422 AvgRowSize=111)\\n                    Node Id: 5  Mode: Row\\n                    Output List: Expr1004\\n                    Defined Values: Expr1004 = CONVERT_IMPLICIT(varchar(200),lower(Trim([billing].[email] as [b].[email])),0)\\n                    ->  Clustered Index Scan [PK__billing__3213E83F34AE5A95] on billing b  (est Rows=500 RowsRead=500 IO=0.00534722 CPU=0.000707 SubtreeCost=0.00605422 AvgRowSize=32) (actual Rows=500 RowsRead=500 Executions=1 Elapsedms=0 CPUms=0)\\n                          Node Id: 6  Mode: Row  Table Cardinality: 500  Storage: RowStore\\n                          I/O: Scans=1 LogicalReads=6 EndOfScans=1\\n                          Output List: b.email\\n                          Defined Values: b.email\\nStatement: SELECT, optimization FULL (early abort: GoodEnoughPlanFound), CE model 170\\nQuery Plan Hash: 0x37103A04CBE259EA\\nDegree Of Parallelism: 1\\nMemory Grant: Granted=1376kB MaxUsed=640kB Required=1024kB Desired=1376kB Requested=1376kB GrantWaitTime=0ms Feedback: No: First Execution\\nCompile: Time=14ms CPU=6ms Memory=456kB CachedPlanSize=48kB\\nextra: 1\\nCPU Time: 1 ms\\nExecution Time: 1 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]},{\"kind\":\"simple_row_set\",\"scalePoint\":{\"M\":1000},\"output\":\"matched\\n1000\",\"runtimeDurationMs\":29,\"rowsAreCapped\":false,\"computeSeconds\":0.482,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0.122222 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1007],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0006005 SubtreeCost=0.122222 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=1 CPUms=1)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1007\\n        Defined Values: Expr1007 = Count(*)\\n        ->  Hash Match (Inner Join)  (est Rows=1000 IO=0 CPU=0.103766 SubtreeCost=0.121622 AvgRowSize=9) (actual Rows=1000 Executions=1 Elapsedms=1 CPUms=1)\\n              Node Id: 2  Mode: Row\\n              Hash Keys Build: Expr1003\\n              Hash Keys Probe: Expr1004\\n              Probe Residual: [Expr1003]=[Expr1004]\\n              Memory Fractions: Input=1 Output=1\\n              I/O: EndOfScans=1\\n              Memory Grant: Input=1728kB Output=1728kB Used=656kB\\n              ->  Compute Scalar  (est Rows=1000 IO=0 CPU=0.0001 SubtreeCost=0.00892644 AvgRowSize=111)\\n                    Node Id: 3  Mode: Row\\n                    Output List: Expr1003\\n                    Defined Values: Expr1003 = CONVERT_IMPLICIT(varchar(200),lower(Trim([crm].[email] as [a].[email])),0)\\n                    ->  Clustered Index Scan [PK__crm__3213E83F9A74C39E] on crm a  (est Rows=1000 RowsRead=1000 IO=0.00756944 CPU=0.001257 SubtreeCost=0.00882644 AvgRowSize=29) (actual Rows=1000 RowsRead=1000 Executions=1 Elapsedms=0 CPUms=0)\\n                          Node Id: 4  Mode: Row  Table Cardinality: 1000  Storage: RowStore\\n                          I/O: Scans=1 LogicalReads=9 EndOfScans=1\\n                          Output List: a.email\\n                          Defined Values: a.email\\n              ->  Compute Scalar  (est Rows=1000 IO=0 CPU=0.0001 SubtreeCost=0.00892644 AvgRowSize=111)\\n                    Node Id: 5  Mode: Row\\n                    Output List: Expr1004\\n                    Defined Values: Expr1004 = CONVERT_IMPLICIT(varchar(200),lower(Trim([billing].[email] as [b].[email])),0)\\n                    ->  Clustered Index Scan [PK__billing__3213E83F84413443] on billing b  (est Rows=1000 RowsRead=1000 IO=0.00756944 CPU=0.001257 SubtreeCost=0.00882644 AvgRowSize=32) (actual Rows=1000 RowsRead=1000 Executions=1 Elapsedms=0 CPUms=0)\\n                          Node Id: 6  Mode: Row  Table Cardinality: 1000  Storage: RowStore\\n                          I/O: Scans=1 LogicalReads=9 EndOfScans=1\\n                          Output List: b.email\\n                          Defined Values: b.email\\nStatement: SELECT, optimization FULL (early abort: GoodEnoughPlanFound), CE model 170\\nQuery Plan Hash: 0xBAADBE3ADC4C58DA\\nDegree Of Parallelism: 1\\nMemory Grant: Granted=1728kB MaxUsed=656kB Required=1024kB Desired=1728kB Requested=1728kB GrantWaitTime=0ms Feedback: No: First Execution\\nCompile: Time=17ms CPU=7ms Memory=456kB CachedPlanSize=48kB\\nextra: 1\\nCPU Time: 1 ms\\nExecution Time: 1 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]},{\"kind\":\"simple_row_set\",\"scalePoint\":{\"M\":2000},\"output\":\"matched\\n2000\",\"runtimeDurationMs\":31,\"rowsAreCapped\":false,\"computeSeconds\":0.508,\"additions\":[{\"type\":\"result\",\"kind\":\"sqlserver_plan\",\"output\":\"Compute Scalar  (est Rows=1 IO=0 CPU=0 SubtreeCost=0.220867 AvgRowSize=11)\\n  Node Id: 0  Mode: Row\\n  Output List: Expr1002\\n  Defined Values: Expr1002 = CONVERT_IMPLICIT(int,[Expr1007],0)\\n  ->  Stream Aggregate (Aggregate)  (est Rows=1 IO=0 CPU=0.0012005 SubtreeCost=0.220867 AvgRowSize=11) (actual Rows=1 Executions=1 Elapsedms=3 CPUms=3)\\n        Node Id: 1  Mode: Row\\n        I/O: EndOfScans=1\\n        Output List: Expr1007\\n        Defined Values: Expr1007 = Count(*)\\n        ->  Hash Match (Inner Join)  (est Rows=2000 IO=0 CPU=0.189781 SubtreeCost=0.219667 AvgRowSize=9) (actual Rows=2000 Executions=1 Elapsedms=3 CPUms=3)\\n              Node Id: 2  Mode: Row\\n              Hash Keys Build: Expr1003\\n              Hash Keys Probe: Expr1004\\n              Probe Residual: [Expr1003]=[Expr1004]\\n              Memory Fractions: Input=1 Output=1\\n              I/O: EndOfScans=1\\n              Memory Grant: Input=1408kB Output=1408kB Used=704kB\\n              ->  Compute Scalar  (est Rows=2000 IO=0 CPU=0.0002 SubtreeCost=0.0145709 AvgRowSize=111)\\n                    Node Id: 3  Mode: Row\\n                    Output List: Expr1003\\n                    Defined Values: Expr1003 = CONVERT_IMPLICIT(varchar(200),lower(Trim([crm].[email] as [a].[email])),0)\\n                    ->  Clustered Index Scan [PK__crm__3213E83FFE4F90E0] on crm a  (est Rows=2000 RowsRead=2000 IO=0.0120139 CPU=0.002357 SubtreeCost=0.0143709 AvgRowSize=30) (actual Rows=2000 RowsRead=2000 Executions=1 Elapsedms=0 CPUms=0)\\n                          Node Id: 4  Mode: Row  Table Cardinality: 2000  Storage: RowStore\\n                          I/O: Scans=1 LogicalReads=15 EndOfScans=1\\n                          Output List: a.email\\n                          Defined Values: a.email\\n              ->  Compute Scalar  (est Rows=2000 IO=0 CPU=0.0002 SubtreeCost=0.0153116 AvgRowSize=111)\\n                    Node Id: 5  Mode: Row\\n                    Output List: Expr1004\\n                    Defined Values: Expr1004 = CONVERT_IMPLICIT(varchar(200),lower(Trim([billing].[email] as [b].[email])),0)\\n                    ->  Clustered Index Scan [PK__billing__3213E83F642B0A6F] on billing b  (est Rows=2000 RowsRead=2000 IO=0.0127546 CPU=0.002357 SubtreeCost=0.0151116 AvgRowSize=33) (actual Rows=2000 RowsRead=2000 Executions=1 Elapsedms=0 CPUms=0)\\n                          Node Id: 6  Mode: Row  Table Cardinality: 2000  Storage: RowStore\\n                          I/O: Scans=1 LogicalReads=16 EndOfScans=1\\n                          Output List: b.email\\n                          Defined Values: b.email\\nStatement: SELECT, optimization FULL (early abort: GoodEnoughPlanFound), CE model 170\\nQuery Plan Hash: 0xB93F29584762EE0A\\nDegree Of Parallelism: 1\\nMemory Grant: Granted=1408kB MaxUsed=704kB Required=1024kB Desired=1408kB Requested=1408kB GrantWaitTime=0ms Feedback: No: First Execution\\nCompile: Time=16ms CPU=9ms Memory=448kB CachedPlanSize=48kB\\nextra: 1\\nCPU Time: 3 ms\\nExecution Time: 3 ms\",\"hasHeader\":false,\"rowsAreCapped\":false}]}],\"workerId\":\"2dcb7fc2-d7e6-41b5-abe8-4f79d0b1fd21\",\"correlationId\":\"6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "SQL Server (Azure SQL Database) joining on the same norm_email() inlined, the default here: 500 to 2,000 rows a side.",
      "planCaptions": {
        "500": "At 500 rows a side SQL Server has inlined the function to lower(Trim(email)) in a Compute Scalar on each side, and a Hash Match joins the results in 1 ms.",
        "1K": "At 1,000 rows a side SQL Server runs the same Hash Match on the inlined expression, on one thread, and the plan still reports 1 ms.",
        "2K": "At 2,000 rows a side SQL Server's hash join on the inlined lower(Trim(email)) takes 3 ms, still on one thread."
      }
    },
    "mysqlEquality": {
      "type": "mcp-call",
      "name": "benchmarkSql",
      "input": {
        "databaseType": "MYSQL",
        "schemaTemplate": "SET SESSION cte_max_recursion_depth = 4294967295;\nCREATE TABLE crm (id INT PRIMARY KEY, email VARCHAR(200) NOT NULL);\nCREATE TABLE billing (id INT PRIMARY KEY, email VARCHAR(200) NOT NULL);\nINSERT INTO crm (id, email) WITH RECURSIVE s(i) AS (SELECT 1 UNION ALL SELECT i + 1 FROM s WHERE i < ${M}) SELECT i, CONCAT('user', i, '@example.com') FROM s;\nINSERT INTO billing (id, email) WITH RECURSIVE s(i) AS (SELECT 1 UNION ALL SELECT i + 1 FROM s WHERE i < ${M}) SELECT i, CONCAT('  USER', i, '@Example.COM ') FROM s;\nCREATE FUNCTION norm_email(e VARCHAR(200)) RETURNS VARCHAR(200) NO SQL RETURN LOWER(TRIM(e));\nANALYZE TABLE crm, billing;",
        "scalePoints": [
          {
            "M": 500
          },
          {
            "M": 1000
          },
          {
            "M": 2000
          }
        ],
        "query": "EXPLAIN ANALYZE SELECT COUNT(*) AS matched FROM crm a JOIN billing b ON norm_email(a.email) = norm_email(b.email)",
        "exobenchServerVersion": "1.4.27",
        "correlationId": "6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b"
      },
      "result": "{\"timestamp\":\"2026-11-19T21:31:14.973612774Z\",\"databaseType\":\"mysql\",\"sql\":\"EXPLAIN ANALYZE SELECT COUNT(*) AS matched FROM crm a JOIN billing b ON norm_email(a.email) = norm_email(b.email)\",\"warmCacheIterations\":0,\"seed\":1870352128,\"seedSource\":\"default\",\"seedNote\":\"MySQL has no session-level random seed (RAND(N) is per statement); the seed was recorded but RAND() was not seeded.\",\"scalePointCount\":3,\"totalComputeSeconds\":0.763,\"results\":[{\"kind\":\"mysql_explain_analyze\",\"scalePoint\":{\"M\":500},\"output\":\"EXPLAIN\\n-> Aggregate: count(0)  (cost=50053 rows=1) (actual time=5.1..5.11 rows=1 loops=1)\\n    -> Filter: (norm_email(a.email) = norm_email(b.email))  (cost=25053 rows=250000) (actual time=1.97..5.07 rows=500 loops=1)\\n        -> Inner hash join (<hash>(norm_email(a.email))=<hash>(norm_email(b.email)))  (cost=25053 rows=250000) (actual time=1.96..3.12 rows=500 loops=1)\\n            -> Table scan on b  (cost=0.104 rows=500) (actual time=0.0174..0.115 rows=500 loops=1)\\n            -> Hash\\n                -> Table scan on a  (cost=50.8 rows=500) (actual time=0.0365..0.148 rows=500 loops=1)\\n\",\"runtimeDurationMs\":7,\"rowsAreCapped\":false,\"computeSeconds\":0.239},{\"kind\":\"mysql_explain_analyze\",\"scalePoint\":{\"M\":1000},\"output\":\"EXPLAIN\\n-> Aggregate: count(0)  (cost=200106 rows=1) (actual time=8.38..8.38 rows=1 loops=1)\\n    -> Filter: (norm_email(a.email) = norm_email(b.email))  (cost=100106 rows=1e+6) (actual time=2.28..8.31 rows=1000 loops=1)\\n        -> Inner hash join (<hash>(norm_email(a.email))=<hash>(norm_email(b.email)))  (cost=100106 rows=1e+6) (actual time=2.28..4.49 rows=1000 loops=1)\\n            -> Table scan on b  (cost=0.105 rows=1000) (actual time=0.0114..0.198 rows=1000 loops=1)\\n            -> Hash\\n                -> Table scan on a  (cost=101 rows=1000) (actual time=0.014..0.198 rows=1000 loops=1)\\n\",\"runtimeDurationMs\":11,\"rowsAreCapped\":false,\"computeSeconds\":0.243},{\"kind\":\"mysql_explain_analyze\",\"scalePoint\":{\"M\":2000},\"output\":\"EXPLAIN\\n-> Aggregate: count(0)  (cost=800216 rows=1) (actual time=17..17 rows=1 loops=1)\\n    -> Filter: (norm_email(a.email) = norm_email(b.email))  (cost=400216 rows=4e+6) (actual time=4.49..16.9 rows=2000 loops=1)\\n        -> Inner hash join (<hash>(norm_email(a.email))=<hash>(norm_email(b.email)))  (cost=400216 rows=4e+6) (actual time=4.48..9.08 rows=2000 loops=1)\\n            -> Table scan on b  (cost=0.107 rows=2000) (actual time=0.0123..0.406 rows=2000 loops=1)\\n            -> Hash\\n                -> Table scan on a  (cost=202 rows=2000) (actual time=0.0144..0.405 rows=2000 loops=1)\\n\",\"runtimeDurationMs\":19,\"rowsAreCapped\":false,\"computeSeconds\":0.281}],\"workerId\":\"70169c48-9156-4089-8686-93749eabb234\",\"correlationId\":\"6bb44447-01a9-4a0f-a7ff-5ed1bd180c1b\",\"correlationIdInstruction\":\"Echo correlationId on subsequent ExoBench tool calls. Tracking only — it does NOT preserve DB state.\",\"version\":\"1.4.27\"}",
      "isError": false,
      "caption": "MySQL 8.0.39 (Aurora 3.08.0) joining the two email lists on a stored function norm_email(), NOT DETERMINISTIC by default, on both sides of the =. 500 to 2,000 rows a side, times from the plan's root line.",
      "planCaptions": {
        "500": "At 500 rows a side MySQL hash-joins on the stored function's results and checks the equality again in a Filter above the join. The root line reports 5.11 ms.",
        "1K": "At 1,000 rows a side MySQL runs the same Inner hash join with the Filter on top, 1,000 matches, and the root line reports 8.38 ms.",
        "2K": "At 2,000 rows a side MySQL's root line reports 17 ms: NOT DETERMINISTIC didn't stop it from hashing on the function's results."
      }
    }
  }
}
