<?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: EffessDev</title>
    <description>The latest articles on DEV Community by EffessDev (@effessdev).</description>
    <link>https://dev.to/effessdev</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%2F3932962%2F7343bdee-da4c-4a14-9cd2-aa80f4d806be.png</url>
      <title>DEV Community: EffessDev</title>
      <link>https://dev.to/effessdev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/effessdev"/>
    <language>en</language>
    <item>
      <title>Indexes: Quickstart Using PostgreSQL (15 sec read)</title>
      <dc:creator>EffessDev</dc:creator>
      <pubDate>Fri, 12 Jun 2026 15:35:06 +0000</pubDate>
      <link>https://dev.to/effessdev/indexes-quickstart-using-postgresql-min-read-55ee</link>
      <guid>https://dev.to/effessdev/indexes-quickstart-using-postgresql-min-read-55ee</guid>
      <description>&lt;p&gt;Let's consider a table &lt;code&gt;user&lt;/code&gt;. When we execute a query to find &lt;code&gt;Emily&lt;/code&gt;, we are actually going through &lt;strong&gt;each record&lt;/strong&gt;, looking whether the &lt;code&gt;name&lt;/code&gt; column equals &lt;code&gt;Emily&lt;/code&gt;. Indexes comes in when you want to speed this up.&lt;/p&gt;

&lt;p&gt;Let's create an Index with the name &lt;code&gt;idx_users_name&lt;/code&gt; (the name can be anything, and it doesn't matter functionally):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;INDEX&lt;/span&gt; &lt;span class="n"&gt;idx_users_name&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now when you run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Emily'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Postgres will use the index we just created (not by the name, the name is just for us) to execute that query, and the time complexity is reduced from &lt;code&gt;O(n)&lt;/code&gt; to &lt;code&gt;O(log n)&lt;/code&gt;.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>database</category>
      <category>postgres</category>
      <category>sql</category>
    </item>
  </channel>
</rss>
