postgres-performance
最佳化 PostgreSQL 效能
緩慢的資料庫查詢會損害應用程式的可靠性與擴展能力。此技能提供實用的 PostgreSQL 模式,用於更快的查詢、更安全的遷移,以及更清晰的監控。
使用我的智慧代理安裝
將此請求複製給你的智慧代理,其中包含權威 Skill 頁面和清單。
Review the Skillstore skill "postgres-performance" from https://skillstore.io/skills/cjharmath-postgres-performance.md and its manifest at https://skillstore.io/api/skills/cjharmath-postgres-performance/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.你的智慧代理仍應顯示其計畫,並依安全政策請求必要確認。
Agent 可讀資源
當 AI Agent、爬蟲或腳本需要乾淨脈絡、而不是讀取完整頁面時,請使用這些連結。
測試它
正在使用「postgres-performance」。 查詢依 user 篩選 assessments,並排序最近的資料列。
預期結果:
- 檢查計畫中的 sequential scans 和 sort cost。
- 使用與篩選和排序對齊的複合索引。
- 部署前使用 buffer 和 timing metrics 進行驗證。
正在使用「postgres-performance」。 批次工作更新數百萬筆未處理的 events。
預期結果:
- 以較小批次處理資料列。
- 使用避免阻塞 active workers 的 locking。
- 在批次之間 commit,並在高負載時短暫暫停。
正在使用「postgres-performance」。 大型資料表上的 dashboard count 很慢。
預期結果:
- 使用估算值取得近似計數。
- 為精確且頻繁使用的 metrics 維護 counters。
- 針對複雜彙總考慮 materialized views。
安全審計
安全The flagged external command patterns are markdown code fences and inline backticks in SQL/Python examples, not executable shell usage. The flagged database URLs and reconnaissance patterns are placeholder variables and instructional queries inside examples. No prompt injection or data exfiltration intent was found.
風險因素
⚙️ 外部命令 (32)
🔑 環境變數 (3)
分享與引用此報告
分享版本化評估報告、中性徽章、嵌入卡片與引用。Skillstore 只報告證據,不判斷該 Skill 是否安全。
複製報告連結
https://skillstore.io/skills/cjharmath-postgres-performance/audits/8?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportMarkdown 徽章
[](https://skillstore.io/skills/cjharmath-postgres-performance?utm_source=security_passport_badge)HTML 徽章
<a href="https://skillstore.io/skills/cjharmath-postgres-performance?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/cjharmath-postgres-performance/security.svg" alt="Skillstore security assessment" loading="lazy"></a>嵌入卡片
<iframe src="https://skillstore.io/embed/skills/cjharmath-postgres-performance.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 引用
CJHarmath. (2026). postgres-performance security audit report (audit version 8) [Author version unspecified]. Skillstore. https://skillstore.io/skills/cjharmath-postgres-performance/audits/8BibTeX 引用
@techreport{cjharmath-cjharmath-postgres-performance-2026,
author = {CJHarmath},
title = {postgres-performance security audit report (audit version 8)},
institution = {Skillstore},
year = {2026},
number = {8},
url = {https://skillstore.io/skills/cjharmath-postgres-performance/audits/8},
note = {Author version unspecified}
}CITATION.cff
cff-version: 1.2.0
message: "If you use this Skill, cite its author and this versioned security audit report."
title: "postgres-performance security audit report (audit version 8)"
version: "unspecified"
type: report
authors:
- name: "CJHarmath"
date-released: "2026-07-06"
url: "https://skillstore.io/skills/cjharmath-postgres-performance/audits/8"
identifiers:
- type: other
value: "skillstore:cjharmath-postgres-performance:audit:8"
description: "Skillstore immutable audit report identifier"
Skillstore 評分
評分依據 證據置信度: 高你可以打造什麼
診斷慢查詢
後端工程師可以從慢查詢發現、計畫分析到索引驗證,結構化地進行調查。
規劃可擴展的資料存取
應用程式架構師可以在負載增加前,選擇 pagination、batching、replicas、partitioning 和 caching 模式。
檢視資料庫健康狀態
資料庫管理員可以使用監控檢查清單來發現 bloat、未使用索引和長時間執行的查詢。
試試這些提示
我有一個緩慢的 PostgreSQL 查詢:[paste query]。請幫我分析可能的瓶頸,並建議安全的下一步。
根據這個資料表形狀和工作負載:[details],請為篩選、排序和頻繁讀取提出 PostgreSQL 索引建議。
為這個 feed 設計 cursor pagination:[requirements]。包含 cursor 欄位、排序規則和索引指引。
使用這些 EXPLAIN plans、pg_stat_statements rows 和 schema notes:[data]。依風險、投入與影響排定修復優先順序。
最佳實務
- 變更索引前,先使用真實執行計畫進行量測。
- 當生產環境寫入必須持續時,使用 concurrently 建立索引。
- 使用最佳化前後的延遲資料驗證每項最佳化。
避免
- 在未符合實際查詢篩選和排序的情況下新增索引。
- 在持續成長的資料表上使用大型 OFFSET pagination。
- 在沒有 invalidation plan 的情況下重新整理 cached 或 denormalized data。