journal (Wed May 20 2020)

Today I learnt

  • #postgres
  • #programming

Some common commands that ive had to run frequently

CREATE DATABASE mydb;
CREATE ROLE username LOGIN password 'password';
ALTER DATABASE mydb OWNER TO username;

Some more common database commands here https://chartio.com/resources/tutorials/how-to-list-databases-and-tables-in-postgresql-using-psql/ https://www.postgresqltutorial.com/postgresql-alter-database/

PG tablespace The directory where postgres stores data https://www.postgresqltutorial.com/postgresql-create-tablespace/

Seems like for every new client connection, POSTGRES forks a new process, which takes up 10mb of memory! https://www.digitalocean.com/community/tutorials/sqlite-vs-mysql-vs-postgresql-a-comparison-of-relational-database-management-systems

pgBouncer can be used for connection pooling. https://www.citusdata.com/blog/2017/05/10/scaling-connections-in-postgres/

SQLite does not have the notion of users. But it has very good performance for reads. SQLite is even used on embedded devices etc and has the smallest footprint among all RDBMS

You can use JSONSchema in rails https://blog.heroku.com/json-schema-document-debug-apis https://medium.com/@DrawandCode/how-and-why-json-schema-in-rails-always-saves-the-day-60ecc68ab303

You can convert postgres tables to JSONSchema https://www.npmjs.com/package/pg-tables-to-jsonschema


Found this cool website that shows you how to learn something in a few minutes https://learnxinyminutes.com/