Skip to content

@odatano/nightgate 0.25.4

Choose a tag to compare

@maxalexweber1 maxalexweber1 released this 23 Sep 18:31
· 77 commits to main since this release
c258ead

@odatano/nightgate 0.25.4

Ordered reads on PostgreSQL use their indexes again. No schema change, no
migration, no config change, no new index.

  • @cap-js/postgres renders every ORDER BY term as ASC NULLS FIRST /
    DESC NULLS LAST. A Postgres btree index has the opposite null order, so
    the planner sorted the whole table for every ORDER BY ... LIMIT.
  • CAP orders every $top read by the entity key: Blocks?$top=1 was a
    seq scan + sort over 2M rows, 0.8 to 7.6 s on the hosted box;
    Blocks/latest() 0.9 s although ng_blocks_height exists.
  • New srv/utils/pg-order-nulls.ts: wraps the driver's _orderBy once at
    start and drops the NULLS clause for key and not null columns. Nullable
    columns and an explicit nulls keep it.
  • Installed from src/index.ts before ensureIndexes when the db kind is
    postgres. Missing driver or hook: one warning, nothing changes.
  • test/unit/pg-order-nulls.test.ts renders through the real driver, so a
    driver that changes its ordering terms fails the test.

Full Changelog: v0.25.3...v0.25.4