DEV Community

Edrick Ee
Edrick Ee

Posted on

Postgresql in brew to nodejs

  1. install postgresql in brew: brew install postgresql

  2. start postgresql: "brew services start postgresql"

    • after postgresql starts, I can use psql

"brew services stop postgresql"

  1. sudo -u postgres psql: to start postgres

  2. \timing <-- if you want to see timing

  3. Link to all command lines for Postgresql: https://www.geeksforgeeks.org/postgresql-psql-commands/

extra: elementSQL can be online db: https://medium.com/@noogetz/how-to-setup-a-database-with-elephantsql-7d87ea9953d0

ex. great video explaining how I can query data inside of PostgreSQL

link: https://www.youtube.com/watch?v=ufdHsFClAk0&t=723s

npm install pg --> pg has great tool of Client where it will query data from the database I have.

If we have huge data that is taking long time, consider using indexing

ex. CREATE INDEX ON styles (product_id);

Top comments (0)