Skip to main content

Extension

The extensions available in KakaoCloud PostgreSQL are provided for server management and monitoring within the database.

info

All extensions available in the template1 database are registered in KakaoCloud PostgreSQL by default.
When creating a new database, all extensions are immediately available without requiring a database restart for specific extensions.

info

For more detailed information about extensions, please refer to the PostgreSQL Additional Supplied Modules and Extensions.

Supported extension list

NameDescription
adminpackProvides extended administrative features for managing and monitoring PostgreSQL servers. Includes functions for file settings, log directory listing, file read/write operations, and more. Useful for debugging and system analysis.
amcheckVerifies the consistency of database indexes, particularly B-Tree indexes. Helps identify potential corruption and ensures data integrity and performance.
autoincSupports auto-increment columns for PostgreSQL tables, generating unique values automatically when new rows are inserted.
bloomImplements Bloom filter indexes for efficient searching in large datasets. Useful for space-efficient probabilistic data checks, providing fast lookups with minimal storage.
intarrayProvides advanced functions and operators for manipulating integer arrays. Ideal for applications handling large sets of integer data stored as arrays.
btree_ginCombines B-Tree and GIN indexing capabilities for efficient indexing of complex data types like arrays, JSONB, and Hstore.
btree_gistEnhances GiST indexing by supporting B-Tree operators, offering combined benefits of space efficiency and sorting functionality.
citextCase-insensitive text type for PostgreSQL, simplifying text comparisons and searches, especially for use cases like user names or email addresses.
cubeHandles multidimensional data for geometric and spatial applications. Useful in data analysis and geographic data storage.
dblinkFacilitates connections to and queries from external PostgreSQL databases, enabling distributed database operations.
dict_xsynEnhances text search by supporting synonyms, improving search accuracy and consistency for text-based applications.
dict_intProvides integer dictionaries for PostgreSQL text search, enhancing token normalization and text processing.
earthdistanceCalculates distances between geographical coordinates. Useful for GIS, mapping applications, and location-based services.
file_fdwTreats external files (e.g., CSV) as foreign tables, simplifying data integration and processing within PostgreSQL.
fuzzystrmatchProvides string matching algorithms for detecting typos and similar strings, enhancing text cleaning and search functionalities.
hstoreStores key-value pairs efficiently, supporting flexible data structures for applications like logs and attribute storage.
pg_buffercacheMonitors the shared buffer cache, offering insights for database performance optimization.
pgcryptoOffers cryptographic functions for secure data storage and processing, including hashing and encryption algorithms.
pgvectorEfficiently stores and queries high-dimensional vector data, suitable for applications like machine learning and similarity searches.
pg_cronSchedules and automates maintenance tasks directly within the database using a cron-based scheduler.
pgrowlocksDisplays row-level lock information, helping diagnose and resolve database locking issues.
pgstattupleAnalyzes table and index space usage, including live rows, dead tuples, and free space, aiding database optimization.
plperlEnables writing PostgreSQL functions in Perl, useful for text processing and regular expression-based transformations.
plpgsqlPostgreSQL's built-in procedural language combines SQL with procedural constructs, allowing complex database logic.
plprofilerProfiles PL/pgSQL functions, identifying performance bottlenecks and aiding in function optimization.
plpython3uSupports writing PostgreSQL functions in Python 3, ideal for leveraging Python libraries within the database.
postgres_fdwFacilitates querying and manipulating remote PostgreSQL tables as if they were local, supporting distributed databases.
uuid-osspGenerates universally unique identifiers (UUIDs), suitable for primary keys or unique identifiers in distributed systems.
pg_visibilityProvides visibility information for table pages and rows, aiding database tuning and problem diagnosis.
intaggAggregates multiple integers into an array, streamlining complex aggregation and data analysis tasks.
hypopgSupports hypothetical indexes for evaluating query performance impact without actual index creation.
pg_freespacemapMonitors free space map data, optimizing space utilization in tables and indexes.
pgauditEnhances audit logging, recording SQL statements for security compliance and troubleshooting.
pg_stat_kcacheCollects kernel-level performance metrics for queries, aiding in advanced performance monitoring.
pg_logicalSupports logical replication for PostgreSQL, enabling fine-grained replication of database changes.
pageinspectInspects internal page structure of database objects, useful for in-depth troubleshooting and performance tuning.
loManages large objects (LOBs) like images and videos, facilitating efficient storage and retrieval of large data files.
ltreeManages hierarchical data, enabling efficient queries for tree structures like file systems and organizational charts.
jsonb_plperlSimplifies JSONB data manipulation in Perl functions, combining PostgreSQL's JSON capabilities with Perl's text processing.
unaccentRemoves accents from text, improving search and comparison accuracy for multi-language datasets.
hstore_plperlIntegrates hstore with Perl functions, enabling advanced key-value pair manipulation using Perl.
hstore_plperluCombines the hstore data type with untrusted Perl language (plperlu) for flexible data manipulation. plperlu provides enhanced functionality but requires careful handling due to potential security risks.
hypopgAllows hypothetical index creation to evaluate query performance impacts without actually creating indexes, aiding in performance tuning and index design.
insert_usernameAutomatically records the current user's name when rows are inserted or updated. Useful for data auditing and tracking changes.
intaggAggregates integer values into arrays, simplifying data aggregation and analysis.
intarrayProvides functions and operators for advanced manipulation of integer arrays, suitable for applications with large integer datasets.
isnHandles international standard numbers like ISBN, ISMN, and ISSN for storage, validation, and formatting.
jsonb_plperlSimplifies manipulation of JSONB data using Perl functions, leveraging PostgreSQL's JSON capabilities with Perl's text processing strengths.
jsonb_plperluExtends JSONB data manipulation in PostgreSQL using plperlu for more advanced operations while cautioning against potential security risks.
jsonb_plpython3uEnables JSONB data handling in Python 3 functions within PostgreSQL, offering flexibility and power for advanced JSON processing.
loManages large objects (LOBs), such as images and videos, enabling efficient storage and retrieval of binary data.
ltreeSupports hierarchical data management and querying, useful for tree-structured data like file systems or organizational charts.
ltree_plpython3uIntegrates the ltree data type with Python 3, enabling hierarchical data manipulation within Python functions in PostgreSQL.
moddatetimeAutomatically updates timestamps for rows when they are inserted or modified, aiding in change tracking and auditing.
old_snapshotMonitors and manages long-held snapshots to address performance and locking issues, particularly for long-running queries.
orafceAdds Oracle compatibility features to PostgreSQL, facilitating database migration and compatibility with Oracle-specific functionality.
pageinspectProvides detailed insights into PostgreSQL's internal page structures, aiding in performance tuning and troubleshooting.
pg_buffercacheMonitors shared buffer cache state, offering insights for optimizing database performance.
pg_freespacemapMonitors free space map usage, aiding in space optimization for tables and indexes.
pgauditEnhances audit logging for PostgreSQL, providing detailed SQL activity records for compliance and security.
pgcryptoOffers cryptographic functions for secure data storage, including hashing and encryption utilities.
pgrowlocksDisplays row-level lock information, assisting in diagnosing and resolving locking issues.
pgstattupleAnalyzes table and index space usage, providing detailed statistics for optimization.
pg_stat_kcacheCollects kernel-level performance metrics for query execution, aiding in advanced performance monitoring.
pg_visibilityExamines table and row visibility to optimize usage and identify dead tuples.
plperlAllows writing PostgreSQL functions in Perl, particularly useful for text processing and transformations.
plpgsqlCombines SQL and procedural logic for complex database operations within PostgreSQL.
plprofilerProfiles PL/pgSQL functions to identify bottlenecks and optimize performance.
plpython3uEnables Python 3-based procedural programming within PostgreSQL, supporting advanced logic in user-defined functions.
plpythonuUses Python 2 for procedural programming within PostgreSQL; recommended to use plpython3u due to Python 2's end of life.
postgres_fdwEnables querying and manipulation of remote PostgreSQL tables as if they were local, supporting distributed database setups.
refintProvides triggers to manage referential integrity between related tables, ensuring consistent relationships.
segHandles segment data types for geometric and spatial applications.
sslinfoOffers SSL connection details, aiding in monitoring and securing database connections.
tablefuncProvides advanced table manipulation functions, including crosstabs and hierarchical sorting.
tcnSends notifications for table changes, supporting real-time monitoring and responsive applications.
tsm_system_rowsSamples a fixed number of rows from tables for analysis and testing.
tsm_system_timeSamples rows from tables based on a specified time frame for analysis and testing.
unaccentRemoves accents from text for easier comparison and searching across languages.
uuid-osspGenerates UUIDs for use as unique identifiers in distributed systems.
pgvectorEfficiently stores and queries high-dimensional vector data for applications like machine learning and similarity searches.
pg_cronImplements a cron-based scheduler for database maintenance and automation tasks within PostgreSQL.

Extension details

postgres_fdw

postgres_fdw is a foreign data wrapper (FDW) provided by PostgreSQL that enables access to remote PostgreSQL database tables as if they were local tables. This functionality supports creating external tables referencing remote databases within the local database.
To use postgres_fdw provided by KakaoCloud, you must use the create_fdw_server procedure. This procedure is pre-created in the template1 database, ensuring availability in newly created databases.

To create a remote server using the procedure, follow these steps. Upon execution, the user account is automatically mapped, allowing external tables to be created and used.

  1. Create a database using an administrator or user account with database creation privileges.
  2. Ensure that the security group for the target database has the outbound rule (port open) configured.
  3. In the created database, use the create_fdw_server procedure to create a server for performing FDW operations.
  4. Query the external database.
postgres_fdw usage example
# [Create FDW server and connect user information]
SELECT * FROM create_fdw_server(
'fdw_server', -- Server name
'pg_endpoint', -- External database endpoint
'foreign_database', -- External database name
5432, -- External database connection port (numeric format)
'test_database', -- User database to query the external database
'admin', -- User account ID
'foreign_admin', -- External database account ID
'foreign_pass' -- External database account password
);

# Example:
SELECT * FROM create_fdw_server(
'db_nameserver',
'db_name-pg-001.csnzphcqgi72.ap-northeast-2.rds.amazonaws.com',
'postgres',
5432,
'grey',
'admin',
'remote_user',
'remote_password'
);

# [Querying external database]
# Example query for a server created through create_fdw_server
SELECT srvname, srvtype, srvversion, srvoptions FROM pg_foreign_server;

# Example of mapping a remote table:
CREATE FOREIGN TABLE remote_table (
id SERIAL,
name TEXT,
value NUMERIC
)
SERVER fdw_server_example -- FDW server name
OPTIONS (schema_name 'public', table_name 'remote_table_name');

pg_cron

pg_cron is an extension that enables cron-based job scheduling to enhance database maintenance and operational efficiency. In KakaoCloud, the default database postgres includes pg_cron, and the time zone for pg_cron is set to UTC±00:00.
When using pg_cron, the timezone is set to UTC±00:00.

Below are examples and procedures for using pg_cron:

  1. Access the postgres database where pg_cron is configured.
  2. Register a schedule in cron format.
  3. Verify if the cron job executed at the scheduled time.
  4. Delete the schedule.
pg_cron usage example
postgres=# \c postgres {Administrator/UserID}
You are now connected to database "postgres" as user "{Administrator/UserID}".

# Register a schedule: Create a schedule named 'weekly-vacuum' to run the VACUUM function on the 'test_database' every day at 4 AM (UTC)
postgres=> SELECT cron.schedule_in_database('weekly-vacuum', '* 4 * * *', 'VACUUM', 'test_database');

# View schedules
postgres=> SELECT * FROM cron.job;
jobid | schedule | command | nodename | nodeport | database | username | active | jobname
-------+-------------+---------+-----------+----------+----------+----------+--------+------------------
1 | 5 20 * * * | VACUUM | localhost | 5432 | db_name | admin | t | weekly-vacuum

# Check schedule execution details
postgres=> SELECT * FROM cron.job_run_details;
jobid | runid | job_pid | database | username | command | status | return_message | start_time | end_time
-------+-------+---------+----------+----------+---------+-----------+----------------+-------------------------------+---------------------
8 | 1 | 379928 | db_name | postgres | VACUUM | succeeded | VACUUM | 2024-11-11 11:01:00.066025+00 | 2024-11-11 11:01:05.821539+00
(1 row)

# Remove a schedule
postgres=> SELECT cron.unschedule('weekly-vacuum');
unschedule
------------
t
(1 row)