Postgres 标志

Postgres

社区
damusix
postgres

面向开发者和 DBA 的 PostgreSQL 综合参考,涵盖 14–18 版本。用户询问 PostgreSQL 语法、DDL/DML/DQL、联接、LATERAL、CTE、窗口函数、GROUPING SETS、DISTINCT ON、RETURNING、ON CONFLICT、PL/pgSQL、函数、过程、触发器、视图、物化视图、索引(B-tree/GIN/GiST/BRIN/Hash/Bloom)、MVCC、VACUUM、autovacuum、WAL、TOAST、分区、复制(流复制/逻辑复制)、备份、PITR、高可用(Patroni/repmgr)、pgBouncer、EXPLAIN ANALYZE、RLS、角色、扩展(pgvector、PostGIS、TimescaleDB、Citus、pg_trgm、pg_cron)、JSON/JSONB、全文搜索、UUID、timestamptz、COPY、系统目录、排序规则、大对象、游标、GUC,或任何 Postgres 管理、性能、安全、复制、备份或恢复主题时,均可使用此技能。

Add to TypingMind

概览

发布者damusix
代码仓库skills
技能名称postgres
星标数
63
复刻数
3
附带文件
102
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 102 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 damusix 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Postgres AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/damusix/skills/tree/main/postgres
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/damusix/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/postgres .claude/skills/postgres
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Postgres,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Postgres。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Postgres 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

PostgreSQL Skill

This skill is the working reference for PostgreSQL 16, 17, and 18 (current baseline: PG16). Cross-version notes go back to PG14 where behavior changed; PG13 and earlier are end-of-life and out of scope. PG14 reaches end-of-life on 2026-11-12 — flag upgrade urgency when a user is on it.

The skill is provider-neutral: bare-metal/self-hosted, containers, and Kubernetes operators are all covered. Managed-service limitations are called out categorically ("most managed providers disable X") without naming or recommending any specific vendor.

Each topic lives in its own reference file under references/. SKILL.md routes a user question to the right reference; the reference contains the executable detail, version admonitions, and primary-source citations.

Usage Workflow

When this skill is loaded, follow these steps to answer the user's question:

  1. Identify the topic. Match the user's question against the Routing Table below using the keyword column. For multi-topic questions (e.g. "the locking behavior of REINDEX CONCURRENTLY") select multiple files.
  2. Load the matched reference file(s). Use the Read tool against references/NN-topic.md. Do not paraphrase from memory — the reference holds the authoritative version notes and source URLs.
  3. Follow See Also. Each reference ends with a See Also section linking related files. Follow it for cross-cutting questions (e.g. a VACUUM question pulls in MVCC, autovacuum, and wraparound).
  4. Answer using the file. Lead with the direct answer or code, then version notes via admonitions, then caveats, then citation URLs.
  5. Never answer from memory alone when a reference file exists for the topic. The references are the source of truth for this skill; the model's training data is not version-specific enough.
  6. Assume PG16 unless told otherwise. If the user does not state a version, answer for PG16 and add a one-line note for differences on PG17/PG18. Only ask the user which version they are on if the answer materially changes across supported versions (e.g. wraparound mechanics, planner statistics behavior, archive_command vs archive_library).

[!NOTE] When a Postgres question does not obviously match a single file, load these cross-cutting entry points first: references/102-skill-cookbook.md (symptom-driven recipes spanning multiple files), references/22-indexes-overview.md (index decision routing), references/56-explain.md (plan reading), references/64-system-catalogs.md (catalog introspection).

User Response Format

