<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Gokul Raam — Today I Learnt</title><description>A microblog of small things learned working with Python, Postgres, Redis, and whatever else is biting me this week.</description><link>https://gokulraam.dev/</link><language>en-us</language><item><title>Deploying an full stack application</title><link>https://gokulraam.dev/til/untitled/</link><guid isPermaLink="true">https://gokulraam.dev/til/untitled/</guid><description>I mean, I have done it before, deploying full stack projects in college, as part of work regularly. But yeah, this time I&apos;m doing it for my portfolio website. Doing it after long years. Will focus on load balancing, reverse proxy, security side soon!</description><pubDate>Mon, 01 Jun 2026 08:31:35 GMT</pubDate><content:encoded>&lt;p&gt;I mean, I have done it before, deploying full stack projects in college, as part of work regularly. But yeah, this time I&apos;m doing it for my portfolio website. Doing it after long years. Will focus on load balancing, reverse proxy, security side soon!&lt;/p&gt;
</content:encoded></item><item><title>Postgres EXPLAIN ANALYZE lies about buffers unless you ask</title><link>https://gokulraam.dev/til/postgres-explain-buffers/</link><guid isPermaLink="true">https://gokulraam.dev/til/postgres-explain-buffers/</guid><description>EXPLAIN ANALYZE shows timings but not I/O by default. To see what&apos;s actually being read from disk vs. cached, you need: EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT) SELECT * FROM users WHERE email = &apos;x@y.com&apos;; The Buffers: line tells you shared hit=N read=N — that &amp;quot;read&amp;quot; is …</description><pubDate>Thu, 28 May 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;code&gt;EXPLAIN ANALYZE&lt;/code&gt; shows timings but not I/O by default. To see what&apos;s actually
being read from disk vs. cached, you need:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT)
SELECT * FROM users WHERE email = &apos;x@y.com&apos;;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;Buffers:&lt;/code&gt; line tells you &lt;code&gt;shared hit=N read=N&lt;/code&gt; — that &amp;quot;read&amp;quot; is your real
disk I/O. A query that&apos;s &amp;quot;fast&amp;quot; in EXPLAIN can still hammer the disk if you
don&apos;t check this.&lt;/p&gt;
&lt;p&gt;Pair with &lt;code&gt;track_io_timing = on&lt;/code&gt; in &lt;code&gt;postgresql.conf&lt;/code&gt; for actual I/O latency.&lt;/p&gt;
</content:encoded><category>postgres</category><category>performance</category></item><item><title>FastAPI Depends() doesn&apos;t cache across requests</title><link>https://gokulraam.dev/til/fastapi-depends-caching/</link><guid isPermaLink="true">https://gokulraam.dev/til/fastapi-depends-caching/</guid><description>Took me a minute. Depends() deduplicates within a single request — if two endpoints in a chain both depend on get_db() , it&apos;s resolved once. But the next request gets a fresh resolution. That&apos;s a feature: per-request DB sessions are what you want. But if you expected app-wide sin…</description><pubDate>Tue, 26 May 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Took me a minute. &lt;code&gt;Depends()&lt;/code&gt; deduplicates within a single request — if two
endpoints in a chain both depend on &lt;code&gt;get_db()&lt;/code&gt;, it&apos;s resolved once. But the
&lt;em&gt;next&lt;/em&gt; request gets a fresh resolution.&lt;/p&gt;
&lt;p&gt;That&apos;s a feature: per-request DB sessions are what you want. But if you
expected app-wide singleton behavior (config, cached HTTP client), use a
module-level instance or &lt;code&gt;lru_cache&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;from functools import lru_cache

@lru_cache
def get_settings() -&amp;gt; Settings:
    return Settings()

# Then in routes:
def handler(settings: Annotated[Settings, Depends(get_settings)]):
    ...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;lru_cache&lt;/code&gt; makes &lt;code&gt;get_settings&lt;/code&gt; a singleton; &lt;code&gt;Depends&lt;/code&gt; happily reuses it.&lt;/p&gt;
</content:encoded><category>fastapi</category><category>python</category></item></channel></rss>