pg.ddx.io  pgdogdev/pgdog GitHub issues and pull requests  
help / color / mirror / Atom feed
[pgdogdev/pgdog] PR #2066: fix: support cross-shard subqueries that only return constants (e.g., Rails .limit(N).count)
6+ messages / 3 participants
[nested] [flat]

* [pgdogdev/pgdog] PR #2066: fix: support cross-shard subqueries that only return constants (e.g., Rails .limit(N).count)
@ 2026-11-18 19:36 "jkaczman (@jkaczman)" <noreply+jkaczman@github.com>
  0 siblings, 0 replies; 6+ messages in thread

From: jkaczman (@jkaczman) @ 2026-11-18 19:36 UTC (permalink / raw)
  To: pgdogdev/pgdog <noreply+pgdogdev-pgdog@github.com>

When we re-write a cross-shard subquery (#381) into a new `SELECT` statement to replace the subquery with:
- we keep constants as-is
- we re-write columns as `unnest(..)` arrays (#2003)

However, there was a previous assumption of there always being a column returned; we didn't have a way to handle only constants. If no columns were returned, the subquery would be rewritten as `unnest()` with no args (which Postgres errors on, returning `unnest()` does not exist error)

Thus, this PR implements functionality to properly handle subqueries that only return constants. 

Why is this important / common? When calling `.limit(N).count` with Rails, Rails sends a subquery that returns the constant `1` for each row that it matches (no columns in SELECT list) ([Rails source](https://github.com/rails/rails/blob/v7.1.4/activerecord/lib/active_record/relation/calculations.rb#L...)). E.g., for `FollowRequest.where(..).limit(40).count`, Rails sends

> `SELECT COUNT(*) FROM (SELECT 1 AS one FROM follow_requests WHERE target_account_id = $1 LIMIT $2) subquery_for_count`

Now, as a bit of a workaround, we send an array with a NULL for each row that the subquery returned. E.g., if the subquery returns 3 rows, we send `{NULL,NULL,NULL}`, so `unnest(..)` returns 3 rows, and, thus, COUNT(*) correctly returns 3.

> `SELECT count(*) FROM (SELECT 1 FROM unnest($1::pg_catalog._int4) u(c1)) subquery_for_count(one)`

This is motivated by Mastodon (written in Ruby on Rails). When a user logs in, Mastodon counts the pending follow requests sent to the user with `FollowRequest.where(..).limit(40).count` ([Mastodon source](https://github.com/mastodon/mastodon/blob/v4.3.0/app/serializers/rest/credential_account_serializer....)).


inline patch 1: integration/rust/tests/integration/subqueries/tests/select.sql, pgdog/src/frontend/client/query_engine/multi_step/subquery/clause/from_clause.rs (+41/-0 lines) download inline-1.patchdiff --git a/integration/rust/tests/integration/subqueries/tests/select.sql b/integration/rust/tests/integration/subqueries/tests/select.sql index 084658f80..75a9d5487 100644 --- a/integration/rust/tests/integration/subqueries/tests/select.sql +++ b/integration/rust/tests/integration/subqueries/tests/select.sql @@ -215,6 +215,29 @@ SELECT * FROM ( -- sql: SELECT * FROM (SELECT u.c1, ($2::pg_catalog._varchar)[u.c2 + 1:u.c2 + u.c3] FROM unnest($1::pg_catalog._int8, $3::pg_catalog._int4, $4::pg_catalog._int4) u(c1, c2, c3)) s(id, tags) ORDER BY id SELECT * FROM (SELECT id, tags FROM subusers) s ORDER BY id; +-- case +-- what: SELECT COUNT(*) FROM (<sq>) s, <sq> only returns constants +-- used by: Rails, which counts at most N rows for .limit(N).count (e.g., FollowRequest.where(..).limit(40).count) with +-- SELECT COUNT(*) FROM (SELECT 1 AS one FROM .. LIMIT N) subquery_for_count +-- - https://github.com/rails/rails/blob/v7.1.4/activerecord/lib/active_record/relation/calculations.rb#L... +-- - https://github.com/rails/rails/blob/v7.1.4/activerecord/lib/active_record/relation/calculations.rb#L... +-- used by: Mastodon, which counts the pending follow requests sent to accounts when the accounts log in with FollowRequest.where(target_account: ..).limit(40).count +-- - https://github.com/mastodon/mastodon/blob/v4.3.0/app/serializers/rest/credential_account_serializer.... +-- route select: 0,1 +-- route select: any +-- sql: SELECT count(*) FROM (SELECT 1 FROM unnest($1::pg_catalog._int4) u(c1)) subquery_for_count(one) +SELECT COUNT(*) FROM (SELECT 1 AS one FROM subusers WHERE status = 'VIP' LIMIT 40) subquery_for_count; + +-- case +-- what: SELECT COUNT(*) FROM (<sq>) s, <sq> only returns constants & returns zero rows +-- used by: Mastodon, which counts the pending follow requests sent to accounts when the accounts log in +-- For accounts without pending follow requests (most accounts), the derived table (SELECT 1 AS one FROM follow_requests WHERE target_account_id = .. LIMIT 40) doesn't return any rows +-- - https://github.com/mastodon/mastodon/blob/v4.3.0/app/serializers/rest/credential_account_serializer.... +-- route select: 0,1 +-- route select: any +-- sql: SELECT count(*) FROM (SELECT 1 FROM unnest($1::pg_catalog._int4) u(c1)) subquery_for_count(one) WHERE false +SELECT COUNT(*) FROM (SELECT 1 AS one FROM subusers WHERE status = 'nobody' LIMIT 40) subquery_for_count; + -- case -- what: Derived table with an inner-table that returns an empty response. -- Want to make sure that the OIDs returned are correct (if present) diff --git a/pgdog/src/frontend/client/query_engine/multi_step/subquery/clause/from_clause.rs b/pgdog/src/frontend/client/query_engine/multi_step/subquery/clause/from_clause.rs index 7279ab6f9..b932efb09 100644 --- a/pgdog/src/frontend/client/query_engine/multi_step/subquery/clause/from_clause.rs +++ b/pgdog/src/frontend/client/query_engine/multi_step/subquery/clause/from_clause.rs @@ -269,6 +269,24 @@ impl<'a> SubqueryMulti<'a> { )); } + // If the subquery only returns constants, we don't have any columns to send, however unnest() needs at least one argument + // E.g., to count at most 40 rows (.limit(40).count), Rails sends SELECT COUNT(*) FROM (SELECT 1 AS one FROM users WHERE .. LIMIT 40) subquery_for_count, where the subquery returns the constant 1 for each row that it matches (up to 40) + // + // To solve this, we send an array with a NULL per row that the subquery returned to ensure that unnest(..) returns as many rows as the subquery + // E.g., if the subquery returns 3 rows, we send {NULL,NULL,NULL}, and SELECT 1 FROM unnest($1::pg_catalog._int4) u(c1), which + // returns the same exact response: 1 for each of the 3 rows + if param_refs.is_empty() { + param_refs.push(push_unnest_argument( + mem, + old_bind, + INT4_OID, + "_int4", + std::iter::repeat_n(None, data_rows.len()), + )); + + unnest_column_names.push(mem.make_string(Some("c1")).uncast()); + } + let list_of_param_refs = mem.make_list(param_refs.as_slice()); let unnest_func_call = mem.make_func_call( mem.make_list(&[mem.make_string(Some("unnest")).uncast()]),
^ permalink raw [nested|flat] 6+ messages in thread

* Re: [pgdogdev/pgdog] PR #2066: fix: support cross-shard subqueries that only return constants (e.g., Rails .limit(N).count)
@ 2026-11-18 20:10 ` "codecov[bot] (bot) (@codecov[bot])" <noreply+codecov[bot]@github.com>
  4 siblings, 0 replies; 6+ messages in thread

From: codecov[bot] (bot) (@codecov[bot]) @ 2026-11-18 20:10 UTC (permalink / raw)
  To: pgdogdev/pgdog <noreply+pgdogdev-pgdog@github.com>

## [Codecov](https://app.codecov.io/gh/pgdogdev/pgdog/pull/2066?dropdown=coverage&src=pr&el=h1&utm_me...) Report
:white_check_mark: All modified and coverable lines are covered by tests.

:loudspeaker: Thoughts on this report? [Let us know!](https://github.com/codecov/feedback/issues/255)

^ permalink  raw  [nested|flat] 6+ messages in thread

* Re: [pgdogdev/pgdog] PR #2066: fix: support cross-shard subqueries that only return constants (e.g., Rails .limit(N).count)
@ 2026-11-18 20:49 ` "github-actions[bot] (bot) (@github-actions[bot])" <noreply+github-actions[bot]@github.com>
  4 siblings, 0 replies; 6+ messages in thread

From: github-actions[bot] (bot) (@github-actions[bot]) @ 2026-11-18 20:49 UTC (permalink / raw)
  To: pgdogdev/pgdog <noreply+pgdogdev-pgdog@github.com>

<!-- metal-bench -->

**Metal bench (arm64) failed.** 1 of 520 measures outside bounds.

| suite | throughput | cpu/txn | user cycles/txn | user instr/txn | kernel cycles/txn | kernel instr/txn | ctx/txn |
|---|---|---|---|---|---|---|---|
| pooler |  | 19.06 (+1.0% ± 1.2%) | 17,900 (+0.3% ± 0.5%) | 31,453 (-0.0% ± 0.05%) | 30,867 (+1.3% ± 2.2%) | 51,015 (-0.3% ± 0.4%) |  |
| lb |  | 19.54 (+0.4% ± 1.7%) | 18,469 (-0.1% ± 0.9%) | 32,358 (-0.0% ± 0.05%) | 31,314 (+0.8% ± 2.8%) | 52,155 (-0.1% ± 0.4%) |  |
| sharding-w2 |  | 32.7 (-0.0% ± 2.2%) | 43,733 (-0.4% ± 0.4%) | 94,979 (+0.0% ± 0.07%) | 41,085 (+0.2% ± 5.6%) | 53,656 (-0.0% ± 0.10%) | 1.546 (-0.0% ± 0.4%) |
| sharding-w8 | 247,189 (-0.2% ± 2.0%) | 28.78 (+0.1% ± 2.2%) | 43,721 (+0.1% ± 1.6%) | 50,527 (+0.0% ± 0.03%) | 35,721 (+0.1% ± 3.1%) | 42,394 (+0.0% ± 0.06%) | 0.1733 (+0.2% ± 4.2%) |

<details><summary>Counters per txn</summary>

| suite | frontend stall | l1i refill | backend stall |
|---|---|---|---|
| pooler | 7,615 (+1.1% ± 1.6%) | 2,659 (+0.3% ± 0.8%) |  |
| lb | 7,965 (+0.1% ± 2.3%) | 2,706 (-0.0% ± 0.9%) |  |
| sharding-w2 | 18,086 (-1.1% ± 0.9%) | 4,154 (-0.3% ± 0.8%) |  |
| sharding-w8 | 18,839 (-1.5% ± 7.6%) | 3,929 (-1.0% ± 4.2%) |  |
</details>

| benchmark | measure | result | baseline | change | bound |
|---|---|---|---|---|---|
| full_named_cached::having_distinct_limit | alloc_count | 535 | 526 | **+1.75% ± 0.94%** | +0% |

Microbench: 506 of 507 measures within bounds.

<details><summary>Hot code per txn</summary>

| path | base | head | change |
|---|---|---|---|
| pooler | 114.6 KB | 113.8 KB | **-0.8 KB** |
| sharding-w2 | 169.7 KB | 168.4 KB | **-1.2 KB** |

pooler:

| crate | base | head | change |
|---|---|---|---|
| pgdog::frontend::client::query_engine | 20.4 KB | 20.4 KB | +0.0 KB |
| tokio | 18.4 KB | 18.5 KB | +0.1 KB |
| pgdog::backend::pool | 17.8 KB | 17.5 KB | -0.3 KB |
| aws-lc (TLS crypto) | 10.2 KB | 10.1 KB | -0.1 KB |
| rustls (TLS) | 8.4 KB | 8.4 KB | +0.0 KB |
| pgdog::frontend (other) | 8.0 KB | 7.8 KB | -0.2 KB |
| pgdog::backend::server | 7.8 KB | 7.8 KB | +0.0 KB |
| other | 6.0 KB | 5.9 KB | -0.1 KB |
| everything else | 17.6 KB | 17.4 KB | -0.1 KB |

| function | head | change |
|---|---|---|
| `pgdog::frontend::client::Client::run::{{closure}}` | 5.6 KB | -0.1 KB |
| `pgdog::frontend::client::query_engine::query::<impl pgdog::frontend::client::query_engine:` | 5.3 KB | -0.1 KB |
| `pgdog::frontend::client::query_engine::QueryEngine::handle::{{closure}}` | 4.4 KB | +0.2 KB |
| `pgdog::frontend::client::query_engine::query::<impl pgdog::frontend::client::query_engine:` | 3.4 KB | -0.1 KB |
| `tokio::runtime::task::raw::poll` | 3.2 KB | +0.0 KB |

sharding-w2:

| crate | base | head | change |
|---|---|---|---|
| pgdog::frontend::router | 29.4 KB | 29.2 KB | -0.2 KB |
| pgdog::frontend::client::query_engine | 21.8 KB | 21.6 KB | -0.2 KB |
| tokio | 19.0 KB | 18.4 KB | -0.6 KB |
| pgdog::backend::pool | 18.2 KB | 18.1 KB | -0.1 KB |
| aws-lc (TLS crypto) | 13.0 KB | 13.2 KB | +0.2 KB |
| other | 10.3 KB | 10.4 KB | +0.1 KB |
| pgdog::frontend (other) | 8.6 KB | 8.8 KB | +0.2 KB |
| pgdog::backend::server | 8.2 KB | 8.1 KB | -0.1 KB |
| everything else | 41.1 KB | 40.6 KB | -0.5 KB |

| function | head | change |
|---|---|---|
| `pgdog::frontend::client::Client::run::{{closure}}` | 6.2 KB | +0.1 KB |
| `pgdog::frontend::client::query_engine::query::<impl pgdog::frontend::client::query_engine:` | 5.2 KB | -0.1 KB |
| `pgdog::frontend::client::query_engine::QueryEngine::handle::{{closure}}` | 4.1 KB | -0.1 KB |
| `pgdog::frontend::router::parser::query::select::<impl pgdog::frontend::router::parser::que` | 3.8 KB | -0.1 KB |
| `pgdog::frontend::client::query_engine::query::<impl pgdog::frontend::client::query_engine:` | 3.2 KB | +0.0 KB |

</details>

<details><summary>lb flamegraph vs 6b0e24d7</summary>

![lb](https://pgdog-metal-bench.s3.amazonaws.com/results/jk-rails-limit-count-const-return-fix/521afa7e484...)

[Open interactive](https://pgdog-metal-bench.s3.amazonaws.com/results/jk-rails-limit-count-const-return-fix/521afa7e484...) for hover, zoom and search.

![lb removed](https://pgdog-metal-bench.s3.amazonaws.com/results/jk-rails-limit-count-const-return-fix/521afa7e484...)

[Open interactive](https://pgdog-metal-bench.s3.amazonaws.com/results/jk-rails-limit-count-const-return-fix/521afa7e484...).
</details>
<details><summary>microbench flamegraph vs 6b0e24d7</summary>

![microbench](https://pgdog-metal-bench.s3.amazonaws.com/results/jk-rails-limit-count-const-return-fix/521afa7e484...)

[Open interactive](https://pgdog-metal-bench.s3.amazonaws.com/results/jk-rails-limit-count-const-return-fix/521afa7e484...) for hover, zoom and search.

![microbench removed](https://pgdog-metal-bench.s3.amazonaws.com/results/jk-rails-limit-count-const-return-fix/521afa7e484...)

[Open interactive](https://pgdog-metal-bench.s3.amazonaws.com/results/jk-rails-limit-count-const-return-fix/521afa7e484...).
</details>
<details><summary>pooler flamegraph vs 6b0e24d7</summary>

![pooler](https://pgdog-metal-bench.s3.amazonaws.com/results/jk-rails-limit-count-const-return-fix/521afa7e484...)

[Open interactive](https://pgdog-metal-bench.s3.amazonaws.com/results/jk-rails-limit-count-const-return-fix/521afa7e484...) for hover, zoom and search.

![pooler removed](https://pgdog-metal-bench.s3.amazonaws.com/results/jk-rails-limit-count-const-return-fix/521afa7e484...)

[Open interactive](https://pgdog-metal-bench.s3.amazonaws.com/results/jk-rails-limit-count-const-return-fix/521afa7e484...).
</details>
<details><summary>sharding-w2 flamegraph vs 6b0e24d7</summary>

![sharding-w2](https://pgdog-metal-bench.s3.amazonaws.com/results/jk-rails-limit-count-const-return-fix/521afa7e484...)

[Open interactive](https://pgdog-metal-bench.s3.amazonaws.com/results/jk-rails-limit-count-const-return-fix/521afa7e484...) for hover, zoom and search.

![sharding-w2 removed](https://pgdog-metal-bench.s3.amazonaws.com/results/jk-rails-limit-count-const-return-fix/521afa7e484...)

[Open interactive](https://pgdog-metal-bench.s3.amazonaws.com/results/jk-rails-limit-count-const-return-fix/521afa7e484...).
</details>
<details><summary>sharding-w8 flamegraph vs 6b0e24d7</summary>

![sharding-w8](https://pgdog-metal-bench.s3.amazonaws.com/results/jk-rails-limit-count-const-return-fix/521afa7e484...)

[Open interactive](https://pgdog-metal-bench.s3.amazonaws.com/results/jk-rails-limit-count-const-return-fix/521afa7e484...) for hover, zoom and search.

![sharding-w8 removed](https://pgdog-metal-bench.s3.amazonaws.com/results/jk-rails-limit-count-const-return-fix/521afa7e484...)

[Open interactive](https://pgdog-metal-bench.s3.amazonaws.com/results/jk-rails-limit-count-const-return-fix/521afa7e484...).
</details>

<details><summary>Logs</summary>

[lb](https://s3.console.aws.amazon.com/s3/object/pgdog-metal-bench?prefix=results/jk-rails-limit-count-co...), [microbench](https://s3.console.aws.amazon.com/s3/object/pgdog-metal-bench?prefix=results/jk-rails-limit-count-co...), [pooler](https://s3.console.aws.amazon.com/s3/object/pgdog-metal-bench?prefix=results/jk-rails-limit-count-co...), [sharding-w2](https://s3.console.aws.amazon.com/s3/object/pgdog-metal-bench?prefix=results/jk-rails-limit-count-co...), [sharding-w8](https://s3.console.aws.amazon.com/s3/object/pgdog-metal-bench?prefix=results/jk-rails-limit-count-co...), [verdict.json](https://s3.console.aws.amazon.com/s3/object/pgdog-metal-bench?prefix=results/jk-rails-limit-count-co...)
</details>

Compared 521afa7e with 6b0e24d7 on m8g.metal-24xl (spot).


^ permalink  raw  [nested|flat] 6+ messages in thread

* Re: [pgdogdev/pgdog] PR #2066: fix: support cross-shard subqueries that only return constants (e.g., Rails .limit(N).count)
@ 2026-11-18 22:36 ` "github-actions[bot] (bot) (@github-actions[bot])" <noreply+github-actions[bot]@github.com>
  4 siblings, 0 replies; 6+ messages in thread

From: github-actions[bot] (bot) (@github-actions[bot]) @ 2026-11-18 22:36 UTC (permalink / raw)
  To: pgdogdev/pgdog <noreply+pgdogdev-pgdog@github.com>

<!-- metal-bench-x86 -->

**Metal bench (x86) passed.** All 520 measures within bounds.

| suite | throughput | cpu/txn | user cycles/txn | user instr/txn | kernel cycles/txn | kernel instr/txn | ctx/txn |
|---|---|---|---|---|---|---|---|
| pooler |  | 25.87 (-0.1% ± 0.6%) | 18,652 (+0.1% ± 0.1%) | 32,813 (-0.0% ± 0.03%) | 33,700 (-0.2% ± 0.9%) | 36,499 (+0.1% ± 0.4%) |  |
| lb |  | 26.29 (+0.1% ± 0.5%) | 19,244 (+0.1% ± 0.1%) | 33,785 (-0.0% ± 0.02%) | 33,842 (+0.1% ± 0.9%) | 37,259 (+0.3% ± 0.7%) |  |
| sharding-w2 |  | 42.09 (+0.2% ± 0.8%) | 46,958 (+0.5% ± 1.2%) | 98,726 (+0.0% ± 0.01%) | 38,627 (+0.0% ± 2.3%) | 40,172 (+0.0% ± 0.4%) | 1.525 (+0.0% ± 0.3%) |
| sharding-w8 | 207,093 (+0.2% ± 0.8%) | 32.9 (-0.0% ± 0.4%) | 46,035 (-0.1% ± 0.7%) | 53,053 (-0.0% ± 0.03%) | 31,164 (+0.0% ± 0.7%) | 32,487 (-0.0% ± 0.07%) | 0.1715 (-0.3% ± 1.1%) |

<details><summary>Counters per txn</summary>

| suite | frontend stall | l1i refill | backend stall |
|---|---|---|---|
| pooler | 3,301 (+0.3% ± 0.7%) | 1,102 (+0.1% ± 0.4%) | 39,155 (+0.0% ± 0.3%) |
| lb | 3,564 (-0.1% ± 0.7%) | 1,153 (-0.3% ± 0.7%) | 39,416 (+0.4% ± 0.6%) |
| sharding-w2 | 6,528 (+0.5% ± 0.9%) | 1,588 (+0.3% ± 0.7%) | 112,098 (+0.9% ± 2.2%) |
| sharding-w8 | 3,404 (-0.1% ± 1.7%) | 865 (-0.1% ± 1.0%) | 177,764 (-0.0% ± 0.7%) |
</details>

Microbench: all 507 measures within bounds.

<details><summary>Microbench latency: 1 benches changed more than 3%</summary>

| benchmark | latency | baseline | change | instructions change |
|---|---|---|---|---|
| simple_cold::aggregate | 8,785 ns | 9,061 ns | -3.04% ± 0.38% | +0.00% ± 0.00% |
</details>

<details><summary>Hot code per txn</summary>

| path | base | head | change |
|---|---|---|---|
| pooler | 115.4 KB | 116.1 KB | **+0.7 KB** |
| sharding-w2 | 169.2 KB | 168.8 KB | **-0.5 KB** |

pooler:

| crate | base | head | change |
|---|---|---|---|
| pgdog::frontend::client::query_engine | 22.8 KB | 23.0 KB | +0.2 KB |
| tokio | 18.4 KB | 18.6 KB | +0.2 KB |
| pgdog::backend::pool | 18.1 KB | 18.1 KB | -0.1 KB |
| pgdog::frontend (other) | 9.8 KB | 9.6 KB | -0.1 KB |
| aws-lc (TLS crypto) | 8.8 KB | 8.9 KB | +0.1 KB |
| pgdog::backend::server | 7.9 KB | 8.2 KB | +0.3 KB |
| rustls (TLS) | 7.9 KB | 7.9 KB | +0.0 KB |
| other | 5.9 KB | 5.8 KB | -0.1 KB |
| everything else | 15.8 KB | 15.9 KB | +0.2 KB |

| function | head | change |
|---|---|---|
| `pgdog::frontend::client::Client::run::{{closure}}` | 7.3 KB | -0.2 KB |
| `pgdog::frontend::client::query_engine::query::<impl pgdog::frontend::client::query_engine:` | 6.4 KB | +0.0 KB |
| `pgdog::frontend::client::query_engine::QueryEngine::handle::{{closure}}` | 5.2 KB | +0.1 KB |
| `pgdog::frontend::client::query_engine::query::<impl pgdog::frontend::client::query_engine:` | 3.9 KB | +0.0 KB |
| `tokio::runtime::task::raw::poll` | 3.8 KB | +0.1 KB |

sharding-w2:

| crate | base | head | change |
|---|---|---|---|
| pgdog::frontend::router | 28.4 KB | 28.1 KB | -0.4 KB |
| pgdog::frontend::client::query_engine | 23.8 KB | 23.8 KB | +0.0 KB |
| pgdog::backend::pool | 18.9 KB | 18.3 KB | -0.6 KB |
| tokio | 18.8 KB | 18.1 KB | -0.7 KB |
| pgdog::frontend (other) | 10.9 KB | 11.1 KB | +0.1 KB |
| aws-lc (TLS crypto) | 10.2 KB | 10.4 KB | +0.2 KB |
| other | 10.1 KB | 10.3 KB | +0.2 KB |
| pgdog::backend::server | 8.4 KB | 8.8 KB | +0.4 KB |
| everything else | 39.7 KB | 39.8 KB | +0.1 KB |

| function | head | change |
|---|---|---|
| `pgdog::frontend::client::Client::run::{{closure}}` | 8.4 KB | +0.1 KB |
| `pgdog::frontend::client::query_engine::query::<impl pgdog::frontend::client::query_engine:` | 6.3 KB | +0.1 KB |
| `pgdog::frontend::client::query_engine::QueryEngine::handle::{{closure}}` | 4.8 KB | +0.0 KB |
| `pgdog::frontend::router::parser::query::select::<impl pgdog::frontend::router::parser::que` | 4.6 KB | -0.1 KB |
| `pgdog::frontend::client::query_engine::query::<impl pgdog::frontend::client::query_engine:` | 3.9 KB | +0.1 KB |

</details>

<details><summary>lb flamegraph vs 6b0e24d7</summary>

![lb](https://pgdog-metal-bench.s3.amazonaws.com/results-x86/jk-rails-limit-count-const-return-fix/521afa7...)

[Open interactive](https://pgdog-metal-bench.s3.amazonaws.com/results-x86/jk-rails-limit-count-const-return-fix/521afa7...) for hover, zoom and search.

![lb removed](https://pgdog-metal-bench.s3.amazonaws.com/results-x86/jk-rails-limit-count-const-return-fix/521afa7...)

[Open interactive](https://pgdog-metal-bench.s3.amazonaws.com/results-x86/jk-rails-limit-count-const-return-fix/521afa7...).
</details>
<details><summary>microbench flamegraph vs 6b0e24d7</summary>

![microbench](https://pgdog-metal-bench.s3.amazonaws.com/results-x86/jk-rails-limit-count-const-return-fix/521afa7...)

[Open interactive](https://pgdog-metal-bench.s3.amazonaws.com/results-x86/jk-rails-limit-count-const-return-fix/521afa7...) for hover, zoom and search.

![microbench removed](https://pgdog-metal-bench.s3.amazonaws.com/results-x86/jk-rails-limit-count-const-return-fix/521afa7...)

[Open interactive](https://pgdog-metal-bench.s3.amazonaws.com/results-x86/jk-rails-limit-count-const-return-fix/521afa7...).
</details>
<details><summary>pooler flamegraph vs 6b0e24d7</summary>

![pooler](https://pgdog-metal-bench.s3.amazonaws.com/results-x86/jk-rails-limit-count-const-return-fix/521afa7...)

[Open interactive](https://pgdog-metal-bench.s3.amazonaws.com/results-x86/jk-rails-limit-count-const-return-fix/521afa7...) for hover, zoom and search.

![pooler removed](https://pgdog-metal-bench.s3.amazonaws.com/results-x86/jk-rails-limit-count-const-return-fix/521afa7...)

[Open interactive](https://pgdog-metal-bench.s3.amazonaws.com/results-x86/jk-rails-limit-count-const-return-fix/521afa7...).
</details>
<details><summary>sharding-w2 flamegraph vs 6b0e24d7</summary>

![sharding-w2](https://pgdog-metal-bench.s3.amazonaws.com/results-x86/jk-rails-limit-count-const-return-fix/521afa7...)

[Open interactive](https://pgdog-metal-bench.s3.amazonaws.com/results-x86/jk-rails-limit-count-const-return-fix/521afa7...) for hover, zoom and search.

![sharding-w2 removed](https://pgdog-metal-bench.s3.amazonaws.com/results-x86/jk-rails-limit-count-const-return-fix/521afa7...)

[Open interactive](https://pgdog-metal-bench.s3.amazonaws.com/results-x86/jk-rails-limit-count-const-return-fix/521afa7...).
</details>
<details><summary>sharding-w8 flamegraph vs 6b0e24d7</summary>

![sharding-w8](https://pgdog-metal-bench.s3.amazonaws.com/results-x86/jk-rails-limit-count-const-return-fix/521afa7...)

[Open interactive](https://pgdog-metal-bench.s3.amazonaws.com/results-x86/jk-rails-limit-count-const-return-fix/521afa7...) for hover, zoom and search.

![sharding-w8 removed](https://pgdog-metal-bench.s3.amazonaws.com/results-x86/jk-rails-limit-count-const-return-fix/521afa7...)

[Open interactive](https://pgdog-metal-bench.s3.amazonaws.com/results-x86/jk-rails-limit-count-const-return-fix/521afa7...).
</details>

<details><summary>Logs</summary>

[lb](https://s3.console.aws.amazon.com/s3/object/pgdog-metal-bench?prefix=results-x86/jk-rails-limit-coun...), [microbench](https://s3.console.aws.amazon.com/s3/object/pgdog-metal-bench?prefix=results-x86/jk-rails-limit-coun...), [pooler](https://s3.console.aws.amazon.com/s3/object/pgdog-metal-bench?prefix=results-x86/jk-rails-limit-coun...), [sharding-w2](https://s3.console.aws.amazon.com/s3/object/pgdog-metal-bench?prefix=results-x86/jk-rails-limit-coun...), [sharding-w8](https://s3.console.aws.amazon.com/s3/object/pgdog-metal-bench?prefix=results-x86/jk-rails-limit-coun...), [verdict.json](https://s3.console.aws.amazon.com/s3/object/pgdog-metal-bench?prefix=results-x86/jk-rails-limit-coun...)
</details>

Compared 521afa7e with 6b0e24d7 on m7i.metal-48xl (spot).


^ permalink  raw  [nested|flat] 6+ messages in thread

* Re: [pgdogdev/pgdog] PR #2066: fix: support cross-shard subqueries that only return constants (e.g., Rails .limit(N).count)
@ 2026-11-19 18:26 ` "jkaczman (@jkaczman)" <noreply+jkaczman@github.com>
  4 siblings, 0 replies; 6+ messages in thread

From: jkaczman (@jkaczman) @ 2026-11-19 18:26 UTC (permalink / raw)
  To: pgdogdev/pgdog <noreply+pgdogdev-pgdog@github.com>

@jkaczman merged this (commit 61e9a90bec54).

^ permalink  raw  [nested|flat] 6+ messages in thread

* Re: [pgdogdev/pgdog] PR #2066: fix: support cross-shard subqueries that only return constants (e.g., Rails .limit(N).count)
@ 2026-11-19 18:26 ` "jkaczman (@jkaczman)" <noreply+jkaczman@github.com>
  4 siblings, 0 replies; 6+ messages in thread

From: jkaczman (@jkaczman) @ 2026-11-19 18:26 UTC (permalink / raw)
  To: pgdogdev/pgdog <noreply+pgdogdev-pgdog@github.com>

@jkaczman closed this.

^ permalink  raw  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2026-11-19 18:26 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18 19:36 [pgdogdev/pgdog] PR #2066: fix: support cross-shard subqueries that only return constants (e.g., Rails .limit(N).count) "jkaczman (@jkaczman)" <noreply+jkaczman@github.com>
2026-11-18 20:10 ` "codecov[bot] (bot) (@codecov[bot])" <noreply+codecov[bot]@github.com>
2026-11-18 20:49 ` "github-actions[bot] (bot) (@github-actions[bot])" <noreply+github-actions[bot]@github.com>
2026-11-18 22:36 ` "github-actions[bot] (bot) (@github-actions[bot])" <noreply+github-actions[bot]@github.com>
2026-11-19 18:26 ` "jkaczman (@jkaczman)" <noreply+jkaczman@github.com>
2026-11-19 18:26 ` "jkaczman (@jkaczman)" <noreply+jkaczman@github.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox