supabase-postgres-best-practices
最佳化 Supabase Postgres 效能
查詢緩慢與結構漂移會讓 Postgres 應用程式難以擴展。此技能為 AI 代理提供以 Supabase 為基礎的索引、RLS、連線池與診斷規則。
使用我的智慧代理安裝
將此請求複製給你的智慧代理,其中包含權威 Skill 頁面和清單。
Review the Skillstore skill "supabase-postgres-best-practices" from https://skillstore.io/skills/supabase-supabase-postgres-best-practices.md and its manifest at https://skillstore.io/api/skills/supabase-supabase-postgres-best-practices/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.你的智慧代理仍應顯示其計畫,並依安全政策請求必要確認。
Agent 可讀資源
當 AI Agent、爬蟲或腳本需要乾淨脈絡、而不是讀取完整頁面時,請使用這些連結。
測試它
正在使用「supabase-postgres-best-practices」。 查詢會在持續成長的 orders 資料表上依 customer、status 與 creation date 篩選 orders。
預期結果:
- 建議使用複合索引,並將等值欄位放在範圍欄位之前。
- 說明在常用 status 篩選條件下,何時部分索引會更好。
- 建議在推出前使用 EXPLAIN ANALYZE 確認索引使用情況。
正在使用「supabase-postgres-best-practices」。 Supabase 應用程式在大型租戶資料表上使用帶有 auth 檢查的 RLS 政策。
預期結果:
- 包裝穩定的 auth 函式,讓規劃器可以只評估一次。
- 為租戶或使用者篩選所使用的政策欄位建立索引。
- 將複雜的成員資格檢查移至經審查的 security definer 函式中。
正在使用「supabase-postgres-best-practices」。 serverless API 在流量尖峰期間開啟許多直接 Postgres 連線。
預期結果:
- 針對應用程式流量使用 Supabase 連線池。
- 設定保守的連線限制與閒置逾時。
- 使用交易連線池時,檢查 prepared statement 設定。
安全審計
安全All static findings were adjudicated as false positives. The flagged content consists of SQL examples, markdown formatting, public documentation links, and contributor instructions; no prompt injection, data exfiltration, or unauthorized command execution was found.
風險因素
⚡ 包含腳本 (4)
🌐 網路存取 (6)
分享與引用此報告
分享版本化評估報告、中性徽章、嵌入卡片與引用。Skillstore 只報告證據,不判斷該 Skill 是否安全。
複製報告連結
https://skillstore.io/skills/supabase-supabase-postgres-best-practices/audits/4?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportMarkdown 徽章
[](https://skillstore.io/skills/supabase-supabase-postgres-best-practices?utm_source=security_passport_badge)HTML 徽章
<a href="https://skillstore.io/skills/supabase-supabase-postgres-best-practices?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/supabase-supabase-postgres-best-practices/security.svg" alt="Skillstore security assessment" loading="lazy"></a>嵌入卡片
<iframe src="https://skillstore.io/embed/skills/supabase-supabase-postgres-best-practices.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>學術引用 (APA · BibTeX · CFF)
APA 引用
supabase. (2026). supabase-postgres-best-practices security audit report (audit version 4) [Author version 1.0.0]. Skillstore. https://skillstore.io/skills/supabase-supabase-postgres-best-practices/audits/4BibTeX 引用
@techreport{supabase-supabase-supabase-postgres-best-practices-2026,
author = {supabase},
title = {supabase-postgres-best-practices security audit report (audit version 4)},
institution = {Skillstore},
year = {2026},
number = {4},
url = {https://skillstore.io/skills/supabase-supabase-postgres-best-practices/audits/4},
note = {Author version 1.0.0}
}CITATION.cff
cff-version: 1.2.0
message: "If you use this Skill, cite its author and this versioned security audit report."
title: "supabase-postgres-best-practices security audit report (audit version 4)"
version: "1.0.0"
type: report
authors:
- name: "supabase"
date-released: "2026-07-07"
url: "https://skillstore.io/skills/supabase-supabase-postgres-best-practices/audits/4"
identifiers:
- type: other
value: "skillstore:supabase-supabase-postgres-best-practices:audit:4"
description: "Skillstore immutable audit report identifier"
比較變體
2 個可安裝變體每位作者的技能都保留為獨立的可安裝項目。推薦變體依 Skillstore 證據排序。
為何此變體排名第一
Skillstore 評分
評分依據 證據置信度: 高你可以打造什麼
審查慢查詢
分析查詢模式,並選擇符合 Postgres 行為的索引、分頁或批次處理變更。
規劃 Supabase 擴展
在流量或 serverless 負載增加前,審查連線池、閒置逾時與連線限制。
改善租戶隔離
設計能強制執行存取規則,同時避免昂貴逐列檢查的 RLS 政策。
試試這些提示
審查此 Postgres 查詢是否有常見的 Supabase 效能問題。建議索引、查詢變更與驗證步驟。
根據這些資料表與常用篩選條件,建議 B-tree、GIN、BRIN、複合、部分或覆蓋索引。說明取捨。
審查這些 Supabase RLS 政策的租戶隔離與效能。找出缺少的索引與昂貴的政策運算式。
建立一份按優先順序排列的 Postgres 最佳化計畫,涵蓋查詢、結構設計、連線池、鎖定、資料存取模式與診斷。
最佳實務
- 從實際工作負載開始,然後使用 EXPLAIN ANALYZE 或正式環境指標驗證每項變更。
- 在資料表變大前,為外鍵、RLS 篩選欄位與常見多欄位查詢模式建立索引。
- 保持交易簡短,並使用符合應用程式並行需求的連線池設定。
避免
- 未對應實際查詢模式,就為每個欄位新增單欄索引。
- 依賴僅在應用程式層執行的租戶篩選,而不是資料庫強制執行的 RLS。
- 在大型結果集上使用 OFFSET 分頁或 N+1 查詢迴圈。
常見問題
此技能會連接到我的資料庫嗎?
它可以自動建立遷移嗎?
它是 Supabase 專用的嗎?
它能協助改善 RLS 效能嗎?
它能取代資料庫監控嗎?
哪些 AI 工具可以使用它?
開發者詳細資訊
作者
supabase授權
MIT
作者版本
v1.0.0
Skillstore 修訂
r1
引用
f93e9bb0daca99badb6a7e574b97737155d57cb3
維護新鮮度
2026/7/18
使用量
14 次下載 · 260 次瀏覽