programmer group

How to find the rows of all tables in Postgres

I'm looking for a way to find the number of rows for all tables in Postgres. I know that I can do the following on one table at a time: SELECT count(*) FROM table_name; But I want to look at the number of rows in all the tables and sort them in order to see the size of all my tables. #1 building I usually don't rely on statistics, especially in PostgreSQL. SELECT table_name, dsql2('select count(*) from '||table_name) as...

blog.yugabyte.com blog.yugabyte.com

Natural versus Surrogate Primary Keys in a Distributed SQL Database

There’s a subtle, but critical, difference between the two notions business-unique key and primary key in a relational database. For example, in a “users” table, the “user_id” could be the primary key while the “email_address” (which must be not null and unique) could be the business-unique key. The columns that implement each notion may or may not coincide. This post shows that, especially in a distributed SQL database,...