Skip to content

Instantly share code, notes, and snippets.

@Harkishen-Singh
Last active November 17, 2020 18:29
Show Gist options
  • Save Harkishen-Singh/98d3af9bf7c52a4473abcca753e9903f to your computer and use it in GitHub Desktop.
Save Harkishen-Singh/98d3af9bf7c52a4473abcca753e9903f to your computer and use it in GitHub Desktop.

Fast way of getting count of all rows in a very long table: (https://stackoverflow.com/a/7945274)

SELECT reltuples::bigint AS estimate FROM pg_class where relname='mytable';

OR

SELECT reltuples::bigint AS estimate FROM pg_class WHERE oid = 'myschema.mytable'::regclass; (if there's a schema)

and fast way of getting count of rows across all partitions (https://stackoverflow.com/a/30594273):

            SELECT
                SUM(child.reltuples)    AS number_of_records_all_partitions
            FROM pg_inherits
                JOIN pg_class parent            ON pg_inherits.inhparent = parent.oid
                JOIN pg_class child             ON pg_inherits.inhrelid   = child.oid
                JOIN pg_namespace nmsp_parent   ON nmsp_parent.oid  = parent.relnamespace
                JOIN pg_namespace nmsp_child    ON nmsp_child.oid   = child.relnamespace
            WHERE parent.relname = 'my_table_name';

cgroups error in docker then do this as temporary fix docker/for-linux#219 (comment) OR here it is

Temp fix:

sudo mkdir /sys/fs/cgroup/systemd

sudo mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd

Installing docker on Fedora 33 complete instructions

https://dev.to/yzwdroid/fedora-33-docker-445k

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