Category Postgres

Postgres basic commands

There are some basic postgres commands, those we use daily basis like listing database, switching database, listing tables etc. Listing Database \l # or \list 2. Switching Database \connect sales # or \c sales 3. Listing Tables \dt

Tuning Postgres on MacOS

If you are working on Postgres and facing issues of slow queries then tuning the Postgres server can be a good point to optimize the performance by tuning the Postgres database. In this article, we will talk about increasing the… Continue Reading →

Show process list in the Database and kill the process

Sometime, we need to check the list of processes running inside database or check the status of query. Various database provides their own way to check it. MySQL:If you are on MySQL database then run the below sql to check… Continue Reading →

Extract only digits from a string field in Postgres

If you want to only extract digits from a string in Postgres, we can do it using regexp_replace. \D tell not digit and ‘g’ stand for global. SELECT NULLIF(regexp_replace(‘OTHERdsfd4 323 2323d42324 3ssf3 432`sfd’, ‘\D’,”,’g’), ”)::numeric AS result — Output: 432323234232433432… Continue Reading →

© 2024 My Beliefs

Write us at [email protected]