Skip to content

Instantly share code, notes, and snippets.

@pdeaudney
Created July 17, 2023 23:04
Show Gist options
  • Save pdeaudney/28d991c3831c2f5963461dd47669bedd to your computer and use it in GitHub Desktop.
Save pdeaudney/28d991c3831c2f5963461dd47669bedd to your computer and use it in GitHub Desktop.
there is no parameter $1 error
iot_devicereadings=# \d+ iot.device_reading
Table "iot.device_reading"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
-----------+-----------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
asset_id | character varying(36) | | not null | | extended | | |
vendor | character varying(36) | | not null | | extended | | |
vendor_id | character varying(36) | | not null | | extended | | |
type | character varying(36) | | not null | | extended | | |
value | real | | not null | | plain | | |
created | timestamp without time zone | | not null | | plain | | |
Indexes:
"device_reading_pk" PRIMARY KEY, btree (asset_id, type, created)
"device_reading_asset_id_created_idx" btree (asset_id, created)
"device_reading_created_idx" btree (created)
Access method: heap
iot_devicereadings=# \dx
List of installed extensions
Name | Version | Schema | Description
--------------------+---------+------------+------------------------------------------------------------------------
citus | 11.2-2 | pg_catalog | Citus distributed database
citus_columnar | 11.1-1 | pg_catalog | Citus Columnar extension
pg_buffercache | 1.3 | public | examine the shared buffer cache
pg_repack | 1.4.8 | public | Reorganize tables in PostgreSQL databases with minimal locks
pg_stat_statements | 1.9 | public | track planning and execution statistics of all SQL statements executed
pgaudit | 1.6.2 | public | provides auditing functionality
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
uuid-ossp | 1.1 | public | generate universally unique identifiers (UUIDs)
(8 rows)
iot_devicereadings=# select version();
version
-----------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 14.8 (Ubuntu 14.8-1.pgdg20.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, 64-bit
(1 row)
iot_devicereadings=# select * from citus_tables; -- there are other sharded tables
table_name | citus_table_type | distribution_column | colocation_id | table_size | shard_count | table_owner | access_method
--------------------------------+------------------+---------------------+---------------+------------+-------------+-----------------------------+---------------
iot.device_reading | distributed | asset_id | 5 | 173 GB | 48 | iot_devicereadingsavercitus | heap
@pdeaudney
Copy link
Author

iot_devicereadings=# select * from citus_tables where table_name::text = 'iot.device_reading';
     table_name     | citus_table_type | distribution_column | colocation_id | table_size | shard_count |         table_owner         | access_method
--------------------+------------------+---------------------+---------------+------------+-------------+-----------------------------+---------------
 iot.device_reading | distributed      | asset_id            |            11 | 6081 MB    |          48 | iot_devicereadingsavercitus | heap
(1 row)

iot_devicereadings=# \d+ iot.device_reading
                                                   Table "iot.device_reading"
  Column   |            Type             | Collation | Nullable | Default | Storage  | Compression | Stats target | Description
-----------+-----------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
 asset_id  | character varying(36)       |           | not null |         | extended |             |              |
 vendor    | character varying(36)       |           | not null |         | extended |             |              |
 vendor_id | character varying(36)       |           | not null |         | extended |             |              |
 type      | character varying(36)       |           | not null |         | extended |             |              |
 value     | real                        |           | not null |         | plain    |             |              |
 created   | timestamp without time zone |           | not null |         | plain    |             |              |
Indexes:
    "device_reading_pk" PRIMARY KEY, btree (asset_id, type, created)
    "device_reading_asset_id_created_idx" btree (asset_id, created)
    "device_reading_created_idx" btree (created)
Access method: heap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment