O'Reilly logo

PostgreSQL High Performance Cookbook by Dinesh Kumar, Chitij Chauhan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Comparing indexed scans and sequential scans

In this recipe, let's compare the index and sequential scan behaviors using the inotifywait utility command, which will print a message when the mentioned event occurs on the given files.

Getting ready

inotify tools is a module that we can download using either the apt-get or yum command in the corresponding Linux distribution. This contrib module is developed based on the inotify kernel API, which provides some kind of audit mechanism over the filesystem. To compare the index and sequential scan behavior, let's audit the relation and index physical file while executing the SQL queries.

How to do it...

Let's get the locations of index and relation physical files location using the pg_relation_filepath ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required