Token导航 LogoToken导航TokenDH.com
研究检索需要联网clawhub未标认证来源可访问clear审计通过

pgPG 搜索

Agent Skill

pg 用于查找、检索和筛选相关信息,适合在 OpenClaw 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

89,106

周安装

3,676

GitHub Stars

4

下载量

29,114
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:pg(PG 搜索)
来源仓库:https://github.com/ivangdavila/pg
安装命令:
openclaw skills install pg
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install pg

简介

pg 用于查找、检索和筛选相关信息,适合在 OpenClaw 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。

  • 适用于编写高效 PostgreSQL 查询和设计数据库模式的场景。
  • 通过 openclaw skills install pg 安装,需结合原始 README 确认具体用法。
  • 安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。
  • 可参考来源仓库 https://github.com/ivangdavila/pg 获取更多细节。

SKILL.md

name
PostgreSQL
description
Write efficient PostgreSQL queries and design schemas with proper indexing and patterns.
metadata
{"clawdbot":{"emoji":"🐘","requires":{"anyBins":["psql","pgcli"]},"os":["linux","darwin","win32"]}}

Indexes I Forget to Create

  • Partial index WHERE active = true—80% smaller when most rows inactive; suggest for status columns
  • Expression index ON lower(email)—must match query exactly; without it, WHERE lower(email) scans
  • Covering index INCLUDE (name, email)—enables index-only scan; check EXPLAIN for "Heap Fetches"
  • Foreign key columns—not auto-indexed in PG; JOINs and ON DELETE CASCADE need them
  • Composite index order matters—(a, b) helps WHERE a = ? but not WHERE b = ?

Index Traps

  • Unused indexes hurt every INSERT/UPDATE—query pg_stat_user_indexes for idx_scan = 0, drop them
  • Too many indexes on write-heavy tables—balance carefully
  • Index on low-cardinality column (boolean, status) often useless—PG prefers seq scan
  • LIKE '%suffix' can't use B-tree—need pg_trgm GIN index or reverse() expression index

Query Patterns I Underuse

  • SELECT FOR UPDATE SKIP LOCKED—job queue without external tools; skip rows being processed
  • pg_advisory_lock(key)—application-level mutex without table; unlock explicitly or on disconnect
  • IS NOT DISTINCT FROM—NULL-safe equality; cleaner than (a = b OR (a IS NULL AND b IS NULL))
  • DISTINCT ON (x) ORDER BY x, y—first row per group without subquery; PG-specific but powerful

Connection Management (Often Ignored)

  • PgBouncer essential with >50 connections—each PG connection uses ~10MB; pool at transaction level
  • statement_timeout = '30s' per role—prevents runaway queries from killing database
  • idle_in_transaction_session_timeout = '5min'—kills abandoned transactions holding locks
  • Default 100 max_connections too low for production, too high wastes memory—tune based on RAM

Data Types I Get Wrong

  • SERIAL deprecated—use GENERATED ALWAYS AS IDENTITY
  • TIMESTAMP without timezone—almost always wrong; use TIMESTAMPTZ, PG stores as UTC
  • Float for money—use NUMERIC(12,2) or integer cents; float math breaks: 0.1 + 0.2 ≠ 0.3
  • VARCHAR(n) vs TEXT—no performance difference in PG; use TEXT unless constraint needed

Vacuum & Bloat (Never Think About)

  • High-UPDATE tables bloat—dead tuples accumulate; pg_repack reclaims without locks
  • VACUUM ANALYZE after bulk insert—updates statistics; query planner needs current data
  • Autovacuum lag on big tables—tune autovacuum_vacuum_cost_delay or manual vacuum
  • Transaction wraparound: if xid exhausted, DB stops—autovacuum prevents but monitor

EXPLAIN I Don't Read Right

  • Always EXPLAIN (ANALYZE, BUFFERS)—actual times + I/O; estimate-only misleads
  • "Heap Fetches: 1000" with index—missing columns, add INCLUDE to index
  • Seq scan not always bad—faster than index for >10-20% of table; check row estimates
  • "Rows" estimate way off—run ANALYZE or check if stats target too low

Full-Text Search Mistakes

  • Creating tsvector on the fly—precompute as stored generated column with GIN index
  • plainto_tsquery for user input—handles spaces without syntax errors; not to_tsquery
  • Missing language parameter—'english' stems words; 'simple' exact match
  • FTS is word-based—LIKE '%exact phrase%' still needed for substring match

Transaction Isolation

  • Default READ COMMITTED—phantom reads in reports; use REPEATABLE READ for consistency
  • SERIALIZABLE catches conflicts—but must handle 40001 error with retry loop
  • Long transactions block vacuum and hold locks—keep under seconds, not minutes

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

72.17%
按下载量换算21,012

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

未展示

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills