<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title>Robert Haas: index-only</title><description>Sr. Staff Software Engineer @ Databricks, PostgreSQL Developer and Committer</description><link>https://rhaas.dev/</link><item><title>Fast Counting</title><link>https://rhaas.dev/blog/2011/10/fast-counting/</link><guid isPermaLink="false">tag:blogger.com,1999:blog-20038672.post-4468296093643051368</guid><description>&lt;p&gt;Since I wrote my &lt;a href=&quot;/blog/2011/10/index-only-scans-weve-got-em/&quot;&gt;previous blog entry on index-only scans&lt;/a&gt;, quite a bit of additional work has been done. Tom Lane cleaned up the code and improved the costing model, but possibly the most interesting thing he did was to &lt;a href=&quot;http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=600d3206d1b3f8b540397b79905486a536ac7f78&quot;&gt;allow index-only scans to be used for queries that don’t involve an indexable condition at all&lt;/a&gt;. The classic example is SELECT COUNT(*) FROM table. In previous versions of PostgreSQL, there’s just one way to implement this: sequential scan the table and count ’em up. In PostgreSQL 9.2, that method will still, of course, be available, but now there will be another choice: pick any index you like and do a full index scan, checking whether each tuple is all-visible either using the visibility map or via a heap fetch. So, how well does it work?&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://rhaas.dev/blog/2011/10/fast-counting/&quot;&gt;Read more »&lt;/a&gt;&lt;/p&gt;</description><pubDate>Mon, 31 Oct 2011 13:17:00 GMT</pubDate><category>index-only</category><category>postgresql</category></item><item><title>Index-Only Scans: We&apos;ve Got &apos;Em</title><link>https://rhaas.dev/blog/2011/10/index-only-scans-weve-got-em/</link><guid isPermaLink="false">tag:blogger.com,1999:blog-20038672.post-4873253042229225441</guid><description>&lt;p&gt;Tom Lane &lt;a href=&quot;http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=a2822fb9337a21f98ac4ce850bb4145acf47ca27&quot;&gt;committed&lt;/a&gt; a patch for index-only scans by myself and Ibrar Ahmed, which also incorporated some previous work by Heikki Linnakangas, after hacking on it some more himself. Woohoo!&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://rhaas.dev/blog/2011/10/index-only-scans-weve-got-em/&quot;&gt;Read more »&lt;/a&gt;&lt;/p&gt;</description><pubDate>Sat, 08 Oct 2011 01:09:00 GMT</pubDate><category>index-only</category><category>postgresql</category></item><item><title>Index-Only Scans: Now There&apos;s a Patch</title><link>https://rhaas.dev/blog/2011/08/index-only-scans-now-theres-patch/</link><guid isPermaLink="false">tag:blogger.com,1999:blog-20038672.post-921798792040100320</guid><description>&lt;p&gt;In November of 2010, I blogged about a much-requested PostgreSQL feature: &lt;a href=&quot;/blog/2010/11/index-only-scans/&quot;&gt;index-only scans&lt;/a&gt;. We’ve made some progress! In June of this year, I &lt;a href=&quot;http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=503c7305a1e379f95649eef1a694d0c1dbdc674a&quot;&gt;committed a patch&lt;/a&gt; (and then, after Heikki found some bugs, &lt;a href=&quot;http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=e16954f3d27fa8e16c379ff6623ae18d6250a39c&quot;&gt;another patch&lt;/a&gt;) to make the visibility map crash-safe. In previous releases, it was possible for the visibility map to become incorrect after a system crash, which means that it could not be relied on for anything very critical. That should be fixed now. Last week, I &lt;a href=&quot;https://www.postgresql.org/message-id/CA+Tgmoae-hfNL7eK3BHCeVXTaoU+n1n0jsHSrSLg-K2Kp9PqLg@mail.gmail.com&quot;&gt;posted a patch&lt;/a&gt; for the main feature: index-only scans.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://rhaas.dev/blog/2011/08/index-only-scans-now-theres-patch/&quot;&gt;Read more »&lt;/a&gt;&lt;/p&gt;</description><pubDate>Thu, 18 Aug 2011 20:00:00 GMT</pubDate><category>index-only</category><category>postgresql</category></item><item><title>Index-Only Scans</title><link>https://rhaas.dev/blog/2010/11/index-only-scans/</link><guid isPermaLink="false">tag:blogger.com,1999:blog-20038672.post-606492814630767275</guid><description>&lt;p&gt;There seems to be a lot of interest in the as-yet-unimplemented performance feature called index-only scans, so I thought it would be useful to explain a little bit more about what this feature is, how it will help PostgreSQL, and where the bodies are buried.&lt;/p&gt;
&lt;p&gt;First, the name. What do we mean by an index-only scan? In PostgreSQL today, an index scan always accesses both the index itself and the underlying table. You might think this unnecessary. For example, if you have the query SELECT name FROM table WHERE id = 10, and there is an index on (id, name), you might assume that we could use the index to check for tuples with id = 10, and the if one is found, return the name directly from the index tuple, without consulting the underlying table. Unfortunately, this does not work, because that tuple might not actually be one that the SELECT statement can see. If the tuple was inserted by a transaction which began after the SELECT statement took its MVCC snapshot, or deleted by a transaction which committed before the SELECT statement took its MVCC snapshot, then the SELECT statement must not return it. If it did, we would quickly get very surprising wrong answers out of the database. So PostgreSQL first looks at the index tuple, and then the heap (table) tuple, decides what the right thing to do is, and does it. By an index ONLY scan, we mean one which will look at just the index, and not at the corresponding table; the trick is to figure out how to make that happen without returning wrong answers.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://rhaas.dev/blog/2010/11/index-only-scans/&quot;&gt;Read more »&lt;/a&gt;&lt;/p&gt;</description><pubDate>Mon, 22 Nov 2010 16:21:00 GMT</pubDate><category>index-only</category><category>postgresql</category></item></channel></rss>