Title: perf: cut database transfer for CMS content by 6-7x by ysamcode · Pull Request #675 · ycode/ycode · GitHub
Open Graph Title: perf: cut database transfer for CMS content by 6-7x by ysamcode · Pull Request #675 · ycode/ycode
X Title: perf: cut database transfer for CMS content by 6-7x by ysamcode · Pull Request #675 · ycode/ycode
Description: Summary Every CMS value read (getValuesByItemIds — used by page rendering, dynamic pages, the builder, imports and publishing) fetched rows over the raw Postgres connection, which has no compression. A new SQL function returns the same data as one JSON object through PostgREST, which gzips it in transit. On real data this is 6–7x fewer bytes and faster, with byte-identical results. Follows #673 and #674. Changes Add migration creating get_collection_item_values(item_ids, is_published, field_ids) returning { item_id: { field_id: value } } (executable by service_role only, idempotent) Make getValuesByItemIds call the function via supabase.rpc() first; keep the direct-DB and chunked PostgREST paths as fallbacks Remember when the function is missing (migration not run yet) so later calls skip the failing round-trip until restart Measurements (staging site, 1,842 items) Read Direct DB (before) RPC gzipped (after) All values, all items (41k rows) ~9.8 MB, 4.3 s 1.7 MB, 1.3 s 3 fields, all items (1k rows) ~101 KB 15 KB Output compared equal for every item in all three cases (draft, published, field-filtered). Deployment note Run migrations before or with the deploy. Until the function exists the code falls back to the previous query, so ordering is safe either way. Test plan Run npm run migrate:latest; confirm get_collection_item_values exists Render a page with collection lists and a dynamic page — same content as before Builder CMS table loads items and values; editing/publishing an item works Drop the function locally and confirm pages still render (fallback path, one warning-free miss) npm test passes (328 tests) Made with Cursor
Open Graph Description: Summary Every CMS value read (getValuesByItemIds — used by page rendering, dynamic pages, the builder, imports and publishing) fetched rows over the raw Postgres connection, which has no compressio...
X Description: Summary Every CMS value read (getValuesByItemIds — used by page rendering, dynamic pages, the builder, imports and publishing) fetched rows over the raw Postgres connection, which has no compressio...
Opengraph URL: https://github.com/ycode/ycode/pull/675
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:ec296059-e387-8ca8-bd50-d51a3003ab53 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | CDE2:308F56:234710:2E84CE:6AFE5988 |
| html-safe-nonce | ab0335d6d80404f2a68aff9dc9d4f46e053062d7f649a02b811bb0acc1a59602 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDREUyOjMwOEY1NjoyMzQ3MTA6MkU4NENFOjZBRkU1OTg4IiwidmlzaXRvcl9pZCI6IjE3MjkyNDQ1NzQ5Mzg3MTY1NTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 62c0f9203384b3612197fe8e08ba1fc73ec9ab57cacfe8cd3060c06b04bcb764 |
| hovercard-subject-tag | pull_request:5170273707 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/ycode/ycode/pull/675/files |
| twitter:image | https://avatars.githubusercontent.com/u/7631193?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/7631193?s=400&v=4 |
| og:image:alt | Summary Every CMS value read (getValuesByItemIds — used by page rendering, dynamic pages, the builder, imports and publishing) fetched rows over the raw Postgres connection, which has no compressio... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/ycode/ycode git https://github.com/ycode/ycode.git |
| octolytics-dimension-user_id | 65892203 |
| octolytics-dimension-user_login | ycode |
| octolytics-dimension-repository_id | 1165452593 |
| octolytics-dimension-repository_nwo | ycode/ycode |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1165452593 |
| octolytics-dimension-repository_network_root_nwo | ycode/ycode |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4a10310af51a1bfffbedc4fd81cb582acf0cb0ff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width