{"id":11423,"date":"2018-07-12T22:12:13","date_gmt":"2018-07-12T20:12:13","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/"},"modified":"2018-07-12T22:12:13","modified_gmt":"2018-07-12T20:12:13","slug":"pgsentinel-the-sampling-approach-for-postgresql","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/","title":{"rendered":"pgSentinel: the sampling approach for PostgreSQL"},"content":{"rendered":"<h2>By Franck Pachot<\/h2>\n<p>.<br \/>\nHere is the first test I did with the beta of <a href=\"https:\/\/twitter.com\/Pg_Sentinel?lang=en\" target=\"_blank\" rel=\"noopener noreferrer\">pgSentinel<\/a>. This Active Session History sampling is a new approach to Postgres tuning. For people coming from Oracle, this is something that has made our life a lot easier to optimize database applications. Here is a quick example showing how it links together some information that are missing without this extension.<br \/>\n<!--more--><br \/>\nThe installation of the extension is really easy (nore details on Daniel&#8217;s <a href=\"https:\/\/www.dbi-services.com\/blog\/active-session-history-in-postgresql-say-hello-to-pgsentinel\/\" target=\"_blank\" rel=\"noopener noreferrer\">post<\/a>):<\/p>\n<pre><code>\ncp pgsentinel.control \/usr\/pgsql-10\/share\/extension\ncp pgsentinel--1.0.sql \/usr\/pgsql-10\/share\/extension\ncp pgsentinel.so \/usr\/pgsql-10\/lib\n<\/code><\/pre>\n<p>and declare it in postgresql.conf<\/p>\n<pre><code>\ngrep -i pgSentinel $PGDATA\/postgresql.conf\n&nbsp;\nshared_preload_libraries = 'pg_stat_statements,pgsentinel'\n#pgsentinel_ash.pull_frequency = 1\n#pgsentinel_ash.max_entries = 1000000\n<\/code><\/pre>\n<p>and restart:<\/p>\n<pre><code>\n\/usr\/pgsql-10\/bin\/pg_ctl restart\n<\/code><\/pre>\n<p>Then create the views in psql:<\/p>\n<pre><code>\nCREATE EXTENSION pgsentinel;\n<\/code><\/pre>\n<p>I was running PGIO (the SLOB method for PostgreSQL from Kevin Closson <a href=\"https:\/\/kevinclosson.net\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/kevinclosson.net\/<\/a>)<\/p>\n<p>Without the extension, here is what I can see about the current activity from the OS point of view, with &#8216;top -c&#8217;:<\/p>\n<pre><code>\ntop - 21:57:23 up 1 day, 11:22,  4 users,  load average: 4.35, 4.24, 4.16\nTasks: 201 total,   2 running, 199 sleeping,   0 stopped,   0 zombie\n%Cpu(s): 27.6 us, 19.0 sy,  0.0 ni, 31.0 id, 19.0 wa,  0.0 hi,  3.4 si,  0.0 st\nKiB Mem :  4044424 total,    54240 free,   282220 used,  3707964 buff\/cache\nKiB Swap:   421884 total,   386844 free,    35040 used.  3625000 avail Mem\n&nbsp;\n  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND\n 9766 postgres  20   0  440280 160036 150328 D  50.0  4.0  10:56.63 postgres: postgres pgio [local] SELECT\n 9762 postgres  20   0  439940 160140 150412 D  43.8  4.0  10:55.95 postgres: postgres pgio [local] SELECT\n 9761 postgres  20   0  440392 160088 150312 D  37.5  4.0  10:52.29 postgres: postgres pgio [local] SELECT\n 9763 postgres  20   0  440280 160080 150432 R  37.5  4.0  10:41.94 postgres: postgres pgio [local] SELECT\n 9538 postgres  20   0  424860 144464 142956 D   6.2  3.6   0:30.79 postgres: writer process\n<\/code><\/pre>\n<p>As I described in a <a href=\"https:\/\/www.dbi-services.com\/blog\/server-process-name-in-postgres-and-oracle\/\" target=\"_blank\" rel=\"noopener noreferrer\">previous post<\/a>, PostgreSQL changes the title of the process to display the current operation. This looks interesting, but not very detailed (only &#8216;SELECT&#8217; here) and very misleading because here I&#8217;m running PGIO with 50% updates. The &#8216;SELECT&#8217; here is the user call. Not the actual SQL statement running.<\/p>\n<p>We have more information from PG_STAT_ACTIVITY, but again only the top-level call is displayed, as I mentioned in a <a href=\"https:\/\/www.dbi-services.com\/blog\/pgio-pg_stat_activity-and-pg_stat_statements\/\" target=\"_blank\" rel=\"noopener noreferrer\">previous post<\/a>:<\/p>\n<pre><code>\nselect * from pg_stat_activity where pid=9766;\n-[ RECORD 1 ]----+---------------------------------------------------------\ndatid            | 17487\ndatname          | pgio\npid              | 9766\nusesysid         | 10\nusename          | postgres\napplication_name | psql\nclient_addr      |\nclient_hostname  |\nclient_port      | -1\nbackend_start    | 2018-07-12 21:28:46.539052+02\nxact_start       | 2018-07-12 21:28:46.542203+02\nquery_start      | 2018-07-12 21:28:46.542203+02\nstate_change     | 2018-07-12 21:28:46.542209+02\nwait_event_type  | IO\nwait_event       | DataFileWrite\nstate            | active\nbackend_xid      | 37554\nbackend_xmin     | 37553\nquery            | SELECT * FROM mypgio('pgio4', 50, 3000, 131072, 255, 8);\nbackend_type     | client backend\n<\/code><\/pre>\n<p>Here, I know what the user is doing: a call to mypgio() started at 21:28:46. And I know which resources are involved on the system: DataFileWrite. But again the most important is missing, the link between the user call and the system resources. And you can only guess it here because you know that a SELECT do not write to datafiles. There&#8217;s something hidden in the middle, which is actually an UPDATE. Of course, we can see this UPDATE in PG_STAT_STATEMENTS. But there, it will not be linked with the current activity, the mypgio() call, nor the DataFileWrite wait event. And we also need some timing information to be able to see the database load over the time.<\/p>\n<p>Here is where the pgSentinel extension fills the gap, providing:<\/p>\n<ul>\n<li>The actual query running, with the queryid which links to PG_STAT_STATEMENTS, but also the full text with all parameter values<\/li>\n<li>multiple samples of the activity, with their timestamp information<\/li>\n<\/ul>\n<pre><code>\nselect ash_time,pid,wait_event_type,wait_event,state,queryid,backend_type,top_level_query,query from pg_active_session_history order by ash_time desc,pid fetch first 10 rows only;\n&nbsp;\n           ash_time            | pid  | wait_event_type |  wait_event   | state  |  queryid   |  backend_type  |                     top_level_query                      |                                  query                           \n-------------------------------+------+-----------------+---------------+--------+------------+----------------+----------------------------------------------------------+--------------------------------------------------------------------------\n 2018-07-12 21:57:22.991558+02 | 9761 | IO              | DataFileWrite | active |  837728477 | client backend | SELECT * FROM mypgio('pgio2', 50, 3000, 131072, 255, 8); | SELECT sum(scratch) FROM pgio2 WHERE mykey BETWEEN 1065 AND 1320\n 2018-07-12 21:57:22.991558+02 | 9762 | IO              | DataFileWrite | active | 1046864277 | client backend | SELECT * FROM mypgio('pgio3', 50, 3000, 131072, 255, 8); | SELECT sum(scratch) FROM pgio3 WHERE mykey BETWEEN 267 AND 522\n 2018-07-12 21:57:22.991558+02 | 9763 | IO              | DataFileRead  | active | 1648177216 | client backend | SELECT * FROM mypgio('pgio1', 50, 3000, 131072, 255, 8); | UPDATE pgio1 SET scratch = scratch + 1 WHERE mykey BETWEEN 1586 AND 1594\n 2018-07-12 21:57:22.991558+02 | 9766 | IO              | DataFileWrite | active | 3411884874 | client backend | SELECT * FROM mypgio('pgio4', 50, 3000, 131072, 255, 8); | SELECT sum(scratch) FROM pgio4 WHERE mykey BETWEEN 3870 AND 4125\n 2018-07-12 21:57:21.990178+02 | 9761 | CPU             | CPU           | active |  837728477 | client backend | SELECT * FROM mypgio('pgio2', 50, 3000, 131072, 255, 8); | SELECT sum(scratch) FROM pgio2 WHERE mykey BETWEEN 13733 AND 13988\n 2018-07-12 21:57:21.990178+02 | 9762 | IO              | DataFileRead  | active | 1046864277 | client backend | SELECT * FROM mypgio('pgio3', 50, 3000, 131072, 255, 8); | SELECT sum(scratch) FROM pgio3 WHERE mykey BETWEEN 4135 AND 4390\n 2018-07-12 21:57:21.990178+02 | 9763 | IO              | DataFileWrite | active | 2994234299 | client backend | SELECT * FROM mypgio('pgio1', 50, 3000, 131072, 255, 8); | SELECT sum(scratch) FROM pgio1 WHERE mykey BETWEEN 4347 AND 4602\n 2018-07-12 21:57:21.990178+02 | 9766 | CPU             | CPU           | active | 3411884874 | client backend | SELECT * FROM mypgio('pgio4', 50, 3000, 131072, 255, 8); | SELECT sum(scratch) FROM pgio4 WHERE mykey BETWEEN 14423 AND 14678\n 2018-07-12 21:57:20.985253+02 | 9761 | IO              | DataFileWrite | active |  837728477 | client backend | SELECT * FROM mypgio('pgio2', 50, 3000, 131072, 255, 8); | SELECT sum(scratch) FROM pgio2 WHERE mykey BETWEEN 129 AND 384\n 2018-07-12 21:57:20.985253+02 | 9762 | IO              | DataFileWrite | active | 1046864277 | client backend | SELECT * FROM mypgio('pgio3', 50, 3000, 131072, 255, 8); | SELECT sum(scratch) FROM pgio3 WHERE mykey BETWEEN 3313 AND 3568\n(10 rows)\n<\/code><\/pre>\n<p>Everything is there. The timeline where each sample links together the user call (top_level_query), the running query (queryid and query &#8211; which is the text with parameter values), and the wait event (wait_event_type and wait_event).<\/p>\n<p>Here is, on one sample, what is currently available in the beta version:<\/p>\n<pre><code>\nselect * from pg_active_session_history where pid=9766 order by ash_time desc fetch first 1 rows only;\n-[ RECORD 1 ]----+-----------------------------------------------------------------------\nash_time         | 2018-07-12 21:57:23.992798+02\ndatid            | 17487\ndatname          | pgio\npid              | 9766\nusesysid         | 10\nusename          | postgres\napplication_name | psql\nclient_addr      |\nclient_hostname  |\nclient_port      | -1\nbackend_start    | 2018-07-12 21:28:46.539052+02\nxact_start       | 2018-07-12 21:28:46.542203+02\nquery_start      | 2018-07-12 21:28:46.542203+02\nstate_change     | 2018-07-12 21:28:46.542209+02\nwait_event_type  | IO\nwait_event       | DataFileExtend\nstate            | active\nbackend_xid      | 37554\nbackend_xmin     | 37553\ntop_level_query  | SELECT * FROM mypgio('pgio4', 50, 3000, 131072, 255, 8);\nquery            | UPDATE pgio4 SET scratch = scratch + 1 WHERE mykey BETWEEN 700 AND 708\nqueryid          | 1109524376\nbackend_type     | client backend\n<\/code><\/pre>\n<p>Then, what do we do with this? This is a fact table with many dimensions. And we can drill down on the database activity.<\/p>\n<p>A quick overview of the load shows that I have, on average, 4 foreground sessions running for my user calls, and very low vacuuming activity:<\/p>\n<pre><code>\npostgres=# select backend_type\npostgres-# ,count(*)\/(select count(distinct ash_time)::float from pg_active_session_history) as load\npostgres-# from pg_active_session_history\npostgres-# group by backend_type\npostgres-# ;\n   backend_type    |         load\n-------------------+--------------------\n client backend    |   4.09720483938256\n autovacuum worker |   0.07467667918231\n(2 rows)\n<\/code><\/pre>\n<p>I&#8217;ll show in a <a href=\"https:\/\/www.dbi-services.com\/blog\/drilling-down-the-pgsentinel-active-session-history\/\" target=\"_blank\" rel=\"noopener noreferrer\">future post<\/a> how to query this view to drill down into the details. For the moment, here is a short explanation about the reason to go to a sampling approach.<\/p>\n<p>Here is an abstract sequence diagram showing some typical user calls to the database. Several components are involved: CPU for the backed process, or for background processes, the OS, the storage&#8230; Our tuning goal is to reduce the user call duration. And then to reduce or optimize the work done in the different layers. With the current statistics available on PostgreSQL, like PG_STAT_ACTIVITY or PG_STAT_STATEMENTS, or available from the OS (strace to measure system call duration) we  have a vertical approach on the load. We can look at each component individually:<br \/>\n<a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/PGASHWHY001.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/PGASHWHY001.png\" alt=\"PGASHWHY001\" width=\"412\" height=\"341\" class=\"aligncenter size-full wp-image-25239\" \/><\/a><\/p>\n<p>This is basically what we did on Oracle before ASH (Active Session History) was introduced in 10g, 12 years ago. The activity sampling approach takes an orthogonal point of view. Rather than cumulating statistics for each components, it looks at what happens on the system at specific point in times, across all components. We don&#8217;t have all measures (such as how many execution of a query) but only samples. However, each sample gives a complete view from the user call down to the system calls. And 1 second samples are sufficient to address any relevant activity, without taking too much space for short retention. For each sample, we cover all layers end-to-end:<br \/>\n<a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/PGASHWHY002.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/PGASHWHY002.png\" alt=\"PGASHWHY002\" width=\"436\" height=\"341\" class=\"aligncenter size-full wp-image-25240\" \/><\/a><br \/>\nThis horizontal approach makes the link between the user calls (the user perception of the database performance) and the system resources where we can analyze and optimize. With this, we can ensure that our tuning activity always focuses on the problem (the user response time) by addressing the root cause on the right component.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>By Franck Pachot . Here is the first test I did with the beta of pgSentinel. This Active Session History sampling is a new approach to Postgres tuning. For people coming from Oracle, this is something that has made our life a lot easier to optimize database applications. Here is a quick example showing how [&hellip;]<\/p>\n","protected":false},"author":27,"featured_media":11424,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[229,83],"tags":[699,570,77],"type_dbi":[],"class_list":["post-11423","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-database-administration-monitoring","category-postgresql","tag-ash","tag-postgres","tag-postgresql"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>pgSentinel: the sampling approach for PostgreSQL - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"pgSentinel: the sampling approach for PostgreSQL\" \/>\n<meta property=\"og:description\" content=\"By Franck Pachot . Here is the first test I did with the beta of pgSentinel. This Active Session History sampling is a new approach to Postgres tuning. For people coming from Oracle, this is something that has made our life a lot easier to optimize database applications. Here is a quick example showing how [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-07-12T20:12:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/PGASHWHY001.png\" \/>\n\t<meta property=\"og:image:width\" content=\"412\" \/>\n\t<meta property=\"og:image:height\" content=\"341\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Oracle Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Oracle Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/\"},\"author\":{\"name\":\"Oracle Team\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\"},\"headline\":\"pgSentinel: the sampling approach for PostgreSQL\",\"datePublished\":\"2018-07-12T20:12:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/\"},\"wordCount\":769,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/PGASHWHY001.png\",\"keywords\":[\"ASH\",\"postgres\",\"PostgreSQL\"],\"articleSection\":[\"Database Administration &amp; Monitoring\",\"PostgreSQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/\",\"name\":\"pgSentinel: the sampling approach for PostgreSQL - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/PGASHWHY001.png\",\"datePublished\":\"2018-07-12T20:12:13+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/#primaryimage\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/PGASHWHY001.png\",\"contentUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/PGASHWHY001.png\",\"width\":412,\"height\":341},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"pgSentinel: the sampling approach for PostgreSQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\",\"name\":\"Oracle Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g\",\"caption\":\"Oracle Team\"},\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/oracle-team\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"pgSentinel: the sampling approach for PostgreSQL - dbi Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/","og_locale":"en_US","og_type":"article","og_title":"pgSentinel: the sampling approach for PostgreSQL","og_description":"By Franck Pachot . Here is the first test I did with the beta of pgSentinel. This Active Session History sampling is a new approach to Postgres tuning. For people coming from Oracle, this is something that has made our life a lot easier to optimize database applications. Here is a quick example showing how [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/","og_site_name":"dbi Blog","article_published_time":"2018-07-12T20:12:13+00:00","og_image":[{"width":412,"height":341,"url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/PGASHWHY001.png","type":"image\/png"}],"author":"Oracle Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Oracle Team","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/"},"author":{"name":"Oracle Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee"},"headline":"pgSentinel: the sampling approach for PostgreSQL","datePublished":"2018-07-12T20:12:13+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/"},"wordCount":769,"commentCount":0,"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/PGASHWHY001.png","keywords":["ASH","postgres","PostgreSQL"],"articleSection":["Database Administration &amp; Monitoring","PostgreSQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/","url":"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/","name":"pgSentinel: the sampling approach for PostgreSQL - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/PGASHWHY001.png","datePublished":"2018-07-12T20:12:13+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/PGASHWHY001.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/PGASHWHY001.png","width":412,"height":341},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/pgsentinel-the-sampling-approach-for-postgresql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"pgSentinel: the sampling approach for PostgreSQL"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee","name":"Oracle Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g","caption":"Oracle Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/oracle-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/11423","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/27"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=11423"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/11423\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media\/11424"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=11423"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=11423"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=11423"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=11423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}