Harden search cache and add pg_stat_statements/pg_cron support#440
Merged
Conversation
Co-authored-by: Pete Gadomski <pete.gadomski@gmail.com>
Co-authored-by: Pete Gadomski <pete.gadomski@gmail.com>
…ions - Update pgstac-migrate pyproject.toml to require pgpkg>=0.1.1 (includes routine body-change detection) - Regenerate migrations with pgpkg 0.1.1 which correctly includes search/search_query replacements - Suppress unsafe DROP FUNCTION statements for routines that exist in target schema - Fix PGTap test 116 to check column names in alphabetical order (migration adds columns at end) - Update test plan count from 229 to 248 (tests added for GC, context_count, statslastupdated) - Validate migration chain end-to-end with all tests passing - All precommit hooks passing (migrations, pgtap, pypgstac)
- expand pgstac-migrate README with full CLI/API/env var docs and troubleshooting - make psycopg[binary] mandatory in pgstac-migrate and pypgstac - make psycopg-pool mandatory in pypgstac - remove redundant psycopg optional/group wiring and update test script flags - remove pgstac-migrate upper bound in pypgstac dependency - update release workflow paths and uv setup/build step - refresh docs/changelog references for pgpkg>=0.1.1 - regenerate uv lockfiles
…ash-and-dead-code-rerun # Conflicts: # src/pgstac-migrate/pyproject.toml # src/pgstac-migrate/uv.lock
…d-code-rerun # Conflicts: # .github/instructions/scripts.instructions.md # .gitignore # AGENTS.md # CLAUDE.md # src/pgstac/migrations/pgstac--0.9.11--unreleased.sql
gadomski
approved these changes
May 13, 2026
Member
gadomski
left a comment
There was a problem hiding this comment.
Do we need to update the best-practices docs to tell folks to set up a cronjob to clean up searches?
Collaborator
Author
At the end of this series of PRs, there's going to need to be a big clean up of docs including several "cron ready" functions/procedures that I'd rather document all together. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This branch tightens PgSTAC search cache behavior, improves concurrency safety around search stats, and adds first-class support for
pg_stat_statementsandpg_cronin the pgstac Docker image and test flow.What changed
updatestatsflows through cached and uncached search paths and keepsnumberMatched/ context counts current.pg_stat_statementsandpg_cronto the pgstac image, enabled them throughshared_preload_libraries, and initialized them during container bootstrap.scripts/container-scripts/test.Why
The goal of the search-cache work is to reduce collision risk, avoid stale or inconsistent stats under concurrent requests, and make the search implementation easier to maintain by keeping hashing and cache logic in the same SQL module. We also want to be able to clear out the cache for any searches that we don't need to actively be able to look up by name or hash (for example for titler-pgstac integration).
The extension work makes the standard test image closer to the production runtime and gives us direct verification that both extensions are loaded and usable, rather than assuming the container configuration is correct.