<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Azeem Shaikh</title>
    <description>The latest articles on DEV Community by Azeem Shaikh (@geekslayr8).</description>
    <link>https://dev.to/geekslayr8</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F402649%2Ffac8985b-7f73-4ebb-8833-dc7f1ef58f83.png</url>
      <title>DEV Community: Azeem Shaikh</title>
      <link>https://dev.to/geekslayr8</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/geekslayr8"/>
    <language>en</language>
    <item>
      <title>Improve database performance</title>
      <dc:creator>Azeem Shaikh</dc:creator>
      <pubDate>Mon, 17 Nov 2025 18:26:35 +0000</pubDate>
      <link>https://dev.to/geekslayr8/test-post-dj4</link>
      <guid>https://dev.to/geekslayr8/test-post-dj4</guid>
      <description>&lt;p&gt;You can improve database performance by introducing indexing and verifying aws logs.&lt;/p&gt;

</description>
      <category>database</category>
      <category>aws</category>
    </item>
    <item>
      <title>Create new Database in Postgres</title>
      <dc:creator>Azeem Shaikh</dc:creator>
      <pubDate>Sun, 16 Nov 2025 19:25:41 +0000</pubDate>
      <link>https://dev.to/geekslayr8/create-new-database-in-postgres-1h23</link>
      <guid>https://dev.to/geekslayr8/create-new-database-in-postgres-1h23</guid>
      <description>&lt;h2&gt;
  
  
  Pre-requisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You have PostgreSQL installed in your system.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You have root privileges&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Logging into psql as root
&lt;/h2&gt;

&lt;p&gt;Open your terminal and Enter the following commands - &lt;br&gt;
&lt;code&gt;sudo -i -u postgres&lt;/code&gt;&lt;br&gt;
Enter your password and you should login into something like this - &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzt8hry8vmjopilml35c9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzt8hry8vmjopilml35c9.png" alt=" " width="482" height="127"&gt;&lt;/a&gt;&lt;br&gt;
Enter &lt;code&gt;psql&lt;/code&gt; and press enter. You have entered the psql terminal.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating the database
&lt;/h2&gt;

&lt;p&gt;First, you need to have a user with which you will login to the database.&lt;br&gt;
&lt;code&gt;CREATE USER new_username WITH ENCRYPTED PASSWORD 'your_secure_password';&lt;/code&gt;&lt;br&gt;
Once the user is created, we will create the database - &lt;br&gt;
&lt;code&gt;CREATE DATABASE database_name;&lt;/code&gt;&lt;br&gt;
Now we will grant the required permissions - &lt;br&gt;
&lt;code&gt;GRANT ALL PRIVILEGES ON DATABASE database_name TO new_username;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flja4qglzf0noqmhvl04v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flja4qglzf0noqmhvl04v.png" alt=" " width="661" height="257"&gt;&lt;/a&gt;&lt;br&gt;
Press &lt;code&gt;\q&lt;/code&gt; to exit the psql terminal and exit the postgres session.&lt;/p&gt;

&lt;h2&gt;
  
  
  Verify login
&lt;/h2&gt;

&lt;p&gt;Run the below command to verify whether you are able to login to the database - &lt;br&gt;
&lt;code&gt;psql -U test_user my_blog_db_test&lt;/code&gt;&lt;br&gt;
We get an error when we run this - &lt;br&gt;
&lt;code&gt;psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL:  Peer authentication failed for user "test_user"&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Fix
&lt;/h3&gt;

&lt;p&gt;This error arises because postgres is set to use peer authentication by default. We need to change this to md5 in &lt;code&gt;/etc/postgresql/14/main/pg_hba.conf&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Open &lt;code&gt;/etc/postgresql/14/main/pg_hba.conf&lt;/code&gt; in the editor of your choice.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Search for &lt;code&gt;local   all             postgres                                peer&lt;/code&gt; in the file&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add this line below the postgres config - &lt;code&gt;local   all             test_user                               md5&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Restart the postgres service. &lt;code&gt;sudo systemctl restart postgresql&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Login to postgres - &lt;code&gt;psql -U test_user my_blog_db_test&lt;/code&gt; and enter the password when prompted.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F24bdyf034kjo69xzpe52.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F24bdyf034kjo69xzpe52.png" alt=" " width="652" height="167"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Congratulations! You have successfully created your database.&lt;/p&gt;

</description>
      <category>database</category>
    </item>
  </channel>
</rss>
