# pg_ctl
## Name
pg_ctl?--?initialize, start, stop, or control a PostgreSQL server
## Synopsis
`pg_ctl` `init[db]` [`-s`] [`-D` `_datadir_`] [`-o` `_initdb-options_`]
`pg_ctl` `start` [`-w`] [`-t` `_seconds_`] [`-s`] [`-D` `_datadir_`] [`-l` `_filename_`] [`-o` `_options_`] [`-p` `_path_`] [`-c`]
`pg_ctl` `stop` [`-W`] [`-t` `_seconds_`] [`-s`] [`-D` `_datadir_`] [`-m` `s[mart]` | `f[ast]` | `i[mmediate]` ]
`pg_ctl` `restart` [`-w`] [`-t` `_seconds_`] [`-s`] [`-D` `_datadir_`] [`-c`] [`-m` `s[mart]` | `f[ast]` | `i[mmediate]` ] [`-o` `_options_`]
`pg_ctl` `reload` [`-s`] [`-D` `_datadir_`]
`pg_ctl` `status` [`-D` `_datadir_`]
`pg_ctl` `promote` [`-s`] [`-D` `_datadir_`]
`pg_ctl` `kill` `_signal_name_` `_process_id_`
`pg_ctl` `register` [`-N` `_servicename_`] [`-U` `_username_`] [`-P` `_password_`] [`-D` `_datadir_`] [`-S` `a[uto]` | `d[emand]` ] [`-w`] [`-t` `_seconds_`] [`-s`] [`-o` `_options_`]
`pg_ctl` `unregister` [`-N` `_servicename_`]
## Description
pg_ctl is a utility for initializing a PostgreSQL database cluster, starting, stopping, or restarting the PostgreSQL database server ([postgres](#calibre_link-1033)), or displaying the status of a running server. Although the server can be started manually, pg_ctl encapsulates tasks such as redirecting log output and properly detaching from the terminal and process group. It also provides convenient options for controlled shutdown.
The `init` or `initdb` mode creates a new PostgreSQL database cluster. A database cluster is a collection of databases that are managed by a single server instance. This mode invokes the `initdb` command. See [initdb](#calibre_link-542) for details.
In `start` mode, a new server is launched. The server is started in the background, and its standard input is attached to `/dev/null` (or `nul` on Windows). On Unix-like systems, by default, the server's standard output and standard error are sent to pg_ctl's standard output (not standard error). The standard output of pg_ctl should then be redirected to a file or piped to another process such as a log rotating program like rotatelogs; otherwise `postgres` will write its output to the controlling terminal (from the background) and will not leave the shell's process group. On Windows, by default the server's standard output and standard error are sent to the terminal. These default behaviors can be changed by using `-l` to append the server's output to a log file. Use of either `-l` or output redirection is recommended.
In `stop` mode, the server that is running in the specified data directory is shut down. Three different shutdown methods can be selected with the `-m` option. "Smart" mode (the default) waits for all active clients to disconnect and any online backup to finish. If the server is in hot standby, recovery and streaming replication will be terminated once all clients have disconnected. "Fast" mode does not wait for clients to disconnect and will terminate an online backup in progress. All active transactions are rolled back and clients are forcibly disconnected, then the server is shut down. "Immediate" mode will abort all server processes immediately, without a clean shutdown. This will lead to a crash-recovery run on the next restart.
`restart` mode effectively executes a stop followed by a start. This allows changing the `postgres` command-line options. `restart` might fail if relative paths specified were specified on the command-line during server start.
`reload` mode simply sends the `postgres` process a SIGHUP signal, causing it to reread its configuration files (`postgresql.conf`, `pg_hba.conf`, etc.). This allows changing of configuration-file options that do not require a complete restart to take effect.
`status` mode checks whether a server is running in the specified data directory. If it is, the PID and the command line options that were used to invoke it are displayed. If the server is not running, the process returns an exit status of 3.
In `promote` mode, the standby server that is running in the specified data directory is commanded to exit recovery and begin read-write operations.
`kill` mode allows you to send a signal to a specified process. This is particularly valuable for Microsoft Windows which does not have a kill command. Use `--help` to see a list of supported signal names.
`register` mode allows you to register a system service on Microsoft Windows. The `-S` option allows selection of service start type, either "auto" (start service automatically on system startup) or "demand" (start service on demand).
`unregister` mode allows you to unregister a system service on Microsoft Windows. This undoes the effects of the `register` command.
## Options
`-c``--core-file`
Attempt to allow server crashes to produce core files, on platforms where this is possible, by lifting any soft resource limit placed on core files. This is useful in debugging or diagnosing problems by allowing a stack trace to be obtained from a failed server process.
`-D` `_datadir_`
`--pgdata` `_datadir_`
Specifies the file system location of the database configuration files. If this is omitted, the environment variable `PGDATA` is used.
`-l` `_filename_`
`--log` `_filename_`
Append the server log output to `_filename_`. If the file does not exist, it is created. The umask is set to 077, so access to the log file is disallowed to other users by default.
`-m` `_mode_`
`--mode` `_mode_`
Specifies the shutdown mode. `_mode_` can be `smart`, `fast`, or `immediate`, or the first letter of one of these three. If this is omitted, `smart` is used.
`-o` `_options_`
Specifies options to be passed directly to the `postgres` command.
The options should usually be surrounded by single or double quotes to ensure that they are passed through as a group.
`-o` `_initdb-options_`
Specifies options to be passed directly to the `initdb` command.
The options should usually be surrounded by single or double quotes to ensure that they are passed through as a group.
`-p` `_path_`
Specifies the location of the `postgres` executable. By default the `postgres` executable is taken from the same directory as `pg_ctl`, or failing that, the hard-wired installation directory. It is not necessary to use this option unless you are doing something unusual and get errors that the `postgres` executable was not found.
In `init` mode, this option analogously specifies the location of the `initdb` executable.
`-s`
`--silent`
Print only errors, no informational messages.
`-t`
`--timeout`
The maximum number of seconds to wait when waiting for startup or shutdown to complete. The default is 60 seconds.
`-V`
`--version`
Print the pg_ctl version and exit.
`-w`
Wait for the startup or shutdown to complete. Waiting is the default option for shutdowns, but not startups. When waiting for startup, `pg_ctl` repeatedly attempts to connect to the server. When waiting for shutdown, `pg_ctl` waits for the server to remove its PID file. This option allows the entry of an SSL passphrase on startup. `pg_ctl` returns an exit code based on the success of the startup or shutdown.
`-W`
Do not wait for startup or shutdown to complete. This is the default for start and restart modes.
`-?`
`--help`
Show help about pg_ctl command line arguments, and exit.
### Options for Windows
`-N` `_servicename_`
Name of the system service to register. The name will be used as both the service name and the display name.
`-P` `_password_`
Password for the user to start the service.
`-S` `_start-type_`
Start type of the system service to register. start-type can be `auto`, or `demand`, or the first letter of one of these two. If this is omitted, `auto` is used.
`-U` `_username_`
User name for the user to start the service. For domain users, use the format `DOMAIN\username`.
## Environment
`PGDATA`
Default data directory location.
`pg_ctl`, like most other PostgreSQL utilities, also uses the environment variables supported by libpq (see [Section 31.14](#calibre_link-39)). For additional server variables, see [postgres](#calibre_link-1033).
## Files
`postmaster.pid`
The existence of this file in the data directory is used to help pg_ctl determine if the server is currently running.
`postmaster.opts`
If this file exists in the data directory, pg_ctl (in `restart` mode) will pass the contents of the file as options to postgres, unless overridden by the `-o` option. The contents of this file are also displayed in `status` mode.
## Examples
### Starting the Server
To start the server:
```
<samp class="literal">$</samp> <kbd class="literal">pg_ctl start</kbd>
```
To start the server, waiting until the server is accepting connections:
```
<samp class="literal">$</samp> <kbd class="literal">pg_ctl -w start</kbd>
```
To start the server using port 5433, and running without `fsync`, use:
```
<samp class="literal">$</samp> <kbd class="literal">pg_ctl -o "-F -p 5433" start</kbd>
```
### Stopping the Server
To stop the server, use:
```
<samp class="literal">$</samp> <kbd class="literal">pg_ctl stop</kbd>
```
The `-m` option allows control over _how_ the server shuts down:
```
<samp class="literal">$</samp> <kbd class="literal">pg_ctl stop -m fast</kbd>
```
### Restarting the Server
Restarting the server is almost equivalent to stopping the server and starting it again, except that `pg_ctl` saves and reuses the command line options that were passed to the previously running instance. To restart the server in the simplest form, use:
```
<samp class="literal">$</samp> <kbd class="literal">pg_ctl restart</kbd>
```
To restart the server, waiting for it to shut down and restart:
```
<samp class="literal">$</samp> <kbd class="literal">pg_ctl -w restart</kbd>
```
To restart using port 5433, disabling `fsync` upon restart:
```
<samp class="literal">$</samp> <kbd class="literal">pg_ctl -o "-F -p 5433" restart</kbd>
```
### Showing the Server Status
Here is sample status output from pg_ctl:
```
<samp class="literal">$</samp> <kbd class="literal">pg_ctl status</kbd>
<samp class="literal">pg_ctl: server is running (PID: 13718)
/usr/local/pgsql/bin/postgres "-D" "/usr/local/pgsql/data" "-p" "5433" "-B" "128"</samp>
```
This is the command line that would be invoked in restart mode.
## See Also
[initdb](#calibre_link-542), [postgres](#calibre_link-1033)
- 前言
- 何為PostgreSQL?
- PostgreSQL簡史
- 格式約定
- 更多信息
- 臭蟲匯報指導
- I. 教程
- Chapter 1. 從頭開始
- 1.1. 安裝
- 1.2. 體系基本概念
- 1.3. 創建一個數據庫
- 1.4. 訪問數據庫
- Chapter 2. SQL語言
- 2.1. 介紹
- 2.2. 概念
- 2.3. 創建新表
- 2.4. 向表中添加行
- 2.5. 查詢一個表
- 2.6. 在表間連接
- 2.7. 聚集函數
- 2.8. 更新
- 2.9. 刪除
- Chapter 3. 高級特性
- 3.1. 介紹
- 3.2. 視圖
- 3.3. 外鍵
- 3.4. 事務
- 3.5. 窗口函數
- 3.6. 繼承
- 3.7. 結論
- II. SQL 語言
- Chapter 4. SQL語法
- 4.1. 詞法結構
- 4.2. 值表達式
- 4.3. 調用函數
- Chapter 5. 數據定義
- 5.1. 表的基本概念
- 5.2. 缺省值
- 5.3. 約束
- 5.4. 系統字段
- 5.5. 修改表
- 5.6. 權限
- 5.7. 模式
- 5.8. 繼承
- 5.9. 分區
- 5.10. 外部數據
- 5.11. 其它數據庫對象
- 5.12. 依賴性跟蹤
- Chapter 6. 數據操作
- 6.1. 插入數據
- 6.2. 更新數據
- 6.3. 刪除數據
- Chapter 7. 查詢
- 7.1. 概述
- 7.2. 表表達式
- 7.3. 選擇列表
- 7.4. 組合查詢
- 7.5. 行排序
- 7.6. LIMIT和OFFSET
- 7.7. VALUES列表
- 7.8. WITH 查詢 (通用表表達式)
- Chapter 8. 數據類型
- 8.1. 數值類型
- 8.2. 貨幣類型
- 8.3. 字符類型
- 8.4. 二進制數據類型
- 8.5. 日期/時間類型
- 8.6. 布爾類型
- 8.7. 枚舉類型
- 8.8. 幾何類型
- 8.9. 網絡地址類型
- 8.10. 位串類型
- 8.11. 文本搜索類型
- 8.12. UUID 類型
- 8.13. XML 類型
- 8.14. JSON 類型
- 8.15. Arrays
- 8.16. 復合類型
- 8.17. 范圍類型
- 8.18. 對象標識符類型
- 8.19. 偽類型
- Chapter 9. 函數和操作符
- 9.1. 邏輯操作符
- 9.2. 比較操作符
- 9.3. 數學函數和操作符
- 9.4. 字符串函數和操作符
- 9.5. 二進制字符串函數和操作符
- 9.6. 位串函數和操作符
- 9.7. 模式匹配
- 9.8. 數據類型格式化函數
- 9.9. 時間/日期函數和操作符
- 9.10. 支持枚舉函數
- 9.11. 幾何函數和操作符
- 9.12. 網絡地址函數和操作符
- 9.13. 文本檢索函數和操作符
- 9.14. XML 函數
- 9.15. JSON 函數和操作符
- 9.16. 序列操作函數
- 9.17. 條件表達式
- 9.18. 數組函數和操作符
- 9.19. 范圍函數和操作符
- 9.20. 聚集函數
- 9.21. 窗口函數
- 9.22. 子查詢表達式
- 9.23. 行和數組比較
- 9.24. 返回集合的函數
- 9.25. 系統信息函數
- 9.26. 系統管理函數
- 9.27. 觸發器函數
- 9.28. 事件觸發函數
- Chapter 10. 類型轉換
- 10.1. 概述
- 10.2. 操作符
- 10.3. 函數
- 10.4. 值存儲
- 10.5. UNION, CASE 和相關構造
- Chapter 11. 索引
- 11.1. 介紹
- 11.2. 索引類型
- 11.3. 多字段索引
- 11.4. 索引和ORDER BY
- 11.5. 組合多個索引
- 11.6. 唯一索引
- 11.7. 表達式上的索引
- 11.8. 部分索引
- 11.9. 操作符類和操作符族
- 11.10. 索引和排序
- 11.11. 檢查索引的使用
- Chapter 12. 全文檢索
- 12.1. 介紹
- 12.2. 表和索引
- 12.3. 控制文本搜索
- 12.4. 附加功能
- 12.5. 解析器
- 12.6. 詞典
- 12.7. 配置實例
- 12.8. 測試和調試文本搜索
- 12.9. GiST和GIN索引類型
- 12.10. psql支持
- 12.11. 限制
- 12.12. 來自8.3之前文本搜索的遷移
- Chapter 13. 并發控制
- 13.1. 介紹
- 13.2. 事務隔離
- 13.3. 明確鎖定
- 13.4. 應用層數據完整性檢查
- 13.5. 鎖和索引
- Chapter 14. 性能提升技巧
- 14.1. 使用EXPLAIN
- 14.2. 規劃器使用的統計信息
- 14.3. 用明確的JOIN控制規劃器
- 14.4. 向數據庫中添加記錄
- 14.5. 非持久性設置
- III. 服務器管理
- Chapter 15. 源碼安裝
- 15.1. 簡版
- 15.2. 要求
- 15.3. 獲取源碼
- 15.4. 安裝過程
- 15.5. 安裝后設置
- 15.6. 支持平臺
- 15.7. 特定平臺注意事項
- Chapter 16. Windows下用源代碼安裝
- 16.1. 用Visual C++或Microsoft Windows SDK編譯
- 16.2. 用Visual C++或 Borland C++編譯 libpq
- Chapter 17. 服務器設置和操作
- 17.1. PostgreSQL用戶賬戶
- 17.2. 創建數據庫集群
- 17.3. 啟動數據庫服務器
- 17.4. 管理內核資源
- 17.5. 關閉服務器
- 17.6. 升級一個 PostgreSQL 集群
- 17.7. 防止服務器欺騙
- 17.8. 加密選項
- 17.9. 用 SSL 進行安全的 TCP/IP 連接
- 17.10. 用SSH隧道進行安全 TCP/IP 連接
- 17.11. 在Windows上注冊事件日志
- Chapter 18. 服務器配置
- 18.1. 設置參數
- 18.2. 文件位置
- 18.3. 連接和認證
- 18.4. 資源消耗
- 18.5. 預寫式日志
- 18.6. 復制
- 18.7. 查詢規劃
- 18.8. 錯誤報告和日志
- 18.9. 運行時統計
- 18.10. 自動清理
- 18.11. 客戶端連接缺省
- 18.12. 鎖管理
- 18.13. 版本和平臺兼容性
- 18.14. Error Handling
- 18.15. 預置選項
- 18.16. 自定義選項
- 18.17. 開發人員選項
- 18.18. 短選項
- Chapter 19. 用戶認證
- 19.1. pg_hba.conf文件
- 19.2. 用戶名映射
- 19.3. 認證方法
- 19.4. 用戶認證
- Chapter 20. 數據庫角色
- 20.1. 數據庫角色
- 20.2. 角色屬性
- 20.3. 角色成員
- 20.4. 函數和觸發器安全
- Chapter 21. 管理數據庫
- 21.1. 概述
- 21.2. 創建一個數據庫
- 21.3. 模板數據庫
- 21.4. 數據庫配置
- 21.5. 刪除數據庫
- 21.6. 表空間
- Chapter 22. 區域
- 22.1. 區域支持
- 22.2. 排序規則支持
- 22.3. 字符集支持
- Chapter 23. 日常數據庫維護工作
- 23.1. 日常清理
- 23.2. 經常重建索引
- 23.3. 日志文件維護
- Chapter 24. 備份與恢復
- 24.1. SQL轉儲
- 24.2. 文件系統級別備份
- 24.3. 在線備份以及即時恢復(PITR)
- Chapter 25. 高可用性與負載均衡,復制
- 25.1. 不同解決方案的比較
- 25.2. 日志傳送備份服務器
- 25.3. 失效切換
- 25.4. 日志傳送的替代方法
- 25.5. 熱備
- Chapter 26. 恢復配置
- 26.1. 歸檔恢復設置
- 26.2. 恢復目標設置
- 26.3. 備用服務器設置
- Chapter 27. 監控數據庫的活動
- 27.1. 標準Unix工具
- 27.2. 統計收集器
- 27.3. 查看鎖
- 27.4. 動態跟蹤
- Chapter 28. 監控磁盤使用情況
- 28.1. 判斷磁盤的使用量
- 28.2. 磁盤滿導致的失效
- Chapter 29. 可靠性和預寫式日志
- 29.1. 可靠性
- 29.2. 預寫式日志(WAL)
- 29.3. 異步提交
- 29.4. WAL 配置
- 29.5. WAL 內部
- Chapter 30. 回歸測試
- 30.1. 運行測試
- 30.2. 測試評估
- 30.3. 平臺相關的比較文件
- 30.4. 測試覆蓋率檢查
- IV. 客戶端接口
- Chapter 31. libpq - C 庫
- 31.1. 數據庫連接控制函數
- 31.2. 連接狀態函數
- 31.3. 命令執行函數
- 31.4. 異步命令處理
- 31.5. 逐行檢索查詢結果
- 31.6. 取消正在處理的查詢
- 31.7. 捷徑接口
- 31.8. 異步通知
- 31.9. 與COPY命令相關的函數
- 31.10. 控制函數
- 31.11. 各種函數
- 31.12. 注意信息處理
- 31.13. 事件系統
- 31.14. 環境變量
- 31.15. 口令文件
- 31.16. 連接服務的文件
- 31.17. LDAP查找連接參數
- 31.18. SSL 支持
- 31.19. 在多線程程序里的行為
- 31.20. 制作libpq程序
- 31.21. 例子程序
- Chapter 32. 大對象
- 32.1. 介紹
- 32.2. 實現特點
- 32.3. 客戶端接口
- 32.4. 服務器端函數
- 32.5. 例子程序
- Chapter 33. ECPG - 在C中嵌入SQL
- 33.1. 概念
- 33.2. 管理數據庫連接
- 33.3. 運行SQL命令
- 33.4. 使用宿主變量
- 33.5. 動態SQL
- 33.6. pgtypes 庫
- 33.7. 使用描述符范圍
- 33.8. 錯誤處理
- 33.9. 預處理器指令
- 33.10. 處理嵌入的SQL程序
- 33.11. 庫函數
- 33.12. 大對象
- 33.13. C++應用程序
- 33.14. 嵌入的SQL命令
- ALLOCATE DESCRIPTOR
- CONNECT
- DEALLOCATE DESCRIPTOR
- DECLARE
- DESCRIBE
- DISCONNECT
- EXECUTE IMMEDIATE
- GET DESCRIPTOR
- OPEN
- PREPARE
- SET AUTOCOMMIT
- SET CONNECTION
- SET DESCRIPTOR
- TYPE
- VAR
- WHENEVER
- 33.15. Informix兼容模式
- 33.16. 內部
- Chapter 34. 信息模式
- 34.1. 關于這個模式
- 34.2. 數據類型
- 34.3. information_schema_catalog_name
- 34.4. administrable_role_authorizations
- 34.5. applicable_roles
- 34.6. attributes
- 34.7. character_sets
- 34.8. check_constraint_routine_usage
- 34.9. check_constraints
- 34.10. collations
- 34.11. collation_character_set_applicability
- 34.12. column_domain_usage
- 34.13. column_options
- 34.14. column_privileges
- 34.15. column_udt_usage
- 34.16. columns
- 34.17. constraint_column_usage
- 34.18. constraint_table_usage
- 34.19. data_type_privileges
- 34.20. domain_constraints
- 34.21. domain_udt_usage
- 34.22. domains
- 34.23. element_types
- 34.24. enabled_roles
- 34.25. foreign_data_wrapper_options
- 34.26. foreign_data_wrappers
- 34.27. foreign_server_options
- 34.28. foreign_servers
- 34.29. foreign_table_options
- 34.30. foreign_tables
- 34.31. key_column_usage
- 34.32. parameters
- 34.33. referential_constraints
- 34.34. role_column_grants
- 34.35. role_routine_grants
- 34.36. role_table_grants
- 34.37. role_udt_grants
- 34.38. role_usage_grants
- 34.39. routine_privileges
- 34.40. routines
- 34.41. schemata
- 34.42. sequences
- 34.43. sql_features
- 34.44. sql_implementation_info
- 34.45. sql_languages
- 34.46. sql_packages
- 34.47. sql_parts
- 34.48. sql_sizing
- 34.49. sql_sizing_profiles
- 34.50. table_constraints
- 34.51. table_privileges
- 34.52. tables
- 34.53. triggered_update_columns
- 34.54. triggers
- 34.55. udt_privileges
- 34.56. usage_privileges
- 34.57. user_defined_types
- 34.58. user_mapping_options
- 34.59. user_mappings
- 34.60. view_column_usage
- 34.61. view_routine_usage
- 34.62. view_table_usage
- 34.63. views
- V. 服務器端編程
- Chapter 35. 擴展SQL
- 35.1. 擴展性是如何實現的
- 35.2. PostgreSQL類型系統
- 35.3. 用戶定義的函數
- 35.4. 查詢語言(SQL)函數
- 35.5. 函數重載
- 35.6. 函數易失性范疇
- 35.7. 過程語言函數
- 35.8. 內部函數
- 35.9. C-語言函數
- 35.10. 用戶定義聚集
- 35.11. 用戶定義類型
- 35.12. 用戶定義操作符
- 35.13. 操作符優化信息
- 35.14. 擴展索引接口
- 35.15. 包裝相關對象到一個擴展
- 35.16. 擴展基礎設施建設
- Chapter 36. 觸發器
- 36.1. 觸發器行為概述
- 36.2. 數據改變的可視性
- 36.3. 用C寫觸發器
- 36.4. 一個完整的觸發器例子
- Chapter 37. 事件觸發器
- 37.1. 事件觸發器行為的概述
- 37.2. 事件觸發器觸發矩陣
- 37.3. 用C編寫事件觸發器函數
- 37.4. 一個完整的事件觸發器的例子
- Chapter 38. 規則系統
- 38.1. 查詢樹
- 38.2. 視圖和規則系統
- 38.3. 物化視圖
- 38.4. 在 INSERT, UPDATE, 和 DELETE上的規則
- 38.5. 規則和權限
- 38.6. 規則和命令狀態
- 38.7. 規則與觸發器的比較
- Chapter 39. 過程語言
- 39.1. 安裝過程語言
- Chapter 40. PL/pgSQL - SQL過程語言
- 40.1. 概述
- 40.2. PL/pgSQL的結構
- 40.3. 聲明
- 40.4. 表達式
- 40.5. 基本語句
- 40.6. 控制結構
- 40.7. 游標
- 40.8. 錯誤和消息
- 40.9. 觸發器過程
- 40.10. 在后臺下的PL/pgSQL
- 40.11. 開發PL/pgSQL的一些提示
- 40.12. 從Oracle PL/SQL進行移植
- Chapter 41. PL/Tcl - Tcl 過程語言
- 41.1. 概述
- 41.2. PL/Tcl 函數和參數
- 41.3. PL/Tcl里的數據值
- 41.4. PL/Tcl里的全局量
- 41.5. 在PL/Tcl里訪問數據庫
- 41.6. PL/Tcl里的觸發器過程
- 41.7. 模塊和unknown的命令
- 41.8. Tcl 過程名字
- Chapter 42. PL/Perl - Perl 過程語言
- 42.1. PL/Perl 函數和參數
- 42.2. PL/Perl里的數據值
- 42.3. 內置函數
- 42.4. PL/Perl里的全局變量
- 42.5. 可信的和不可信的 PL/Perl
- 42.6. PL/Perl 觸發器
- 42.7. 后臺PL/Perl
- Chapter 43. PL/Python - Python 過程語言
- 43.1. Python 2 vs. Python 3
- 43.2. PL/Python Functions
- 43.3. Data Values
- 43.4. Sharing Data
- 43.5. Anonymous Code Blocks
- 43.6. Trigger Functions
- 43.7. Database Access
- 43.8. Explicit Subtransactions
- 43.9. Utility Functions
- 43.10. Environment Variables
- Chapter 44. 服務器編程接口
- 44.1. 接口函數
- SPI_connect
- SPI_finish
- SPI_push
- SPI_pop
- SPI_execute
- SPI_exec
- SPI_execute_with_args
- SPI_prepare
- SPI_prepare_cursor
- SPI_prepare_params
- SPI_getargcount
- SPI_getargtypeid
- SPI_is_cursor_plan
- SPI_execute_plan
- SPI_execute_plan_with_paramlist
- SPI_execp
- SPI_cursor_open
- SPI_cursor_open_with_args
- SPI_cursor_open_with_paramlist
- SPI_cursor_find
- SPI_cursor_fetch
- SPI_cursor_move
- SPI_scroll_cursor_fetch
- SPI_scroll_cursor_move
- SPI_cursor_close
- SPI_keepplan
- SPI_saveplan
- 44.2. 接口支持函數
- SPI_fname
- SPI_fnumber
- SPI_getvalue
- SPI_getbinval
- SPI_gettype
- SPI_gettypeid
- SPI_getrelname
- SPI_getnspname
- 44.3. 內存管理
- SPI_palloc
- SPI_repalloc
- SPI_pfree
- SPI_copytuple
- SPI_returntuple
- SPI_modifytuple
- SPI_freetuple
- SPI_freetuptable
- SPI_freeplan
- 44.4. 數據改變的可視性
- 44.5. 例子
- Chapter 45. 后臺工作進程
- VI. 參考手冊
- I. SQL 命令
- ABORT
- ALTER AGGREGATE
- ALTER COLLATION
- ALTER CONVERSION
- ALTER DATABASE
- ALTER DEFAULT PRIVILEGES
- ALTER DOMAIN
- ALTER EXTENSION
- ALTER EVENT TRIGGER
- ALTER FOREIGN DATA WRAPPER
- ALTER FOREIGN TABLE
- ALTER FUNCTION
- ALTER GROUP
- ALTER INDEX
- ALTER LANGUAGE
- ALTER LARGE OBJECT
- ALTER MATERIALIZED VIEW
- ALTER OPERATOR
- ALTER OPERATOR CLASS
- ALTER OPERATOR FAMILY
- ALTER ROLE
- ALTER RULE
- ALTER SCHEMA
- ALTER SEQUENCE
- ALTER SERVER
- ALTER TABLE
- ALTER TABLESPACE
- ALTER TEXT SEARCH CONFIGURATION
- ALTER TEXT SEARCH DICTIONARY
- ALTER TEXT SEARCH PARSER
- ALTER TEXT SEARCH TEMPLATE
- ALTER TRIGGER
- ALTER TYPE
- ALTER USER
- ALTER USER MAPPING
- ALTER VIEW
- ANALYZE
- BEGIN
- CHECKPOINT
- CLOSE
- CLUSTER
- COMMENT
- COMMIT
- COMMIT PREPARED
- COPY
- CREATE AGGREGATE
- CREATE CAST
- CREATE COLLATION
- CREATE CONVERSION
- CREATE DATABASE
- CREATE DOMAIN
- CREATE EXTENSION
- CREATE EVENT TRIGGER
- CREATE FOREIGN DATA WRAPPER
- CREATE FOREIGN TABLE
- CREATE FUNCTION
- CREATE GROUP
- CREATE INDEX
- CREATE LANGUAGE
- CREATE MATERIALIZED VIEW
- CREATE OPERATOR
- CREATE OPERATOR CLASS
- CREATE OPERATOR FAMILY
- CREATE ROLE
- CREATE RULE
- CREATE SCHEMA
- CREATE SEQUENCE
- CREATE SERVER
- CREATE TABLE
- CREATE TABLE AS
- CREATE TABLESPACE
- CREATE TEXT SEARCH CONFIGURATION
- CREATE TEXT SEARCH DICTIONARY
- CREATE TEXT SEARCH PARSER
- CREATE TEXT SEARCH TEMPLATE
- CREATE TRIGGER
- CREATE TYPE
- CREATE USER
- CREATE USER MAPPING
- CREATE VIEW
- DEALLOCATE
- DECLARE
- DELETE
- DISCARD
- DO
- DROP AGGREGATE
- DROP CAST
- DROP COLLATION
- DROP CONVERSION
- DROP DATABASE
- DROP DOMAIN
- DROP EXTENSION
- DROP EVENT TRIGGER
- DROP FOREIGN DATA WRAPPER
- DROP FOREIGN TABLE
- DROP FUNCTION
- DROP GROUP
- DROP INDEX
- DROP LANGUAGE
- DROP MATERIALIZED VIEW
- DROP OPERATOR
- DROP OPERATOR CLASS
- DROP OPERATOR FAMILY
- DROP OWNED
- DROP ROLE
- DROP RULE
- DROP SCHEMA
- DROP SEQUENCE
- DROP SERVER
- DROP TABLE
- DROP TABLESPACE
- DROP TEXT SEARCH CONFIGURATION
- DROP TEXT SEARCH DICTIONARY
- DROP TEXT SEARCH PARSER
- DROP TEXT SEARCH TEMPLATE
- DROP TRIGGER
- DROP TYPE
- DROP USER
- DROP USER MAPPING
- DROP VIEW
- END
- EXECUTE
- EXPLAIN
- FETCH
- GRANT
- INSERT
- LISTEN
- LOAD
- LOCK
- MOVE
- NOTIFY
- PREPARE
- PREPARE TRANSACTION
- REASSIGN OWNED
- REFRESH MATERIALIZED VIEW
- REINDEX
- RELEASE SAVEPOINT
- RESET
- REVOKE
- ROLLBACK
- ROLLBACK PREPARED
- ROLLBACK TO SAVEPOINT
- SAVEPOINT
- SECURITY LABEL
- SELECT
- SELECT INTO
- SET
- SET CONSTRAINTS
- SET ROLE
- SET SESSION AUTHORIZATION
- SET TRANSACTION
- SHOW
- START TRANSACTION
- TRUNCATE
- UNLISTEN
- UPDATE
- VACUUM
- VALUES
- II. PostgreSQL 客戶端應用程序
- clusterdb
- createdb
- createlang
- createuser
- dropdb
- droplang
- dropuser
- ecpg
- pg_basebackup
- pg_config
- pg_dump
- pg_dumpall
- pg_isready
- pg_receivexlog
- pg_restore
- psql
- reindexdb
- vacuumdb
- III. PostgreSQL 服務器應用程序
- initdb
- pg_controldata
- pg_ctl
- pg_resetxlog
- postgres
- postmaster
- VII. 內部
- Chapter 46. PostgreSQL內部概述
- 46.1. 查詢經過的路徑
- 46.2. 連接是如何建立起來的
- 46.3. 分析器階段
- 46.4. PostgreSQL規則系統
- 46.5. 規劃器/優化器
- 46.6. 執行器
- Chapter 47. 系統表
- 47.1. 概述
- 47.2. pg_aggregate
- 47.3. pg_am
- 47.4. pg_amop
- 47.5. pg_amproc
- 47.6. pg_attrdef
- 47.7. pg_attribute
- 47.8. pg_authid
- 47.9. pg_auth_members
- 47.10. pg_cast
- 47.11. pg_class
- 47.12. pg_event_trigger
- 47.13. pg_constraint
- 47.14. pg_collation
- 47.15. pg_conversion
- 47.16. pg_database
- 47.17. pg_db_role_setting
- 47.18. pg_default_acl
- 47.19. pg_depend
- 47.20. pg_description
- 47.21. pg_enum
- 47.22. pg_extension
- 47.23. pg_foreign_data_wrapper
- 47.24. pg_foreign_server
- 47.25. pg_foreign_table
- 47.26. pg_index
- 47.27. pg_inherits
- 47.28. pg_language
- 47.29. pg_largeobject
- 47.30. pg_largeobject_metadata
- 47.31. pg_namespace
- 47.32. pg_opclass
- 47.33. pg_operator
- 47.34. pg_opfamily
- 47.35. pg_pltemplate
- 47.36. pg_proc
- 47.37. pg_range
- 47.38. pg_rewrite
- 47.39. pg_seclabel
- 47.40. pg_shdepend
- 47.41. pg_shdescription
- 47.42. pg_shseclabel
- 47.43. pg_statistic
- 47.44. pg_tablespace
- 47.45. pg_trigger
- 47.46. pg_ts_config
- 47.47. pg_ts_config_map
- 47.48. pg_ts_dict
- 47.49. pg_ts_parser
- 47.50. pg_ts_template
- 47.51. pg_type
- 47.52. pg_user_mapping
- 47.53. 系統視圖
- 47.54. pg_available_extensions
- 47.55. pg_available_extension_versions
- 47.56. pg_cursors
- 47.57. pg_group
- 47.58. pg_indexes
- 47.59. pg_locks
- 47.60. pg_matviews
- 47.61. pg_prepared_statements
- 47.62. pg_prepared_xacts
- 47.63. pg_roles
- 47.64. pg_rules
- 47.65. pg_seclabels
- 47.66. pg_settings
- 47.67. pg_shadow
- 47.68. pg_stats
- 47.69. pg_tables
- 47.70. pg_timezone_abbrevs
- 47.71. pg_timezone_names
- 47.72. pg_user
- 47.73. pg_user_mappings
- 47.74. pg_views
- Chapter 48. 前/后端協議
- 48.1. 概要
- 48.2. 消息流
- 48.3. 流復制協議
- 48.4. 消息數據類型
- 48.5. 消息格式
- 48.6. 錯誤和通知消息字段
- 48.7. 自協議 2.0 以來的變化的概述
- Chapter 49. PostgreSQL 編碼約定
- 49.1. 格式
- 49.2. 報告服務器里的錯誤
- 49.3. 錯誤消息風格指導
- Chapter 50. 本地語言支持
- 50.1. 寄語翻譯家
- 50.2. 寄語程序員
- Chapter 51. 書寫一個過程語言處理器
- Chapter 52. 寫一個外數據包
- 52.1. 外數據封裝函數
- 52.2. 外數據封裝回調程序
- 52.3. 外數據封裝輔助函數
- 52.4. 外數據封裝查詢規劃
- Chapter 53. 基因查詢優化器
- 53.1. 作為復雜優化問題的查詢處理
- 53.2. 基因算法
- 53.3. PostgreSQL 里的基因查詢優化(GEQO)
- 53.4. 進一步閱讀
- Chapter 54. 索引訪問方法接口定義
- 54.1. 索引的系統表記錄
- 54.2. 索引訪問方法函數
- 54.3. 索引掃描
- 54.4. 索引鎖的考量
- 54.5. 索引唯一性檢查
- 54.6. 索引開銷估計函數
- Chapter 55. GiST索引
- 55.1. 介紹
- 55.2. 擴展性
- 55.3. 實現
- 55.4. 例
- Chapter 56. SP-GiST索引
- 56.1. 介紹
- 56.2. 擴展性
- 56.3. 實現
- 56.4. 例
- Chapter 57. GIN索引
- 57.1. 介紹
- 57.2. 擴展性
- 57.3. 實現
- 57.4. GIN提示與技巧
- 57.5. 限制
- 57.6. 例子
- Chapter 58. 數據庫物理存儲
- 58.1. 數據庫文件布局
- 58.2. TOAST
- 58.3. 自由空間映射
- 58.4. 可見映射
- 58.5. 初始化分支
- 58.6. 數據庫分頁文件
- Chapter 59. BKI后端接口
- 59.1. BKI 文件格式
- 59.2. BKI 命令
- 59.3. 系統初始化的BKI文件的結構
- 59.4. 例子
- Chapter 60. 規劃器如何使用統計信息
- 60.1. 行預期的例子
- VIII. 附錄
- Appendix A. PostgreSQL 錯誤代碼
- Appendix B. 日期/時間支持
- B.1. 日期/時間輸入解析
- B.2. 日期/時間關鍵字
- B.3. 日期/時間配置文件
- B.4. 單位歷史
- Appendix C. SQL關鍵字
- Appendix D. SQL兼容性
- D.1. 支持的特性
- D.2. 不支持的特性
- Appendix E. 版本說明
- E.1. 版本 9.3.1
- E.2. 版本 9.3
- E.3. 版本9.2.5
- E.4. 版本9.2.4
- E.5. 版本9.2.3
- E.6. 版本9.2.2
- E.7. 版本9.2.1
- E.8. 版本9.2
- E.9. 發布9.1.10
- E.10. 發布9.1.9
- E.11. 發布9.1.8
- E.12. 發布9.1.7
- E.13. 發布9.1.6
- E.14. 發布9.1.5
- E.15. 發布9.1.4
- E.16. 發布9.1.3
- E.17. 發布9.1.2
- E.18. 發布9.1.1
- E.19. 發布9.1
- E.20. 版本 9.0.14
- E.21. 版本 9.0.13
- E.22. 版本 9.0.12
- E.23. 版本 9.0.11
- E.24. 版本 9.0.10
- E.25. 版本 9.0.9
- E.26. 版本 9.0.8
- E.27. 版本 9.0.7
- E.28. 版本 9.0.6
- E.29. 版本 9.0.5
- E.30. 版本 9.0.4
- E.31. 版本 9.0.3
- E.32. 版本 9.0.2
- E.33. 版本 9.0.1
- E.34. 版本 9.0
- E.35. 發布8.4.18
- E.36. 發布8.4.17
- E.37. 發布8.4.16
- E.38. 發布8.4.15
- E.39. 發布8.4.14
- E.40. 發布8.4.13
- E.41. 發布8.4.12
- E.42. 發布8.4.11
- E.43. 發布8.4.10
- E.44. 發布8.4.9
- E.45. 發布8.4.8
- E.46. 發布8.4.7
- E.47. 發布8.4.6
- E.48. 發布8.4.5
- E.49. 發布8.4.4
- E.50. 發布8.4.3
- E.51. 發布8.4.2
- E.52. 發布8.4.1
- E.53. 發布8.4
- E.54. 發布8.3.23
- E.55. 發布8.3.22
- E.56. 發布8.3.21
- E.57. 發布8.3.20
- E.58. 發布8.3.19
- E.59. 發布8.3.18
- E.60. 發布8.3.17
- E.61. 發布8.3.16
- E.62. 發布8.3.15
- E.63. 發布8.3.14
- E.64. 發布8.3.13
- E.65. 發布8.3.12
- E.66. 發布8.3.11
- E.67. 發布8.3.10
- E.68. 發布8.3.9
- E.69. 發布8.3.8
- E.70. 發布8.3.7
- E.71. 發布8.3.6
- E.72. 發布8.3.5
- E.73. 發布8.3.4
- E.74. 發布8.3.3
- E.75. 發布8.3.2
- E.76. 發布8.3.1
- E.77. 發布8.3
- E.78. 版本 8.2.23
- E.79. 版本 8.2.22
- E.80. 版本 8.2.21
- E.81. 版本 8.2.20
- E.82. 版本 8.2.19
- E.83. 版本 8.2.18
- E.84. 版本 8.2.17
- E.85. 版本 8.2.16
- E.86. 版本 8.2.15
- E.87. 版本 8.2.14
- E.88. 版本 8.2.13
- E.89. 版本 8.2.12
- E.90. 版本 8.2.11
- E.91. 版本 8.2.10
- E.92. 版本 8.2.9
- E.93. 版本 8.2.8
- E.94. 版本 8.2.7
- E.95. 版本 8.2.6
- E.96. 版本 8.2.5
- E.97. 版本 8.2.4
- E.98. 版本 8.2.3
- E.99. 版本 8.2.2
- E.100. 版本 8.2.1
- E.101. 版本 8.2
- E.102. 版本 8.1.23
- E.103. 版本 8.1.22
- E.104. 版本 8.1.21
- E.105. 版本 8.1.20
- E.106. 版本 8.1.19
- E.107. 版本 8.1.18
- E.108. 版本 8.1.17
- E.109. 版本 8.1.16
- E.110. 版本 8.1.5
- E.111. 版本 8.1.14
- E.112. 版本 8.1.13
- E.113. 版本 8.1.12
- E.114. 版本 8.1.11
- E.115. 版本 8.1.10
- E.116. 版本 8.1.9
- E.117. 版本 8.1.8
- E.118. 版本 8.1.7
- E.119. 版本 8.1.6
- E.120. 版本 8.1.5
- E.121. 版本 8.1.4
- E.122. 版本 8.1.3
- E.123. 版本 8.1.2
- E.124. 版本 8.1.1
- E.125. 版本 8.1
- E.126. 版本 8.0.26
- E.127. 版本 8.0.25
- E.128. 版本 8.0.24
- E.129. 版本 8.0.23
- E.130. 版本 8.0.22
- E.131. 版本 8.0.21
- E.132. 版本 8.0.20
- E.133. 版本 8.0.19
- E.134. 版本 8.0.18
- E.135. 版本 8.0.17
- E.136. 版本 8.0.16
- E.137. 版本 8.0.15
- E.138. 版本 8.0.14
- E.139. 版本 8.0.13
- E.140. 版本 8.0.12
- E.141. 版本 8.0.11
- E.142. 版本 8.0.10
- E.143. 版本 8.0.9
- E.144. 版本 8.0.8
- E.145. 版本 8.0.7
- E.146. 版本 8.0.6
- E.147. 版本 8.0.5
- E.148. 版本 8.0.4
- E.149. 版本 8.0.3
- E.150. 版本 8.0.2
- E.151. 版本 8.0.1
- E.152. 版本 8.0.0
- E.153. 版本 7.4.30
- E.154. 版本 7.4.29
- E.155. 版本 7.4.28
- E.156. 版本 7.4.27
- E.157. 版本 7.4.26
- E.158. 版本 7.4.25
- E.159. 版本 7.4.24
- E.160. 版本 7.4.23
- E.161. 版本 7.4.22
- E.162. 版本 7.4.21
- E.163. 版本 7.4.20
- E.164. 版本 7.4.19
- E.165. 版本 7.4.18
- E.166. 版本 7.4.17
- E.167. 版本 7.4.16
- E.168. 版本 7.4.15
- E.169. 版本 7.4.14
- E.170. 版本 7.4.13
- E.171. 版本 7.4.12
- E.172. 版本 7.4.11
- E.173. 版本 7.4.10
- E.174. 版本 7.4.9
- E.175. 版本 7.4.8
- E.176. 版本 7.4.7
- E.177. 版本 7.4.6
- E.178. 版本 7.4.3
- E.179. 版本 7.4.4
- E.180. 版本 7.4.3
- E.181. 版本 7.4.2
- E.182. 版本 7.4.1
- E.183. 版本 7.4
- E.184. 版本 7.3.21
- E.185. 版本 7.3.20
- E.186. 版本 7.3.19
- E.187. 版本 7.3.18
- E.188. 版本 7.3.17
- E.189. 版本 7.3.16
- E.190. 版本 7.3.15
- E.191. 版本 7.3.14
- E.192. 版本 7.3.13
- E.193. 版本 7.3.12
- E.194. 版本 7.3.11
- E.195. 版本 7.3.10
- E.196. 版本 7.3.9
- E.197. 版本 7.3.8
- E.198. 版本 7.3.7
- E.199. 版本 7.3.6
- E.200. 版本 7.3.5
- E.201. 版本 7.3.4
- E.202. 版本 7.3.3
- E.203. 版本 7.3.2
- E.204. 版本 7.3.1
- E.205. 版本 7.3
- E.206. 版本 7.2.8
- E.207. 版本 7.2.7
- E.208. 版本 7.2.6
- E.209. 版本 7.2.5
- E.210. 版本 7.2.4
- E.211. 版本 7.2.3
- E.212. 版本 7.2.2
- E.213. 版本 7.2.1
- E.214. 版本 7.2
- E.215. 版本 7.1.3
- E.216. 版本 7.1.2
- E.217. 版本 7.1.1
- E.218. 版本 7.1
- E.219. 版本 7.0.3
- E.220. 版本 7.0.2
- E.221. 版本 7.0.1
- E.222. 版本 7.0
- E.223. 版本 6.5.3
- E.224. 版本 6.5.2
- E.225. 版本 6.5.1
- E.226. 版本 6.5
- E.227. 版本 6.4.2
- E.228. 版本 6.4.1
- E.229. 版本 6.4
- E.230. 版本 6.3.2
- E.231. 版本 6.3.1
- E.232. 版本 6.3
- E.233. 版本 6.2.1
- E.234. 版本 6.2
- E.235. 版本 6.1.1
- E.236. 版本 6.1
- E.237. 版本 6.0
- E.238. 版本 1.09
- E.239. 版本 1.02
- E.240. 版本 1.01
- E.241. 版本 1.0
- E.242. Postgres95 版本 0.03
- E.243. Postgres95 版本 0.02
- E.244. Postgres95 版本 0.01
- Appendix F. 額外提供的模塊
- F.1. adminpack
- F.2. auth_delay
- F.3. auto_explain
- F.4. btree_gin
- F.5. btree_gist
- F.6. chkpass
- F.7. citext
- F.8. cube
- F.9. dblink
- dblink_connect
- dblink_connect_u
- dblink_disconnect
- dblink
- dblink_exec
- dblink_open
- dblink_fetch
- dblink_close
- dblink_get_connections
- dblink_error_message
- dblink_send_query
- dblink_is_busy
- dblink_get_notify
- dblink_get_result
- dblink_cancel_query
- dblink_get_pkey
- dblink_build_sql_insert
- dblink_build_sql_delete
- dblink_build_sql_update
- F.10. dict_int
- F.11. dict_xsyn
- F.12. dummy_seclabel
- F.13. earthdistance
- F.14. file_fdw
- F.15. fuzzystrmatch
- F.16. hstore
- F.17. intagg
- F.18. intarray
- F.19. isn
- F.20. lo
- F.21. ltree
- F.22. pageinspect
- F.23. passwordcheck
- F.24. pg_buffercache
- F.25. pgcrypto
- F.26. pg_freespacemap
- F.27. pgrowlocks
- F.28. pg_stat_statements
- F.29. pgstattuple
- F.30. pg_trgm
- F.31. postgres_fdw
- F.32. seg
- F.33. sepgsql
- F.34. spi
- F.35. sslinfo
- F.36. tablefunc
- F.37. tcn
- F.38. test_parser
- F.39. tsearch2
- F.40. unaccent
- F.41. uuid-ossp
- F.42. xml2
- Appendix G. 額外提供的程序
- G.1. 客戶端應用程序
- oid2name
- pgbench
- vacuumlo
- G.2. 服務器端應用程序
- pg_archivecleanup
- pg_standby
- pg_test_fsync
- pg_test_timing
- pg_upgrade
- pg_xlogdump
- Appendix H. 外部項目
- H.1. 客戶端接口
- H.2. 管理工具
- H.3. 過程語言
- H.4. 擴展
- Appendix I. 源代碼庫
- I.1. 獲得源代碼通過Git
- Appendix J. 文檔
- J.1. DocBook
- J.2. 工具集
- J.3. 制作文檔
- J.4. 文檔寫作
- J.5. 風格指導
- Appendix K. 首字母縮略詞
- 參考書目
- Index