<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Database on 我思故我在</title><link>https://example.org/tags/database/</link><description>Recent content in Database on 我思故我在</description><generator>Hugo -- gohugo.io</generator><language>zh-cn</language><copyright>© 2026 博主</copyright><lastBuildDate>Sat, 15 Aug 2026 10:00:00 +0800</lastBuildDate><atom:link href="https://example.org/tags/database/index.xml" rel="self" type="application/rss+xml"/><item><title>PostgreSQL 入门</title><link>https://example.org/db/postgresql-intro/</link><pubDate>Sat, 15 Aug 2026 10:00:00 +0800</pubDate><guid>https://example.org/db/postgresql-intro/</guid><description>&lt;h2 class="relative group"&gt;什么是 PostgreSQL&#10; &lt;div id="什么是-postgresql" class="anchor"&gt;&lt;/div&gt;&#10; &#10; &lt;span&#10; class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;&#10; &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#%e4%bb%80%e4%b9%88%e6%98%af-postgresql" aria-label="锚点"&gt;#&lt;/a&gt;&#10; &lt;/span&gt;&#10; &#10;&lt;/h2&gt;&#10;&lt;p&gt;PostgreSQL 是一款功能强大的开源关系型数据库，以&lt;strong&gt;可靠性&lt;/strong&gt;和&lt;strong&gt;扩展性&lt;/strong&gt;著称，支持丰富的数据类型、全文检索、JSON 与地理信息处理。&lt;/p&gt;</description></item><item><title>SQL 查询性能调优</title><link>https://example.org/db/sql-tuning/</link><pubDate>Sat, 15 Aug 2026 09:00:00 +0800</pubDate><guid>https://example.org/db/sql-tuning/</guid><description>&lt;h2 class="relative group"&gt;定位慢查询&#10; &lt;div id="定位慢查询" class="anchor"&gt;&lt;/div&gt;&#10; &#10; &lt;span&#10; class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;&#10; &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#%e5%ae%9a%e4%bd%8d%e6%85%a2%e6%9f%a5%e8%af%a2" aria-label="锚点"&gt;#&lt;/a&gt;&#10; &lt;/span&gt;&#10; &#10;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;开启慢查询日志：&lt;code&gt;log_min_duration_statement&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;用 &lt;code&gt;EXPLAIN ANALYZE&lt;/code&gt; 分析执行计划&lt;/li&gt;&#10;&lt;li&gt;关注 &lt;code&gt;pg_stat_statements&lt;/code&gt; 统计高频 SQL&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&#10;&lt;h2 class="relative group"&gt;常见性能杀手&#10; &lt;div id="常见性能杀手" class="anchor"&gt;&lt;/div&gt;&#10; &#10; &lt;span&#10; class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;&#10; &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#%e5%b8%b8%e8%a7%81%e6%80%a7%e8%83%bd%e6%9d%80%e6%89%8b" aria-label="锚点"&gt;#&lt;/a&gt;&#10; &lt;/span&gt;&#10; &#10;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;全表扫描&lt;/strong&gt;：缺少索引或查询条件无法命中索引&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;隐式类型转换&lt;/strong&gt;：索引列上做函数运算导致索引失效&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;N+1 查询&lt;/strong&gt;：循环内逐条查询&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;大偏移分页&lt;/strong&gt;：&lt;code&gt;OFFSET 1000000&lt;/code&gt; 越翻越慢&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&#10;&lt;h2 class="relative group"&gt;优化手段&#10; &lt;div id="优化手段" class="anchor"&gt;&lt;/div&gt;&#10; &#10; &lt;span&#10; class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;&#10; &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#%e4%bc%98%e5%8c%96%e6%89%8b%e6%ae%b5" aria-label="锚点"&gt;#&lt;/a&gt;&#10; &lt;/span&gt;&#10; &#10;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;改写 SQL：用小结果集驱动大表（&lt;code&gt;FROM&lt;/code&gt; 顺序）&lt;/li&gt;&#10;&lt;li&gt;合理利用索引：覆盖索引、复合索引&lt;/li&gt;&#10;&lt;li&gt;适当反规范化：预计算汇总表&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&#10;&lt;h2 class="relative group"&gt;小结&#10; &lt;div id="小结" class="anchor"&gt;&lt;/div&gt;&#10; &#10; &lt;span&#10; class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;&#10; &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#%e5%b0%8f%e7%bb%93" aria-label="锚点"&gt;#&lt;/a&gt;&#10; &lt;/span&gt;&#10; &#10;&lt;/h2&gt;&#10;&lt;p&gt;SQL 调优的核心是&lt;strong&gt;理解执行计划&lt;/strong&gt;。先定位瓶颈，再对症下药，避免盲目加索引。&lt;/p&gt;</description></item><item><title>数据库备份恢复指南</title><link>https://example.org/db/backup-recovery/</link><pubDate>Fri, 14 Aug 2026 09:00:00 +0800</pubDate><guid>https://example.org/db/backup-recovery/</guid><description>&lt;h2 class="relative group"&gt;为什么备份如此重要&#10; &lt;div id="为什么备份如此重要" class="anchor"&gt;&lt;/div&gt;&#10; &#10; &lt;span&#10; class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;&#10; &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#%e4%b8%ba%e4%bb%80%e4%b9%88%e5%a4%87%e4%bb%bd%e5%a6%82%e6%ad%a4%e9%87%8d%e8%a6%81" aria-label="锚点"&gt;#&lt;/a&gt;&#10; &lt;/span&gt;&#10; &#10;&lt;/h2&gt;&#10;&lt;p&gt;数据是系统的核心资产。硬件故障、误操作、勒索软件——任何意外都可能造成不可挽回的损失。&lt;strong&gt;没有备份的数据，等于没有数据。&lt;/strong&gt;&lt;/p&gt;</description></item><item><title>PostgreSQL 索引优化实战</title><link>https://example.org/db/postgresql-index-tuning/</link><pubDate>Thu, 13 Aug 2026 09:00:00 +0800</pubDate><guid>https://example.org/db/postgresql-index-tuning/</guid><description>&lt;h2 class="relative group"&gt;索引为什么重要&#10; &lt;div id="索引为什么重要" class="anchor"&gt;&lt;/div&gt;&#10; &#10; &lt;span&#10; class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;&#10; &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#%e7%b4%a2%e5%bc%95%e4%b8%ba%e4%bb%80%e4%b9%88%e9%87%8d%e8%a6%81" aria-label="锚点"&gt;#&lt;/a&gt;&#10; &lt;/span&gt;&#10; &#10;&lt;/h2&gt;&#10;&lt;p&gt;没有索引的表扫描是 O(n) 的，数据量上来后查询会急剧变慢。合理的索引能把查询降到 O(log n)。&lt;/p&gt;</description></item></channel></rss>