Structure every answer using this skill as follows:

  • Lead with the direct answer or pattern. If a SQL snippet or psql command satisfies the question, put that first.
  • Add version admonitions inline. Use > [!NOTE] PostgreSQL 17 for new-in-17 features, > [!WARNING] Removed/Deprecated for things gone (with the version they were removed in and the replacement).
  • Call out managed-service limitations categorically when relevant. Phrase as "most managed providers disable X" — never name a specific provider.
  • End with source links. Cite the official PostgreSQL docs pinned to the correct major version (e.g. https://www.postgresql.org/docs/16/sql-vacuum.html, not /docs/current/).
  • For longer answers, use headers matching the reference file's section headings so the user can jump to the source.
  • For version-sensitive answers, default to PG16 + add inline > [!NOTE] PG17 / > [!NOTE] PG18 deltas. Only ask the user to confirm version when the answer flips between supported majors.
  • For any performance investigation document or slow-query guide, always include an explicit section explaining how to read EXPLAIN plans bottom-up: start at the deepest-indented leaf node (scans execute first), work upward through parents (joins, sorts, aggregates), reach the root last. Identify the first node where actual rows diverges 10× or more from estimated rows — that is the misestimate source; everything above it operates on bad cardinality.

Routing Table

Keywords are matched case-insensitively. A single file can match multiple keyword phrases.

KeywordsFileScope
CREATE TABLE, ALTER TABLE, DROP TABLE, schema, sequence, generated column, identity column, IF NOT EXISTSreferences/01-syntax-ddl.mdDDL syntax reference
SELECT, JOIN, LATERAL, subquery, UNION, INTERSECT, EXCEPT, DISTINCT ON, LIMIT, OFFSET, FETCH FIRSTreferences/02-syntax-dql.mdQuery (DQL) reference
INSERT, UPDATE, DELETE, RETURNING, ON CONFLICT, upsert, MERGE, DEFAULT VALUESreferences/03-syntax-dml.mdDML reference
WITH, CTE, recursive CTE, WITH RECURSIVE, MATERIALIZED, modifying CTEreferences/04-ctes.mdCommon Table Expressions
view, CREATE VIEW, updatable view, INSTEAD OF, security_barrier, security_invoker, materialized view, REFRESH MATERIALIZED VIEW CONCURRENTLYreferences/05-views.mdViews and materialized views
CREATE FUNCTION, LANGUAGE, IMMUTABLE, STABLE, VOLATILE, PARALLEL SAFE, SECURITY DEFINER, RETURNS TABLE, polymorphicreferences/06-functions.mdFunctions
CREATE PROCEDURE, CALL, transaction control in procedure, COMMIT in procedurereferences/07-procedures.mdProcedures
PL/pgSQL, plpgsql, DECLARE, BEGIN, EXCEPTION, RAISE, FOR LOOP, cursor in plpgsql, GET STACKED DIAGNOSTICSreferences/08-plpgsql.mdPL/pgSQL deep dive
plpython3u, plperl, plperlu, pltcl, plv8, procedural language, untrusted PLreferences/09-procedural-languages.mdNon-pgSQL procedural languages
EXECUTE, dynamic SQL, format(), quote_ident, quote_literal, SQL injection in plpgsqlreferences/10-dynamic-sql.mdDynamic SQL
OVER, PARTITION BY, window function, ROWS BETWEEN, RANGE BETWEEN, GROUPS, LAG, LEAD, FIRST_VALUE, LAST_VALUE, NTH_VALUE, RANK, DENSE_RANK, ROW_NUMBER, NTILEreferences/11-window-functions.mdWindow functions
aggregate, FILTER, GROUPING SETS, ROLLUP, CUBE, percentile_cont, percentile_disc, ordered-set aggregate, CREATE AGGREGATEreferences/12-aggregates-grouping.mdAggregates & grouping
DECLARE CURSOR, FETCH, MOVE, WITH HOLD, scrollable cursor, refcursor, PREPARE, EXECUTE, DEALLOCATE, plan_cache_modereferences/13-cursors-and-prepares.mdCursors & prepared statements
text, varchar, char, numeric, decimal, real, double precision, integer, boolean, bytea, inet, cidr, macaddr, bit, varbitreferences/14-data-types-builtin.mdBuilt-in types
CREATE TYPE, composite type, CREATE DOMAIN, ENUM, ALTER TYPE ADD VALUE, range type, multirangereferences/15-data-types-custom.mdCustom types (composite/domain/enum/range)
array, ARRAY[], unnest, array_agg, array_position, ANY, ALL, GIN on arrayreferences/16-arrays.mdArrays
JSON, JSONB, ->, ->>, #>, #>>, @>, jsonb_set, jsonb_insert, jsonb_path_query, jsonpath, JSON_TABLE, jsonb_ops, jsonb_path_opsreferences/17-json-jsonb.mdJSON / JSONB
uuid, gen_random_uuid, uuidv7, uuid-ossp, NUMERIC precision, money, serial, bigserial, IDENTITY columnreferences/18-uuid-numeric-money.mdUUID, numeric, money, identity
timestamp, timestamptz, AT TIME ZONE, interval, date_trunc, date_part, timezone, DST, infinity timestampreferences/19-timestamp-timezones.mdTimestamps & time zones
tsvector, tsquery, to_tsvector, to_tsquery, plainto_tsquery, phraseto_tsquery, websearch_to_tsquery, ts_rank, ts_headline, FTS, full-text searchreferences/20-text-search.mdFull-text search
hstorereferences/21-hstore.mdhstore extension
index decision, choose index type, multicolumn index, partial index, expression index, INCLUDEreferences/22-indexes-overview.mdIndex decision matrix
B-tree, btree, deduplication, bottom-up index deletion, fillfactor, INCLUDE columns, covering indexreferences/23-btree-indexes.mdB-tree indexes
GIN, GiST, KNN-GiST, jsonb_ops, jsonb_path_ops, EXCLUDE USING gist, fastupdate, gin_pending_list_limitreferences/24-gin-gist-indexes.mdGIN & GiST indexes
BRIN, minmax_multi, bloom index, hash index, SP-GiSTreferences/25-brin-hash-spgist-bloom-indexes.mdBRIN, hash, SP-GiST, bloom
CREATE INDEX CONCURRENTLY, REINDEX CONCURRENTLY, INVALID index, pg_repack, pg_squeeze, index bloatreferences/26-index-maintenance.mdIndex maintenance
MVCC, xmin, xmax, cmin, cmax, infomask, tuple visibility, snapshot, xip, MultiXactreferences/27-mvcc-internals.mdMVCC internals
VACUUM, autovacuum, VACUUM FULL, VACUUM FREEZE, autovacuum_vacuum_scale_factor, pg_stat_progress_vacuum, visibility map, parallel vacuumreferences/28-vacuum-autovacuum.mdVACUUM & autovacuum
transaction id wraparound, XID wraparound, datfrozenxid, autovacuum_freeze_max_age, MultiXact wraparound, 64-bit XIDreferences/29-transaction-id-wraparound.mdTXID wraparound
HOT update, heap-only tuple, n_tup_hot_upd, HOT chainreferences/30-hot-updates.mdHOT updates
TOAST, oversized attribute, storage strategy, PLAIN, EXTENDED, EXTERNAL, MAIN, pglz, lz4 compressionreferences/31-toast.mdTOAST
shared_buffers, buffer manager, clock sweep, bgwriter, pg_buffercache, ring bufferreferences/32-buffer-manager.mdBuffer manager
WAL, wal_level, full_page_writes, archive_command, archive_library, wal_compression, wal_segment_size, pg_waldumpreferences/33-wal.mdWrite-Ahead Log
checkpoint, checkpointer, checkpoint_timeout, max_wal_size, checkpoint_completion_target, bgwriter_lru_maxpages, pg_stat_checkpointerreferences/34-checkpoints-bgwriter.mdCheckpoints & bgwriter
partition, RANGE partition, LIST partition, HASH partition, partition pruning, ATTACH PARTITION, DETACH PARTITION, DEFAULT partition, partition-wise joinreferences/35-partitioning.mdDeclarative partitioning
inheritance, INHERITS, ONLY clausereferences/36-inheritance.mdTable inheritance
CHECK constraint, NOT NULL, UNIQUE, UNIQUE NULLS NOT DISTINCT, EXCLUDE constraint, NOT VALID, VALIDATE CONSTRAINT, deferrablereferences/37-constraints.mdConstraints
foreign key, FOREIGN KEY, REFERENCES, ON DELETE CASCADE, ON DELETE SET NULL, deferrable FK, partitioned FK, circular FKreferences/38-foreign-keys-deep.mdForeign keys
CREATE TRIGGER, BEFORE trigger, AFTER trigger, INSTEAD OF, FOR EACH ROW, FOR EACH STATEMENT, NEW, OLD, transition table, REFERENCING NEW TABLEreferences/39-triggers.mdTriggers
event trigger, CREATE EVENT TRIGGER, ddl_command_start, ddl_command_end, sql_drop, table_rewrite, pg_event_trigger_ddl_commandsreferences/40-event-triggers.mdEvent triggers
BEGIN, COMMIT, ROLLBACK, SAVEPOINT, subtransaction, PREPARE TRANSACTION, 2PC, idle_in_transaction_session_timeout, autocommitreferences/41-transactions.mdTransactions
Read Committed, Repeatable Read, Serializable, SSI, snapshot isolation, default_transaction_isolation, serialization failure, retry patternreferences/42-isolation-levels.mdIsolation levels
lock, FOR UPDATE, FOR NO KEY UPDATE, FOR SHARE, FOR KEY SHARE, NOWAIT, SKIP LOCKED, AccessExclusiveLock, RowExclusiveLock, pg_locks, pg_blocking_pids, deadlockreferences/43-locking.mdLocking
advisory lock, pg_advisory_lock, pg_advisory_xact_lock, pg_try_advisory_lockreferences/44-advisory-locks.mdAdvisory locks
LISTEN, NOTIFY, UNLISTEN, pg_notify, notification queuereferences/45-listen-notify.mdLISTEN/NOTIFY
CREATE ROLE, GRANT, REVOKE, ALTER DEFAULT PRIVILEGES, pg_read_all_data, pg_monitor, SET ROLE, REASSIGN OWNED, INHERIT, NOINHERIT, BYPASSRLSreferences/46-roles-privileges.mdRoles & privileges
row-level security, RLS, CREATE POLICY, USING, WITH CHECK, FORCE ROW LEVEL SECURITY, ENABLE ROW LEVEL SECURITYreferences/47-row-level-security.mdRow-Level Security
pg_hba.conf, authentication method, scram-sha-256, md5, peer, trust, ident, ldap, gss, cert authreferences/48-authentication-pg-hba.mdpg_hba.conf & auth
SSL, TLS, sslmode, verify-full, channel binding, server cert, client certificate, ssl_ciphersreferences/49-tls-ssl.mdTLS/SSL
pgcrypto, encrypt, decrypt, pgp_sym_encrypt, digest, crypt, gen_salt, TDEreferences/50-encryption-pgcrypto.mdpgcrypto
pgaudit, audit log, session auditing, object auditing, compliance loggingreferences/51-pgaudit.mdpgaudit
CREATE RULE, rule system, ON SELECT DO INSTEADreferences/52-rules-system.mdRule system
postgresql.conf, postgresql.auto.conf, GUC, pg_settings, ALTER SYSTEM, reload, pg_reload_conf, parameter contextreferences/53-server-configuration.mdConfiguration
shared_buffers, effective_cache_size, work_mem, hash_mem_multiplier, maintenance_work_mem, autovacuum_work_mem, temp_buffers, wal_buffers, huge_pagesreferences/54-memory-tuning.mdMemory tuning
ANALYZE, pg_statistic, pg_stats, default_statistics_target, extended statistics, CREATE STATISTICS, ndistinct, dependencies, MCVreferences/55-statistics-planner.mdStatistics & planner input
EXPLAIN, EXPLAIN ANALYZE, EXPLAIN (BUFFERS), Seq Scan, Index Scan, Index Only Scan, Bitmap Heap Scan, Nested Loop, Hash Join, Merge Join, Memoize, Gather, Append, row estimate, plan nodereferences/56-explain.mdEXPLAIN deep dive
pg_stat_statements, query stats, top queries, calls, mean_exec_time, shared_blks_hitreferences/57-pg-stat-statements.mdpg_stat_statements
pg_stat_activity, wait_event, pg_stat_user_tables, pg_stat_user_indexes, pg_stat_database, pg_stat_io, pg_stat_wal, pg_stat_progress_*, performance diagnosticsreferences/58-performance-diagnostics.mdpg_stat_* diagnostics
random_page_cost, seq_page_cost, cpu_tuple_cost, effective_io_concurrency, enable_seqscan, enable_hashjoin, join_collapse_limit, geqo, planner tuningreferences/59-planner-tuning.mdPlanner tuning
parallel query, max_parallel_workers, max_parallel_workers_per_gather, max_parallel_maintenance_workers, parallel append, parallel hash join, force_parallel_modereferences/60-parallel-query.mdParallel query
JIT, jit_above_cost, jit_inline_above_cost, LLVM, just-in-time compilationreferences/61-jit-compilation.mdJIT compilation
tablespace, CREATE TABLESPACE, default_tablespace, temp_tablespaces, SET TABLESPACEreferences/62-tablespaces.mdTablespaces
postmaster, backend process, autovacuum launcher, walwriter, walsender, walreceiver, archiver, bgwriter, checkpointer, logical replication worker, shared memory architecture, fork per connectionreferences/63-internals-architecture.mdProcess & memory architecture
pg_catalog, pg_class, pg_attribute, pg_index, pg_namespace, pg_constraint, pg_proc, pg_type, pg_depend, pg_inherits, pg_partitioned_table, pg_publication, pg_subscription, pg_extension, pg_authid, pg_roles, pg_database, pg_tablespace, pg_settings, relkind, information_schema, ECHO_HIDDEN, catalog explorationreferences/64-system-catalogs.mdSystem catalogs & exploration recipes
collation, ICU, libc, deterministic collation, nondeterministic collation, case-insensitive UNIQUE, collation version, encoding, UTF-8, client_encodingreferences/65-collations-encoding.mdCollations & encoding
COPY, \copy, bulk load, CSV import, HEADER, DELIMITER, FREEZE, ON_ERROR, LOG_VERBOSITY, parallel COPYreferences/66-bulk-operations-copy.mdCOPY / bulk
psql, \d, \dt, \di, \df, \dn, \dx, \timing, \watch, \gexec, pg_isready, createdb, dropdb, vacuumdb, reindexdb, clusterdbreferences/67-cli-tools.mdCLI tools
pgbench, benchmark, TPC-B, -c clients, -j threads, scaling factor, custom pgbench scriptreferences/68-pgbench.mdpgbench
CREATE EXTENSION, ALTER EXTENSION UPDATE, pg_extension, trusted extension, contribreferences/69-extensions.mdExtensions overview
FDW, foreign data wrapper, CREATE FOREIGN TABLE, postgres_fdw, file_fdw, IMPORT FOREIGN SCHEMA, dblink, pushdownreferences/70-fdw.mdFDW
large object, lo_create, lo_open, lo_read, lo_export, lo_import, pg_largeobject, vacuumlo, bytea vs LOreferences/71-large-objects.mdLarge objects
extension development, PGXS, PG_MODULE_MAGIC, PG_FUNCTION_INFO_V1, .control, hooks, C extensionreferences/72-extension-development.mdExtension development
streaming replication, primary_conninfo, primary_slot_name, standby.signal, recovery.signal, synchronous_standby_names, synchronous_commit, cascading replication, hot_standby_feedbackreferences/73-streaming-replication.mdStreaming replication
logical replication, CREATE PUBLICATION, CREATE SUBSCRIPTION, FOR ALL TABLES, FOR TABLES IN SCHEMA, row filter, column list, replication origin, DDL replication, two-phase decodingreferences/74-logical-replication.mdLogical replication
replication slot, pg_create_physical_replication_slot, pg_create_logical_replication_slot, max_slot_wal_keep_size, max_replication_slots, max_wal_senders, pg_replication_slots, slot invalidationreferences/75-replication-slots.mdReplication slots
logical decoding, pgoutput, wal2json, decoderbufs, test_decoding, CDC, REPLICA IDENTITY, START_REPLICATION SLOT LOGICALreferences/76-logical-decoding.mdLogical decoding
standby, hot standby, max_standby_streaming_delay, hot_standby_feedback, pg_promote, pg_rewind, timeline ID, failover, switchoverreferences/77-standby-failover.mdStandby & failover
HA, high availability, Patroni, repmgr, pg_auto_failover, Stolon, cluster manager, fencing, split brain, witnessreferences/78-ha-architectures.mdHA architectures
Patroni, patroni.yml, DCS, etcd, consul, zookeeper, REST API, /failover, /switchover, watchdogreferences/79-patroni.mdPatroni
connection pool, pool sizing, transaction pool, session pool, statement pool, process-per-connectionreferences/80-connection-pooling.mdConnection pooling concepts
pgBouncer, pool_mode, default_pool_size, reserve_pool_size, server_idle_timeout, prepared statement pgbouncer, SHOW POOLS, SHOW STATSreferences/81-pgbouncer.mdpgBouncer
monitoring, postgres_exporter, prometheus, pg_stat_*, alerting thresholds, log-based metricsreferences/82-monitoring.mdMonitoring
pg_dump, pg_dumpall, pg_restore, custom format, directory format, parallel dump, --filter, --on-conflict-do-nothingreferences/83-backup-pg-dump.mdLogical backup
pg_basebackup, base backup, archive_command, restore_command, recovery_target_time, recovery_target_xid, PITR, point-in-time recovery, continuous archivingreferences/84-backup-physical-pitr.mdPhysical backup & PITR
pgBackRest, Barman, WAL-G, incremental backup, retention policy, S3 backupreferences/85-backup-tools.mdBackup tooling
pg_upgrade, --link, --clone, major upgrade, statistics preservation, preflight checkreferences/86-pg-upgrade.mdpg_upgrade
major version upgrade, blue-green upgrade, logical replication upgrade, near-zero downtime, catalog versionreferences/87-major-version-upgrade.mdMajor-version upgrade strategy
corruption, data_checksums, pg_amcheck, pg_checksums, pg_resetwal, single-user mode, zero_damaged_pagesreferences/88-corruption-recovery.mdCorruption recovery
pg_rewind, divergent timeline, wal_log_hints, --source-server, --source-pgdatareferences/89-pg-rewind.mdpg_rewind
disaster recovery, RPO, RTO, DR drill, runbook, failover bookkeepingreferences/90-disaster-recovery.mdDisaster recovery
docker postgres, docker-entrypoint-initdb.d, POSTGRES_PASSWORD, healthcheck postgres container, volume PGDATAreferences/91-docker-postgres.mdDocker postgres image
Kubernetes postgres, CloudNativePG, CNPG, postgres-operator, Zalando, Crunchy PGO, StatefulSetreferences/92-kubernetes-operators.mdK8s operators
pg_trgm, trigram, similarity, % operator, GIN trigram, LIKE acceleration, word_similarityreferences/93-pg-trgm.mdpg_trgm
pgvector, vector, embedding, HNSW, IVFFLAT, <->, <=>, <#>, halfvec, sparsevec, m, ef_construction, ef_search, lists, probes, ANNreferences/94-pgvector.mdpgvector
PostGIS, geometry, geography, SRID, ST_Transform, ST_DWithin, ST_Intersects, ST_Buffer, spatial indexreferences/95-postgis.mdPostGIS
TimescaleDB, hypertable, continuous aggregate, compression, retention policy, chunkreferences/96-timescaledb.mdTimescaleDB
Citus, distributed table, reference table, coordinator, worker, shard, colocated join, columnar storagereferences/97-citus.mdCitus
pg_cron, cron.schedule, cron.job, cron.job_run_details, scheduled VACUUM, scheduled REFRESH MATERIALIZED VIEWreferences/98-pg-cron.mdpg_cron
pg_partman, partman.create_parent, run_maintenance_proc, partition retention, partman.part_config, sub-partitionreferences/99-pg-partman.mdpg_partman
PG14, PG15, PG16, PG17, PG18, release notes, version features, support policyreferences/100-pg-versions-features.mdPer-major-version feature highlights
managed Postgres, managed PaaS, hosted Postgres, bare-metal, self-hosted, superuser restriction, extension allowlist, shared_preload_libraries restriction, vendor lock-inreferences/101-managed-vs-baremetal.mdManaged vs bare-metal trade-offs (provider-agnostic)
recipe, cookbook, bloat triage, slow-query investigation, deadlock investigation, replication lag investigation, PITR walkthrough, upgrade playbook, catalog explorationreferences/102-skill-cookbook.mdMulti-file recipes & catalog exploration

Disambiguation Tips

Some terms route to multiple files — load both when in doubt.

TermPrimary fileSecondary fileWhy
VACUUM blocking28-vacuum-autovacuum.md27-mvcc-internals.md, 29-transaction-id-wraparound.mdWhy VACUUM exists is MVCC; what it must do is bounded by wraparound
EXPLAIN plan56-explain.md55-statistics-planner.md, 59-planner-tuning.mdMisestimates point to stats; tuning may need GUC changes
Index choice22-indexes-overview.md23-btree-indexes.md through 25-brin-hash-spgist-bloom-indexes.mdOverview routes to specifics
Deadlock43-locking.md42-isolation-levels.mdPredicate locks (SSI) cause different deadlocks
Replication is lagging73-streaming-replication.md75-replication-slots.md, 82-monitoring.mdLag could be stream pressure or slot retention
Upgrade86-pg-upgrade.md87-major-version-upgrade.mdpg_upgrade is one strategy; the other file covers blue/green and logical-repl-based upgrades
JSON column performance17-json-jsonb.md24-gin-gist-indexes.mdJSONB indexing happens via GIN
Full-text search ranking20-text-search.md24-gin-gist-indexes.mdFTS uses GIN
Bulk load slow66-bulk-operations-copy.md33-wal.md, 28-vacuum-autovacuum.mdWAL volume and post-load vacuum dominate
Catalog exploration / inspection64-system-catalogs.md102-skill-cookbook.mdThe cookbook has runnable recipes
shared_buffers32-buffer-manager.md54-memory-tuning.mdMechanics live in 32; sizing guidance lives in 54
work_mem / hash_mem_multiplier54-memory-tuning.md59-planner-tuning.md, 56-explain.mdSizing in 54; planner cost interaction in 59; spill-to-disk diagnosis in 56
archive_command / archive_library33-wal.md84-backup-physical-pitr.md, 85-backup-tools.mdWAL-level mechanics in 33; PITR consumer side in 84; pgBackRest/Barman/WAL-G in 85
wal_level33-wal.md74-logical-replication.md, 76-logical-decoding.mdSetting + implications in 33; logical consumers in 74/76
pg_basebackup84-backup-physical-pitr.md89-pg-rewind.md, 73-streaming-replication.mdBase backup in 84; rebuild-after-divergence alternative in 89; standby provisioning in 73
Partition rotation / retention35-partitioning.md99-pg-partman.md, 98-pg-cron.mdNative partitioning in 35; lifecycle automation in 99; scheduling in 98
Slow query56-explain.md57-pg-stat-statements.md, 58-performance-diagnostics.md, 55-statistics-planner.md, 102-skill-cookbook.mdWorkload-wide via 57; plan via 56; misestimate root cause in 55; full investigation walk in 102
Connection storm / too many connections80-connection-pooling.md81-pgbouncer.md, 63-internals-architecture.md, 46-roles-privileges.mdPooling concepts in 80; pgBouncer config in 81; fork-per-connection cost in 63; per-role connection limits in 46
Failover / promote77-standby-failover.md78-ha-architectures.md, 79-patroni.md, 89-pg-rewind.mdManual mechanics in 77; cluster-manager landscape in 78; Patroni-specific in 79; rejoin-old-primary in 89

Versioning & Provider Neutrality

  • Target compatibility baseline: every SQL example must run on PostgreSQL 16 unless explicitly marked otherwise.
  • Version-pin docs URLs. Cite https://www.postgresql.org/docs/16/..., not /docs/current/. The current alias moves with each annual release.
  • Provider neutrality is mandatory. Never recommend a managed provider over another. When discussing managed-service limitations, phrase categorically ("most managed providers disable untrusted PLs"), not by name.

Sources

Primary documentation roots (re-fetch before citing in any reference file; version-pin URLs to the matching major):

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

还有 42 个文件。

常见问题

Postgres AI 技能有什么作用?

面向开发者和 DBA 的 PostgreSQL 综合参考,涵盖 14–18 版本。用户询问 PostgreSQL 语法、DDL/DML/DQL、联接、LATERAL、CTE、窗口函数、GROUPING SETS、DISTINCT ON、RETURNING、ON CONFLICT、PL/pgSQL、函数、过程、触发器、视图、物化视图、索引(B-tree/GIN/GiST/BRIN/Hash/Bloom)、MVCC、VACUUM、autovacuum、WAL、TOAST、分区、复制(流复制/逻辑复制)、备份、PITR、高可用(Patroni/repmgr)、pgBouncer、EXPLAIN ANALYZE、RLS、角色、扩展(pgvector、PostGIS、TimescaleDB、Citus、pg_trgm、pg_cron)、JSON/JSONB、全文搜索、UUID、timestamptz、COPY、系统目录、排序规则、大对象、游标、GUC,或任何 Postgres 管理、性能、安全、复制、备份或恢复主题时,均可使用此技能。

为什么在 TypingMind 中使用 Postgres?

因为您只需安装一次,就能搭配任何模型使用。Postgres 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Postgres?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/damusix/skills/tree/main/postgres。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Postgres?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Postgres 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Postgres 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Postgres AI 技能免费吗?

damusix 已在 GitHub 上发布了该技能。请查看代码仓库了解许可条款。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