Skip to content

Fast paths for annotated schemas - #1

Merged
DavidWilliamBalbino merged 1 commit into
mainfrom
perf/count-direct-hotpath
Nov 19, 2026
Merged

DavidWilliamBalbino merged 1 commit into
mainfrom
perf/count-direct-hotpath

Conversation

@DavidWilliamBalbino

Copy link
Copy Markdown
Contributor

Chave primária de uma coluna como string no schema compilado (ativa os caminhos compilados), COUNT(*) sem join/group/distinct, INSERT/UPDATE único sem BEGIN/COMMIT, fetchOne/wherePK com statement em cache. Corrige: statement em cache congelava o valor de scope; JTI hidratava a classe errada. No bench do Nimbus: show 32,7k→40,0k, paginação 14,0k→20,4k req/s.

…cached fetchOne

- Schema stores a one-column primary key compiled as a list as a string, so the
  compiled row makers and the direct insert/update paths apply to annotated entities.
- Select::count() uses COUNT(*) when the query has no join, grouping, DISTINCT or set
  operation (no sort/hash of the primary keys).
- A direct unit of work with a single statement outside a transaction runs in autocommit,
  without BEGIN and COMMIT; an insert with nothing to write takes the generic path.
- wherePK() with one scalar key records a plain where, and fetchOne() runs the cached
  statement of the shape when there is one.
- Row makers inline the datetime caster.
- Shape plans skip scoped roles (a cached statement kept the first scope values) and row
  makers skip joined-table inheritance bases.
@DavidWilliamBalbino
DavidWilliamBalbino merged commit 964328f into main Nov 19, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant