<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Andre Poupard</title>
    <link>https://andrepoupard.com/</link>
    <description>Recent content on Andre Poupard</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Tue, 10 Oct 2023 20:26:14 -0300</lastBuildDate><atom:link href="https://andrepoupard.com/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Index Black Magic</title>
      <link>https://andrepoupard.com/post/index-black-magic/</link>
      <pubDate>Tue, 10 Oct 2023 20:26:14 -0300</pubDate>
      
      <guid>https://andrepoupard.com/post/index-black-magic/</guid>
      <description>A coworker of mine found himself in a spot where index used by his database query was working as intended BUT the performance was still too slow.
What are you supposed to do in this situation?
The easiest thing to do is to play around with the query/indices and try out some query rewriting tricks.
If you&amp;rsquo;re using PostgreSQL or MySQL this would be done by placing EXPLAIN before your query.</description>
    </item>
    
    <item>
      <title>Merge Statement</title>
      <link>https://andrepoupard.com/post/merge-statement/</link>
      <pubDate>Fri, 08 Sep 2023 21:43:09 -0400</pubDate>
      
      <guid>https://andrepoupard.com/post/merge-statement/</guid>
      <description>If I asked you to come up with all the different kinds of CRUD query statements you could think of, what statements would come to mind?
INSERT, SELECT, UPDATE, DELETE are easy to come by.
What about the less common MERGE statement?
It&amp;rsquo;s used when you&amp;rsquo;d like to update one table from another &amp;ldquo;data source&amp;rdquo;.
A data source could be almost anything, from VALUES statements, to subqueries, to other tables.</description>
    </item>
    
    <item>
      <title>Immutable Table Index</title>
      <link>https://andrepoupard.com/post/immutable-index/</link>
      <pubDate>Mon, 07 Aug 2023 15:43:50 -0400</pubDate>
      
      <guid>https://andrepoupard.com/post/immutable-index/</guid>
      <description>If you&amp;rsquo;ve been using PostgreSQL long enough, you know that B+tree indices are the way to go in most cases.
But that&amp;rsquo;s not the case for some immutable tables.
What index should you use for immutable tables (no updates/deletes) where the column values are stored in ascending order physically and logically?
BRIN Indices.
A good candidate for this type of index would be a created_at column, each new row has an increasing value similar to its physical layout on disc.</description>
    </item>
    
    <item>
      <title>Stateful Triggers</title>
      <link>https://andrepoupard.com/post/stateful-triggers/</link>
      <pubDate>Mon, 31 Jul 2023 00:00:25 -0400</pubDate>
      
      <guid>https://andrepoupard.com/post/stateful-triggers/</guid>
      <description>When working with database triggers, you might find yourself in a situation where you want to add extra state to your trigger that goes beyond just the fields on the row.
Perhaps you&amp;rsquo;re looking to add some additional application level state.
For instance, let&amp;rsquo;s say you wanted a trigger to store the user_id of a user that performed an action within your system but user_id is not a part of the record nor can it be looked up from another table based on that field.</description>
    </item>
    
    <item>
      <title>Covering PostgreSQL Indices</title>
      <link>https://andrepoupard.com/post/postgresql-btree-indices/</link>
      <pubDate>Tue, 25 Jul 2023 18:58:16 -0400</pubDate>
      
      <guid>https://andrepoupard.com/post/postgresql-btree-indices/</guid>
      <description>Often when you index tables, you&amp;rsquo;ll start to notice that indices tend to cover the same field and over again.
You start by adding this index:
CREATE INDEX user_username_indx ON user(username)
Weeks go by and you feel like adding this:
CREATE INDEX user_username_created_at_indx ON user(username, created_at)
You can do that; however, the original index already &amp;ldquo;covers&amp;rdquo; this case! You&amp;rsquo;re adding more indices that have to be maintained for no reason.</description>
    </item>
    
    <item>
      <title>Primary keys are slow</title>
      <link>https://andrepoupard.com/post/faster-than-primary-key/</link>
      <pubDate>Mon, 17 Jul 2023 17:54:44 -0400</pubDate>
      
      <guid>https://andrepoupard.com/post/faster-than-primary-key/</guid>
      <description>In PostgreSQL, what&amp;rsquo;s the fastest way to search for a single record?
If you said primary key or some field with an index, there&amp;rsquo;s a much faster way.
Rows on disc Each row is stored in a fixed sized page, and each page contains slots for each row.
The primary key index stores the page and offset id of the row that you&amp;rsquo;re looking for.
You can access the tuple by that page and offset id instead of traversing the index first.</description>
    </item>
    
    <item>
      <title>Fly Without Branches</title>
      <link>https://andrepoupard.com/post/fly-without-branches/</link>
      <pubDate>Wed, 12 Jul 2023 19:07:56 -0400</pubDate>
      
      <guid>https://andrepoupard.com/post/fly-without-branches/</guid>
      <description>Your boss comes running up to you and says:
&amp;ldquo;We have a stream with billions of integers, I want you to filter out the ones between 5 and 25!&amp;rdquo;
&amp;ldquo;That sounds easy enough. No probl&amp;ndash;&amp;rdquo;
&amp;ldquo;One slight problem, you can&amp;rsquo;t sort the numbers in the stream and it has to be as fast as possible.&amp;rdquo;
You start coding away and come up with the below pseudo python code like a champ:</description>
    </item>
    
    <item>
      <title>Out of memory - Out of patience</title>
      <link>https://andrepoupard.com/post/go-memory-leaks/</link>
      <pubDate>Tue, 11 Jul 2023 23:36:19 -0400</pubDate>
      
      <guid>https://andrepoupard.com/post/go-memory-leaks/</guid>
      <description>&amp;ldquo;There&amp;rsquo;s been something wrong with our Go server for the past 2 years&amp;hellip;&amp;rdquo;, my colleague says.
My mind shuts off in anticipation of what&amp;rsquo;s to come.
&amp;ldquo;We&amp;rsquo;ve had several devs investigate this issue from our backend lead to various members from other backend teams but still with no luck.&amp;rdquo;
What could this be?
&amp;ldquo;It&amp;rsquo;s a memory leak and it causes constant crashes. Our users get kicked off of the websockets each time and they can&amp;rsquo;t view any content for some time.</description>
    </item>
    
    <item>
      <title></title>
      <link>https://andrepoupard.com/about/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://andrepoupard.com/about/</guid>
      <description></description>
    </item>
    
  </channel>
</rss>
