• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Kinto / kinto / 22151083528
100%
master: 100%

Build:
Build:
LAST BUILD BRANCH: main
DEFAULT BRANCH: master
Ran 18 Feb 2026 05:54PM UTC
Jobs 3
Files 78
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

18 Feb 2026 05:48PM UTC coverage: 100.0%. Remained the same
22151083528

push

github

web-flow
Enable index range scans for last_modified queries (100x speedup in some cases) (#3645)

* Enable index range scans for last_modified queries

Kinto has an excellent composite index (parent_id, resource_name,
last_modified DESC) that can satisfy filtered listings, pagination, and
sorting from a single B-tree scan. However, last_modified is wrapped in
as_epoch() in WHERE and ORDER BY clauses, which prevents PostgreSQL from
using this index for range scans and sort elimination.

Since as_epoch and from_epoch are exact inverses for all timestamps
stored in the table, we can move the conversion from the column side to
the value side. Instead of `as_epoch(column) >= value`, we generate
`column >= from_epoch(value)`. The bound parameter remains an integer;
from_epoch() is applied server-side.

What changed:
- _format_conditions: For modified_field scalar comparisons, generate
  last_modified <op> from_epoch(:value) instead of as_epoch(last_modified)
  <op> :value. IN/EXCLUDE operators (if ever used on last_modified) retain
  existing behavior as a safe fallback.
- resource_timestamp: ORDER BY uses last_modified DESC instead of
  as_epoch(last_modified) DESC
- purge_deleted: last_modified < from_epoch(:before) instead of
  as_epoch(last_modified) < :before
- Schema migration 25→26: Updated bump_timestamp() trigger function with
  ORDER BY last_modified DESC

Implementation note: We wrap the parameter placeholder in from_epoch()
rather than wrapping the column in as_epoch(), preserving output format
while restoring index usage.

Performance impact:
- Every paginated listing (pagination generates last_modified < X filters)
- Every resource_timestamp call (runs on every list response for ETag header)
- Every write operation (the trigger fires on every INSERT and UPDATE)
- Every purge_deleted call with a before parameter

The trigger fix alone is a major win for write-heavy workloads. Going from
"scan all rows for this parent_id+resource_name, evaluate as_epoch ... (continued)

1526 of 1526 branches covered (100.0%)

26 of 26 new or added lines in 2 files covered. (100.0%)

7814 of 7814 relevant lines covered (100.0%)

4.0 hits per line

Jobs
ID Job ID Ran Files Coverage
1 py311 - 22151083528.1 18 Feb 2026 05:55PM UTC 78
100.0
GitHub Action Run
2 py312 - 22151083528.2 18 Feb 2026 05:55PM UTC 156
100.0
GitHub Action Run
3 py310 - 22151083528.3 18 Feb 2026 05:55PM UTC 78
100.0
GitHub Action Run
Source Files on build 22151083528
  • Tree
  • List 78
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • ab037604 on github
  • Prev Build on main (#22132280979)
  • Next Build on main (#22176846050)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc