You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently found out about pg_readme extension, and I tried to generate a documentation for Citus extension using it. This gist is an inital dump on what we can accomplish using this tool.
The pg_readme PostgreSQL extension provides functions to generate
a README.md document for a database extension or schema, based on
COMMENT objects
found in the
pg_description
system catalog.
My steps to generate these files
I generated 2 different markdown files for the last release as of today (Citus 11.1), and the one we aim to release this week (Citus 11.2). Apart from these 2, I also created a diff that might be handy to show what changed between these 2 releases.
I created a new cluster with Citus and pg_readme installed.
I updated the comment on Citus extension to contain the necessary template for pg_readme.
COMMENT ON EXTENSION citus IS $markdown$
# Citus distributed database #<?pg-readme-reference?>
$markdown$;
I generated the markdown documentation using the following shell command:
SELECTpartitions.partrelidAS parent_table,
partitions.attnameAS partition_column, partitions.relidAS partition,
partitions.lower_boundAS from_value, partitions.upper_boundAS to_value,
partitions.amnameAS access_method
FROM ( SELECTp.partrelid::regclass AS partrelid, a.attname,
c.oid::regclass AS relid, time_partition_range.lower_bound,
time_partition_range.upper_bound, am.amnameFROM pg_class c
JOIN pg_inherits i ONc.oid=i.inhrelidJOIN pg_partitioned_table p ONi.inhparent=p.partrelidJOIN pg_attribute a ONp.partrelid=a.attrelidJOIN pg_type t ONa.atttypid=t.oidJOIN pg_namespace tn ONt.typnamespace=tn.oidLEFT JOIN pg_am am ONc.relam=am.oid,
LATERAL time_partition_range(c.oid::regclass) time_partition_range(lower_bound, upper_bound)
WHEREc.relpartboundIS NOT NULLANDp.partstrat='r'::"char"ANDp.partnatts=1AND (a.attnum= ANY (p.partattrs::smallint[]))) partitions
ORDER BY (partitions.partrelid::text), partitions.lower_bound;
View: citus_shards
SELECTpg_dist_shard.logicalrelidAS table_name, pg_dist_shard.shardid,
shard_name(pg_dist_shard.logicalrelid, pg_dist_shard.shardid) AS shard_name,
CASE
WHEN pg_dist_partition.partkeyIS NOT NULL THEN 'distributed'::text
WHEN pg_dist_partition.repmodel='t'::"char" THEN 'reference'::text
ELSE 'local'::text
END AS citus_table_type,
pg_dist_partition.colocationidAS colocation_id, pg_dist_node.nodename,
pg_dist_node.nodeport, shard_sizes.sizeAS shard_size
FROM pg_dist_shard
JOIN pg_dist_placement ONpg_dist_shard.shardid=pg_dist_placement.shardidJOIN pg_dist_node ONpg_dist_placement.groupid=pg_dist_node.groupidJOIN pg_dist_partition ONpg_dist_partition.logicalrelid::oid=pg_dist_shard.logicalrelid::oidLEFT JOIN ( SELECT (regexp_matches(citus_shard_sizes.table_name, '_(\d+)$'::text))[1]::integerAS shard_id,
max(citus_shard_sizes.size) AS size
FROM citus_shard_sizes() citus_shard_sizes(table_name, size)
GROUP BY ((regexp_matches(citus_shard_sizes.table_name, '_(\d+)$'::text))[1]::integer)) shard_sizes ONpg_dist_shard.shardid=shard_sizes.shard_idWHEREpg_dist_placement.shardstate=1AND NOT (pg_dist_partition.logicalrelid::oidIN ( SELECTpg_depend.objidFROM pg_depend
WHEREpg_depend.classid='pg_class'::regclass::oidANDpg_depend.refclassid='pg_extension'::regclass::oidANDpg_depend.deptype='e'::"char"))
ORDER BY (pg_dist_shard.logicalrelid::text), pg_dist_shard.shardid;
View: citus_tables
SELECTp.logicalrelidAS table_name,
CASE
WHEN p.partkeyIS NOT NULL THEN 'distributed'::text
ELSE
CASE
WHEN p.repmodel='t'::"char" THEN 'reference'::text
ELSE 'local'::text
END
END AS citus_table_type,
COALESCE(column_to_column_name(p.logicalrelid, p.partkey), '<none>'::text) AS distribution_column,
p.colocationidAS colocation_id,
pg_size_pretty(citus_total_relation_size(p.logicalrelid, fail_on_error => false)) AS table_size,
( SELECTcount(*) AS count
FROM pg_dist_shard
WHEREpg_dist_shard.logicalrelid::oid=p.logicalrelid::oid) AS shard_count,
pg_get_userbyid(c.relowner) AS table_owner, a.amnameAS access_method
FROM pg_dist_partition p
JOIN pg_class c ONp.logicalrelid::oid=c.oidLEFT JOIN pg_am a ONa.oid=c.relamWHERE NOT (p.logicalrelid::oidIN ( SELECTpg_depend.objidFROM pg_depend
WHEREpg_depend.classid='pg_class'::regclass::oidANDpg_depend.refclassid='pg_extension'::regclass::oidANDpg_depend.deptype='e'::"char"))
ORDER BY (p.logicalrelid::text);
WITH unique_global_wait_edges_with_calculated_gpids AS (
SELECT
CASE
WHEN citus_internal_global_blocked_processes.waiting_global_pid<>0 THEN citus_internal_global_blocked_processes.waiting_global_pid
ELSE citus_calculate_gpid(get_nodeid_for_groupid(citus_internal_global_blocked_processes.waiting_node_id), citus_internal_global_blocked_processes.waiting_pid)
END AS waiting_global_pid,
CASE
WHEN citus_internal_global_blocked_processes.blocking_global_pid<>0 THEN citus_internal_global_blocked_processes.blocking_global_pid
ELSE citus_calculate_gpid(get_nodeid_for_groupid(citus_internal_global_blocked_processes.blocking_node_id), citus_internal_global_blocked_processes.blocking_pid)
END AS blocking_global_pid,
get_nodeid_for_groupid(citus_internal_global_blocked_processes.blocking_node_id) AS blocking_node_id,
get_nodeid_for_groupid(citus_internal_global_blocked_processes.waiting_node_id) AS waiting_node_id,
citus_internal_global_blocked_processes.blocking_transaction_waitingFROM citus_internal_global_blocked_processes() citus_internal_global_blocked_processes(waiting_global_pid, waiting_pid, waiting_node_id, waiting_transaction_num, waiting_transaction_stamp, blocking_global_pid, blocking_pid, blocking_node_id, blocking_transaction_num, blocking_transaction_stamp, blocking_transaction_waiting)
), unique_global_wait_edges AS (
SELECT DISTINCTON (unique_global_wait_edges_with_calculated_gpids.waiting_global_pid, unique_global_wait_edges_with_calculated_gpids.blocking_global_pid) unique_global_wait_edges_with_calculated_gpids.waiting_global_pid,
unique_global_wait_edges_with_calculated_gpids.blocking_global_pid,
unique_global_wait_edges_with_calculated_gpids.blocking_node_id,
unique_global_wait_edges_with_calculated_gpids.waiting_node_id,
unique_global_wait_edges_with_calculated_gpids.blocking_transaction_waitingFROM unique_global_wait_edges_with_calculated_gpids
), citus_dist_stat_activity_with_calculated_gpids AS (
SELECT
CASE
WHEN citus_dist_stat_activity.global_pid<>0 THEN citus_dist_stat_activity.global_pid
ELSE citus_calculate_gpid(citus_dist_stat_activity.nodeid, citus_dist_stat_activity.pid)
END AS global_pid,
citus_dist_stat_activity.nodeid, citus_dist_stat_activity.pid,
citus_dist_stat_activity.queryFROM citus_dist_stat_activity
)
SELECTwaiting.global_pidAS waiting_gpid, blocking.global_pidAS blocking_gpid,
waiting.queryAS blocked_statement,
blocking.queryAS current_statement_in_blocking_process,
waiting.nodeidAS waiting_nodeid, blocking.nodeidAS blocking_nodeid
FROM unique_global_wait_edges
JOIN citus_dist_stat_activity_with_calculated_gpids waiting ONunique_global_wait_edges.waiting_global_pid=waiting.global_pidJOIN citus_dist_stat_activity_with_calculated_gpids blocking ONunique_global_wait_edges.blocking_global_pid=blocking.global_pid;
blocks till the job identified by jobid is at the specified status, or reached a terminal status. Only waits for terminal status when no desired_status was specified. The return value indicates if the desired status was reached or not. When no desired status was specified it will assume any terminal status was desired
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
jobid
bigint
$2
IN
desired_status
citus_job_status
NULL::citus_job_status
Function return type: void
Function attributes: COST 1
Function: citus_json_concatenate (json, json)
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
state
json
$2
IN
val
json
Function return type: json
Function: citus_json_concatenate_final (json)
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
state
json
Function return type: json
Function: citus_jsonb_concatenate (jsonb, jsonb)
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
state
jsonb
$2
IN
val
jsonb
Function return type: jsonb
Function: citus_jsonb_concatenate_final (jsonb)
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
state
jsonb
Function return type: jsonb
Function: citus_local_disk_space_stats()
returns statistics on available disk space on the local node
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
OUT
available_disk_size
bigint
$2
OUT
total_disk_size
bigint
Function return type: record
Function attributes: RETURNS NULL ON NULL INPUT, COST 1
a shard_allowed_on_node_function for use by the rebalance algorithm that always returns true
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
bigint
$2
IN
integer
Function return type: boolean
Function: citus_shard_cost_1 (bigint)
a shard cost function for use by the rebalance algorithm that always returns 1
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
bigint
Function return type: real
Function: citus_shard_cost_by_disk_size (bigint)
a shard cost function for use by the rebalance algorithm that returns the disk size in bytes for the specified shard and the shards that are colocated with it
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
bigint
Function return type: real
Function attributes: RETURNS NULL ON NULL INPUT, COST 1
Function: citus_shard_indexes_on_worker()
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
OUT
schema_name
name
$2
OUT
index_name
name
$3
OUT
table_type
text
$4
OUT
owner_name
name
$5
OUT
shard_name
name
Function return type: SETOF record
Function attributes: ROWS 1000
Function-local settings:
SET citus.show_shards_for_app_name_prefixes TO *
Function: citus_shard_sizes()
returns shards sizes across citus cluster
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
OUT
table_name
text
$2
OUT
size
bigint
Function return type: SETOF record
Function attributes: RETURNS NULL ON NULL INPUT, COST 1, ROWS 1000
runs the create role query, if the role doesn't exists, runs the alter role query if it does
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
role_name
text
$2
IN
create_role_utility_query
text
$3
IN
alter_role_utility_query
text
Function return type: boolean
Function attributes: COST 1
Function: worker_create_or_replace_object (text)
takes a sql CREATE statement, before executing the create it will check if an object with that name already exists and safely replaces that named object with the new object
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
statement
text
Function return type: boolean
Function attributes: RETURNS NULL ON NULL INPUT, COST 1
takes an array of sql statements, before executing these it will check if the object already exists in that exact state otherwise replaces that named object with the new object
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
statements
text[]
Function return type: boolean
Function attributes: RETURNS NULL ON NULL INPUT, COST 1
SELECTpartitions.partrelidAS parent_table,
partitions.attnameAS partition_column, partitions.relidAS partition,
partitions.lower_boundAS from_value, partitions.upper_boundAS to_value,
partitions.amnameAS access_method
FROM ( SELECTp.partrelid::regclass AS partrelid, a.attname,
c.oid::regclass AS relid, time_partition_range.lower_bound,
time_partition_range.upper_bound, am.amnameFROM pg_class c
JOIN pg_inherits i ONc.oid=i.inhrelidJOIN pg_partitioned_table p ONi.inhparent=p.partrelidJOIN pg_attribute a ONp.partrelid=a.attrelidJOIN pg_type t ONa.atttypid=t.oidJOIN pg_namespace tn ONt.typnamespace=tn.oidLEFT JOIN pg_am am ONc.relam=am.oid,
LATERAL time_partition_range(c.oid::regclass) time_partition_range(lower_bound, upper_bound)
WHEREc.relpartboundIS NOT NULLANDp.partstrat='r'::"char"ANDp.partnatts=1AND (a.attnum= ANY (p.partattrs::smallint[]))) partitions
ORDER BY (partitions.partrelid::text), partitions.lower_bound;
View: citus_shards
SELECTpg_dist_shard.logicalrelidAS table_name, pg_dist_shard.shardid,
shard_name(pg_dist_shard.logicalrelid, pg_dist_shard.shardid) AS shard_name,
CASE
WHEN pg_dist_partition.partkeyIS NOT NULL THEN 'distributed'::text
WHEN pg_dist_partition.repmodel='t'::"char" THEN 'reference'::text
ELSE 'local'::text
END AS citus_table_type,
pg_dist_partition.colocationidAS colocation_id, pg_dist_node.nodename,
pg_dist_node.nodeport, shard_sizes.sizeAS shard_size
FROM pg_dist_shard
JOIN pg_dist_placement ONpg_dist_shard.shardid=pg_dist_placement.shardidJOIN pg_dist_node ONpg_dist_placement.groupid=pg_dist_node.groupidJOIN pg_dist_partition ONpg_dist_partition.logicalrelid::oid=pg_dist_shard.logicalrelid::oidLEFT JOIN ( SELECT (regexp_matches(citus_shard_sizes.table_name, '_(\d+)$'::text))[1]::integerAS shard_id,
max(citus_shard_sizes.size) AS size
FROM citus_shard_sizes() citus_shard_sizes(table_name, size)
GROUP BY ((regexp_matches(citus_shard_sizes.table_name, '_(\d+)$'::text))[1]::integer)) shard_sizes ONpg_dist_shard.shardid=shard_sizes.shard_idWHEREpg_dist_placement.shardstate=1AND NOT (pg_dist_partition.logicalrelid::oidIN ( SELECTpg_depend.objidFROM pg_depend
WHEREpg_depend.classid='pg_class'::regclass::oidANDpg_depend.refclassid='pg_extension'::regclass::oidANDpg_depend.deptype='e'::"char"))
ORDER BY (pg_dist_shard.logicalrelid::text), pg_dist_shard.shardid;
View: citus_tables
SELECTp.logicalrelidAS table_name,
CASE
WHEN p.partkeyIS NOT NULL THEN 'distributed'::text
ELSE
CASE
WHEN p.repmodel='t'::"char" THEN 'reference'::text
ELSE 'local'::text
END
END AS citus_table_type,
COALESCE(column_to_column_name(p.logicalrelid, p.partkey), '<none>'::text) AS distribution_column,
p.colocationidAS colocation_id,
pg_size_pretty(citus_total_relation_size(p.logicalrelid, fail_on_error => false)) AS table_size,
( SELECTcount(*) AS count
FROM pg_dist_shard
WHEREpg_dist_shard.logicalrelid::oid=p.logicalrelid::oid) AS shard_count,
pg_get_userbyid(c.relowner) AS table_owner, a.amnameAS access_method
FROM pg_dist_partition p
JOIN pg_class c ONp.logicalrelid::oid=c.oidLEFT JOIN pg_am a ONa.oid=c.relamWHERE NOT (p.logicalrelid::oidIN ( SELECTpg_depend.objidFROM pg_depend
WHEREpg_depend.classid='pg_class'::regclass::oidANDpg_depend.refclassid='pg_extension'::regclass::oidANDpg_depend.deptype='e'::"char"))
ORDER BY (p.logicalrelid::text);
WITH unique_global_wait_edges_with_calculated_gpids AS (
SELECT
CASE
WHEN citus_internal_global_blocked_processes.waiting_global_pid<>0 THEN citus_internal_global_blocked_processes.waiting_global_pid
ELSE citus_calculate_gpid(get_nodeid_for_groupid(citus_internal_global_blocked_processes.waiting_node_id), citus_internal_global_blocked_processes.waiting_pid)
END AS waiting_global_pid,
CASE
WHEN citus_internal_global_blocked_processes.blocking_global_pid<>0 THEN citus_internal_global_blocked_processes.blocking_global_pid
ELSE citus_calculate_gpid(get_nodeid_for_groupid(citus_internal_global_blocked_processes.blocking_node_id), citus_internal_global_blocked_processes.blocking_pid)
END AS blocking_global_pid,
get_nodeid_for_groupid(citus_internal_global_blocked_processes.blocking_node_id) AS blocking_node_id,
get_nodeid_for_groupid(citus_internal_global_blocked_processes.waiting_node_id) AS waiting_node_id,
citus_internal_global_blocked_processes.blocking_transaction_waitingFROM citus_internal_global_blocked_processes() citus_internal_global_blocked_processes(waiting_global_pid, waiting_pid, waiting_node_id, waiting_transaction_num, waiting_transaction_stamp, blocking_global_pid, blocking_pid, blocking_node_id, blocking_transaction_num, blocking_transaction_stamp, blocking_transaction_waiting)
), unique_global_wait_edges AS (
SELECT DISTINCTON (unique_global_wait_edges_with_calculated_gpids.waiting_global_pid, unique_global_wait_edges_with_calculated_gpids.blocking_global_pid) unique_global_wait_edges_with_calculated_gpids.waiting_global_pid,
unique_global_wait_edges_with_calculated_gpids.blocking_global_pid,
unique_global_wait_edges_with_calculated_gpids.blocking_node_id,
unique_global_wait_edges_with_calculated_gpids.waiting_node_id,
unique_global_wait_edges_with_calculated_gpids.blocking_transaction_waitingFROM unique_global_wait_edges_with_calculated_gpids
), citus_dist_stat_activity_with_calculated_gpids AS (
SELECT
CASE
WHEN citus_dist_stat_activity.global_pid<>0 THEN citus_dist_stat_activity.global_pid
ELSE citus_calculate_gpid(citus_dist_stat_activity.nodeid, citus_dist_stat_activity.pid)
END AS global_pid,
citus_dist_stat_activity.nodeid, citus_dist_stat_activity.pid,
citus_dist_stat_activity.queryFROM citus_dist_stat_activity
)
SELECTwaiting.global_pidAS waiting_gpid, blocking.global_pidAS blocking_gpid,
waiting.queryAS blocked_statement,
blocking.queryAS current_statement_in_blocking_process,
waiting.nodeidAS waiting_nodeid, blocking.nodeidAS blocking_nodeid
FROM unique_global_wait_edges
JOIN citus_dist_stat_activity_with_calculated_gpids waiting ONunique_global_wait_edges.waiting_global_pid=waiting.global_pidJOIN citus_dist_stat_activity_with_calculated_gpids blocking ONunique_global_wait_edges.blocking_global_pid=blocking.global_pid;
after upgrading Citus on all nodes call this function to upgrade the distributed schema
Procedure-local settings:
SET search_path TO pg_catalog
Function: citus_finish_pg_upgrade()
perform tasks to restore citus settings from a location that has been prepared before pg_upgrade
Function return type: void
Function-local settings:
SET search_path TO pg_catalog
Function: citus_get_active_worker_nodes()
fetch set of active worker nodes
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
OUT
node_name
text
$2
OUT
node_port
bigint
Function return type: SETOF record
Function attributes: RETURNS NULL ON NULL INPUT, COST 1, ROWS 100
Function: citus_get_node_clock()
Returns monotonically increasing timestamp with logical clock value as close to epoch value (in milli seconds) as possible, and a counter for ticks(maximum of 4 million) within the logical clock
Function return type: cluster_clock
Function attributes: RETURNS NULL ON NULL INPUT, COST 1
Function: citus_get_transaction_clock()
Returns a transaction timestamp logical clock
Function return type: cluster_clock
Function attributes: RETURNS NULL ON NULL INPUT, COST 1
cancel a scheduled or running job and all of its tasks that didn't finish yet
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
jobid
bigint
Function return type: void
Function attributes: RETURNS NULL ON NULL INPUT, COST 1
Function: citus_job_list()
Function return type: TABLE(job_id bigint, state citus_job_status, job_type name, description text, started_at timestamp with time zone, finished_at timestamp with time zone)
Function attributes: ROWS 1000
Function: citus_job_status (bigint, boolean)
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
job_id
bigint
$2
IN
raw
boolean
false
$3
TABLE
job_id
bigint
$4
TABLE
state
citus_job_status
$5
TABLE
job_type
name
$6
TABLE
description
text
$7
TABLE
started_at
timestamp with time zone
$8
TABLE
finished_at
timestamp with time zone
$9
TABLE
details
jsonb
Function return type: TABLE(job_id bigint, state citus_job_status, job_type name, description text, started_at timestamp with time zone, finished_at timestamp with time zone, details jsonb)
Function attributes: RETURNS NULL ON NULL INPUT, ROWS 1000
blocks till the job identified by jobid is at the specified status, or reached a terminal status. Only waits for terminal status when no desired_status was specified. The return value indicates if the desired status was reached or not. When no desired status was specified it will assume any terminal status was desired
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
jobid
bigint
$2
IN
desired_status
citus_job_status
NULL::citus_job_status
Function return type: void
Function attributes: COST 1
Function: citus_json_concatenate (json, json)
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
state
json
$2
IN
val
json
Function return type: json
Function: citus_json_concatenate_final (json)
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
state
json
Function return type: json
Function: citus_jsonb_concatenate (jsonb, jsonb)
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
state
jsonb
$2
IN
val
jsonb
Function return type: jsonb
Function: citus_jsonb_concatenate_final (jsonb)
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
state
jsonb
Function return type: jsonb
Function: citus_local_disk_space_stats()
returns statistics on available disk space on the local node
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
OUT
available_disk_size
bigint
$2
OUT
total_disk_size
bigint
Function return type: record
Function attributes: RETURNS NULL ON NULL INPUT, COST 1
rebalance the shards in the cluster in the background
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
rebalance_strategy
name
NULL::name
$2
IN
drain_only
boolean
false
$3
IN
shard_transfer_mode
citus.shard_transfer_mode
'auto'::citus.shard_transfer_mode
Function return type: bigint
Function attributes: COST 1
Function: citus_rebalance_status (boolean)
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
raw
boolean
false
$2
TABLE
job_id
bigint
$3
TABLE
state
citus_job_status
$4
TABLE
job_type
name
$5
TABLE
description
text
$6
TABLE
started_at
timestamp with time zone
$7
TABLE
finished_at
timestamp with time zone
$8
TABLE
details
jsonb
Function return type: TABLE(job_id bigint, state citus_job_status, job_type name, description text, started_at timestamp with time zone, finished_at timestamp with time zone, details jsonb)
Function attributes: RETURNS NULL ON NULL INPUT, ROWS 1000
Function: citus_rebalance_stop()
stop a rebalance that is running in the background
Function return type: void
Function attributes: COST 1
Function: citus_rebalance_wait()
wait on a running rebalance in the background
Function return type: void
Function attributes: COST 1
Function: citus_relation_size (regclass)
get disk space used by the 'main' fork
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
logicalrelid
regclass
Function return type: bigint
Function attributes: RETURNS NULL ON NULL INPUT, COST 1
Function: citus_remote_connection_stats()
returns statistics about remote connections
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
OUT
hostname
text
$2
OUT
port
integer
$3
OUT
database_name
text
$4
OUT
connection_count_to_node
integer
Function return type: SETOF record
Function attributes: RETURNS NULL ON NULL INPUT, COST 1, ROWS 1000
Function: citus_remove_node (text, integer)
remove node from the cluster
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
nodename
text
$2
IN
nodeport
integer
Function return type: void
Function attributes: RETURNS NULL ON NULL INPUT, COST 1
Function: citus_run_local_command (text)
citus_run_local_command executes the input command
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
command
text
Function return type: void
Function: citus_server_id()
generates a random UUID to be used as server identifier
Function return type: uuid
Function attributes: RETURNS NULL ON NULL INPUT, COST 1
a shard_allowed_on_node_function for use by the rebalance algorithm that always returns true
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
bigint
$2
IN
integer
Function return type: boolean
Function: citus_shard_cost_1 (bigint)
a shard cost function for use by the rebalance algorithm that always returns 1
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
bigint
Function return type: real
Function: citus_shard_cost_by_disk_size (bigint)
a shard cost function for use by the rebalance algorithm that returns the disk size in bytes for the specified shard and the shards that are colocated with it
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
bigint
Function return type: real
Function attributes: RETURNS NULL ON NULL INPUT, COST 1
Function: citus_shard_indexes_on_worker()
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
OUT
schema_name
name
$2
OUT
index_name
name
$3
OUT
table_type
text
$4
OUT
owner_name
name
$5
OUT
shard_name
name
Function return type: SETOF record
Function attributes: ROWS 1000
Function-local settings:
SET citus.show_shards_for_app_name_prefixes TO *
Function: citus_shard_sizes()
returns shards sizes across citus cluster
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
OUT
table_name
text
$2
OUT
size
bigint
Function return type: SETOF record
Function attributes: RETURNS NULL ON NULL INPUT, COST 1, ROWS 1000
blocks till the task identified by taskid is at the specified status, or reached a terminal status. Only waits for terminal status when no desired_status was specified. The return value indicates if the desired status was reached or not. When no desired status was specified it will assume any terminal status was desired
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
taskid
bigint
$2
IN
desired_status
citus_task_status
NULL::citus_task_status
Function return type: void
Function attributes: COST 1
Function: citus_text_send_as_jsonb (text)
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
text
Function return type: bytea
Function attributes: IMMUTABLE, RETURNS NULL ON NULL INPUT, PARALLEL SAFE, COST 1
runs the create role query, if the role doesn't exists, runs the alter role query if it does
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
role_name
text
$2
IN
create_role_utility_query
text
$3
IN
alter_role_utility_query
text
Function return type: boolean
Function attributes: COST 1
Function: worker_create_or_replace_object (text)
takes a sql CREATE statement, before executing the create it will check if an object with that name already exists and safely replaces that named object with the new object
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
statement
text
Function return type: boolean
Function attributes: RETURNS NULL ON NULL INPUT, COST 1
takes an array of sql statements, before executing these it will check if the object already exists in that exact state otherwise replaces that named object with the new object
Function arguments:
Arg. #
Arg. mode
Argument name
Argument type
Default expression
$1
IN
statements
text[]
Function return type: boolean
Function attributes: RETURNS NULL ON NULL INPUT, COST 1