{"id":5158,"date":"2015-06-15T12:44:41","date_gmt":"2015-06-15T10:44:41","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/sql-interpolation-with-psql\/"},"modified":"2015-06-15T12:44:41","modified_gmt":"2015-06-15T10:44:41","slug":"sql-interpolation-with-psql","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/sql-interpolation-with-psql\/","title":{"rendered":"SQL Interpolation with psql"},"content":{"rendered":"<p>The PostgreSQL <a href=\"http:\/\/www.postgresql.org\/docs\/current\/static\/app-psql.html\" target=\"_blank\">psql utility<\/a> provides some really nice features. One of these features is <a href=\"http:\/\/www.postgresql.org\/docs\/9.4\/static\/app-psql.html#APP-PSQL-INTERPOLATION\" target=\"_blank\">SQL interpolation<\/a> which allows us to do interesting things, e.g. reading files and analyze the results directly in the database. This post will show how to use this by reading and analyzing <a href=\"http:\/\/linux.die.net\/man\/1\/sar\" target=\"_blank\">sar<\/a> files of a linux server.<\/p>\n<p><img decoding=\"async\" id=\"system-readmore\" class=\"mceItemReadMore\" title=\"Read More\" src=\"http:\/\/wwwold.dbi-services.com\/plugins\/editors\/jce\/tiny_mce\/plugins\/article\/img\/trans.gif\" alt=\"Read More\" \/><br \/>\nUsually linux hosts store sar statistics in the \/var\/log\/sa directory:<\/p>\n<pre class=\"brush: java; gutter: true; first-line: 1\">ls \/var\/log\/sa\n sa02 sa03 sa04 sa05 sa06 sa07 sa08 sa09 sa10 sa11 sa12 sa13 sa14 sa15 sa16 sa18 sa19 sa21 sa25 sa28 sa29 sa30<\/pre>\n<p>This files can later be analyzed by providing the file name as an argument to sar:<\/p>\n<pre class=\"brush: java; gutter: true; first-line: 1\">sar -f \/var\/log\/sa\/sa07  | head -8\nLinux 3.8.13-68.1.2.el7uek.x86_64 (oel7.lcsys.ch) \t05\/07\/2015 \t_x86_64_\t(1 CPU)\n\n09:49:30 AM       LINUX RESTART\n\n09:50:01 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle\n10:00:01 AM     all      0.03      0.00      0.11      0.13      0.00     99.73\n10:10:01 AM     all      0.48      0.00      0.38      1.93      0.00     97.21\n10:20:01 AM     all      0.05      0.00      0.15      0.08      0.00     99.73<\/pre>\n<p>&nbsp;<\/p>\n<p>For the scope of this post let&#8217;s say there is a requirement to store the iowait statistics for a long time so that the values may be analyzed at any point in time. The perfect place to store data that needs to be analyzed\/queried is the database \ud83d\ude42<br \/>\nNow let&#8217;s come back to SQL interpolation. psql allows us to store the result of an OS command into a variable, e.g:<\/p>\n<pre class=\"brush: java; gutter: true; first-line: 1\">postgres=# \\set blubb `ls -la`<\/pre>\n<p>The variable then can be queried with standard sql:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">postgres=# select :'blubb';\n                                          ?column?                                           \n---------------------------------------------------------------------------------------------\n total 2521056                                                                              +\n drwx------.  5 postgres postgres       4096 Jun 15 10:54 .                                 +\n drwxr-xr-x.  4 root     root             37 May 28 11:10 ..                                +\n -rw-rw-r--.  1 postgres postgres        218 May  7 16:37 1mio_copy_index_after_hstore.sql  +\n -rw-rw-r--.  1 postgres postgres        217 May  7 16:36 1mio_copy_index_before_hstore.sql +\n -rw-rw-r--.  1 postgres postgres        149 May  7 16:07 1mio_copy_no_indexes_hstore.sql   +\n -rw-rw-r--.  1 postgres postgres        144 May  8 16:20 1mio_copy_no_indexes_jsonb.sql    +<\/pre>\n<p>&#8230; &#8230;<\/p>\n<p>If the result of any command can be stored into a variable in psql we are able to do something like this:<\/p>\n<pre class=\"brush: java; gutter: true; first-line: 1\">postgres=# \\set iowait `sar -f \/var\/log\/sa\/sa07`\npostgres=# select :'iowait';\n                                            ?column?                                             \n-------------------------------------------------------------------------------------------------\n Linux 3.8.13-68.1.2.el7uek.x86_64 (oel7.lcsys.ch)       05\/07\/2015      _x86_64_        (1 CPU)+\n                                                                                                +\n 09:49:30 AM       LINUX RESTART                                                                +\n                                                                                                +\n 09:50:01 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle                +\n 10:00:01 AM     all      0.03      0.00      0.11      0.13      0.00     99.73                +\n 10:10:01 AM     all      0.48      0.00      0.38      1.93      0.00     97.21                +\n<\/pre>\n<p>As we are only interested in the iowait statistics let&#8217;s get rid of everything we don&#8217;t need:<\/p>\n<pre class=\"brush: java; gutter: true; first-line: 1\">postgres=# \\set iowait `sar -f \/var\/log\/sa\/sa07 | egrep -v \"^$|Average|Linux|LINUX|CPU\" | awk -F \" \" '{print $7}'`\npostgres=# select :'iowait';\n ?column? \n----------\n 0.13    +\n 1.93    +\n 0.08    +\n 0.15    +\n 0.06    +\n<\/pre>\n<p>Looks much better. But if we insert this into a table the result would be one varchar column which is not very good for data analysis. Let&#8217;s do some more transformation and delete all new lines and replace all spaces with commas:<\/p>\n<pre class=\"brush: java; gutter: true; first-line: 1\">postgres=# \\set iowait `sar -f \/var\/log\/sa\/sa07 | egrep -v \"^$|Average|Linux|LINUX|CPU\" | awk -F \" \" '{print $7}' | sed ':a;N;$!ba;s\/\\n\/,\/g'`\npostgres=# select :'iowait';\n                                                                                                        ?c\nColumn?                                                                                                    \n    \n----------------------------------------------------------------------------------------------------------\n----------------------------------------------------------------------------------------------------------\n----\n 0.13,1.93,0.08,0.15,0.06,0.79,6.15,0.01,0.00,7.20,5.89,0.46,0.05,0.01,0.00,0.00,0.00,0.00,0.00,0.02,0.00,\n0.08,0.11,0.04,0.02,0.00,0.00,0.00,0.00,1.05,0.05,0.12,0.00,0.00,0.07,0.67,0.04,0.87,1.14,0.10,0.12,0.03,0\n.00\n(1 row)\n<\/pre>\n<p>We now have all the values on one line separated by comma. A perfect starting point for an array:<\/p>\n<pre class=\"brush: java; gutter: true; first-line: 1\">postgres=# select string_to_array(:'iowait',',');\n                                                                                                     string_to_array                                                       \n                                               \n---------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n-----------------------------------------------\n {0.13,1.93,0.08,0.15,0.06,0.79,6.15,0.01,0.00,7.20,5.89,0.46,0.05,0.01,0.00,0.00,0.00,0.00,0.00,0.02,0.00,0.08,0.11,0.04,0.02,0.00,0.00,0.00,0.00,1.05,0.05,0.12,0.00,0.00\n,0.07,0.67,0.04,0.87,1.14,0.10,0.12,0.03,0.00}\n(1 row)\n<\/pre>\n<p>Now we have an array of strings. Still not the best thing for analyzing numbers, so let&#8217;s do another cast:<\/p>\n<pre class=\"brush: java; gutter: true; first-line: 1\">postgres=# select string_to_array(:'iowait',',')::numeric[];\n                                                                                                     string_to_array                                                       \n                                               \n---------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n-----------------------------------------------\n {0.13,1.93,0.08,0.15,0.06,0.79,6.15,0.01,0.00,7.20,5.89,0.46,0.05,0.01,0.00,0.00,0.00,0.00,0.00,0.02,0.00,0.08,0.11,0.04,0.02,0.00,0.00,0.00,0.00,1.05,0.05,0.12,0.00,0.00\n,0.07,0.67,0.04,0.87,1.14,0.10,0.12,0.03,0.00}\n(1 row)\n<\/pre>\n<p>This is something we can work with. No we need a table to store this:<\/p>\n<pre class=\"brush: java; gutter: true; first-line: 1\">postgres=# create table iowaits ( day date, iowaits numeric[] );\nCREATE TABLE\npostgres=# insert into iowaits (day,iowaits) \n                  values ( current_date, string_to_array(:'iowait',',')::numeric[] );\nINSERT 0 1\n<\/pre>\n<p>Perfect. Let&#8217;s do some analyzing:<\/p>\n<pre class=\"brush: java; gutter: true; first-line: 1\">postgres=# with bb as ( select unnest(iowaits) vals, day   from iowaits where day = current_date ) select max(vals) from bb;\n max  \n------\n 7.20\n(1 row)\n<\/pre>\n<p>Sure, for a real analysis the data model needs some more investigation. For showing how easy it is to work with files or results of OS commands in PostgreSQL this should be enough \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The PostgreSQL psql utility provides some really nice features. One of these features is SQL interpolation which allows us to do interesting things, e.g. reading files and analyze the results directly in the database. This post will show how to use this by reading and analyzing sar files of a linux server. Usually linux hosts&hellip;&nbsp;<\/p>\n","protected":false},"author":28,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","neve_meta_reading_time":"","_themeisle_gutenberg_block_has_review":false,"footnotes":""},"categories":[4133],"tags":[],"class_list":["post-5158","post","type-post","status-publish","format-standard","hentry","category-database"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.4 (Yoast SEO v28.7) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>SQL Interpolation with psql - dbi services | 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\/sql-interpolation-with-psql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL Interpolation with psql\" \/>\n<meta property=\"og:description\" content=\"The PostgreSQL psql utility provides some really nice features. One of these features is SQL interpolation which allows us to do interesting things, e.g. reading files and analyze the results directly in the database. This post will show how to use this by reading and analyzing sar files of a linux server. Usually linux hosts&hellip;&nbsp;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/sql-interpolation-with-psql\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi services | Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/dbiservices\/\" \/>\n<meta property=\"article:published_time\" content=\"2015-06-15T10:44:41+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/wwwold.dbi-services.com\/plugins\/editors\/jce\/tiny_mce\/plugins\/article\/img\/trans.gif\" \/>\n<meta name=\"author\" content=\"Open source Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@dbiservices\" \/>\n<meta name=\"twitter:site\" content=\"@dbiservices\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Open source Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 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\\\/sql-interpolation-with-psql\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-interpolation-with-psql\\\/\"},\"author\":{\"name\":\"Open source Team\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/0b4548362cac3eeff8b3eaf329e3530a\"},\"headline\":\"SQL Interpolation with psql\",\"datePublished\":\"2015-06-15T10:44:41+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-interpolation-with-psql\\\/\"},\"wordCount\":346,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-interpolation-with-psql\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/wwwold.dbi-services.com\\\/plugins\\\/editors\\\/jce\\\/tiny_mce\\\/plugins\\\/article\\\/img\\\/trans.gif\",\"articleSection\":[\"Database\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-interpolation-with-psql\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-interpolation-with-psql\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-interpolation-with-psql\\\/\",\"name\":\"SQL Interpolation with psql - dbi services | Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-interpolation-with-psql\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-interpolation-with-psql\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/wwwold.dbi-services.com\\\/plugins\\\/editors\\\/jce\\\/tiny_mce\\\/plugins\\\/article\\\/img\\\/trans.gif\",\"datePublished\":\"2015-06-15T10:44:41+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-interpolation-with-psql\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-interpolation-with-psql\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-interpolation-with-psql\\\/#primaryimage\",\"url\":\"http:\\\/\\\/wwwold.dbi-services.com\\\/plugins\\\/editors\\\/jce\\\/tiny_mce\\\/plugins\\\/article\\\/img\\\/trans.gif\",\"contentUrl\":\"http:\\\/\\\/wwwold.dbi-services.com\\\/plugins\\\/editors\\\/jce\\\/tiny_mce\\\/plugins\\\/article\\\/img\\\/trans.gif\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-interpolation-with-psql\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL Interpolation with psql\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\",\"name\":\"dbi services Blog\",\"description\":\"#BeSharing\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#organization\"},\"alternateName\":\"dbi Blog\",\"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\":\"Organization\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#organization\",\"name\":\"dbi services\",\"alternateName\":\"dbi\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/dbi-services-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/dbi-services-logo.png\",\"width\":512,\"height\":512,\"caption\":\"dbi services\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/dbiservices\\\/\",\"https:\\\/\\\/x.com\\\/dbiservices\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/dbi-services\\\/\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/dbiservices\"],\"description\":\"Swiss IT consulting and services company specialised in efficient data infrastructures and platforms: databases, application servers, cloud, DevOps, digitalization, analytics, data quality and monitoring. Headquartered in Del\u00e9mont with offices in Nyon, Basel, Bern and Zurich.\",\"email\":\"info@dbi-services.com\",\"telephone\":\"+41 32 422 96 00\",\"legalName\":\"dbi services SA\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/0b4548362cac3eeff8b3eaf329e3530a\",\"name\":\"Open source Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/open-source-author.png\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/open-source-author.png\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/open-source-author.png\",\"caption\":\"Open source Team\"},\"description\":\"Posts published under the Open source Team account are collective contributions by the dbi services open infrastructure consultants. The practice covers open-source databases and platforms, PostgreSQL first of all, along with MySQL, MariaDB, and Linux, from architecture, replication, and high availability to performance tuning and operations under service level agreements, and contributes actively to the PostgreSQL community.\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/author\\\/open-source-team\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"SQL Interpolation with psql - dbi services | 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\/sql-interpolation-with-psql\/","og_locale":"en_US","og_type":"article","og_title":"SQL Interpolation with psql","og_description":"The PostgreSQL psql utility provides some really nice features. One of these features is SQL interpolation which allows us to do interesting things, e.g. reading files and analyze the results directly in the database. This post will show how to use this by reading and analyzing sar files of a linux server. Usually linux hosts&hellip;&nbsp;","og_url":"https:\/\/www.dbi-services.com\/blog\/sql-interpolation-with-psql\/","og_site_name":"dbi services | Blog","article_publisher":"https:\/\/www.facebook.com\/dbiservices\/","article_published_time":"2015-06-15T10:44:41+00:00","og_image":[{"url":"http:\/\/wwwold.dbi-services.com\/plugins\/editors\/jce\/tiny_mce\/plugins\/article\/img\/trans.gif","type":"","width":"","height":""}],"author":"Open source Team","twitter_card":"summary_large_image","twitter_creator":"@dbiservices","twitter_site":"@dbiservices","twitter_misc":{"Written by":"Open source Team","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/sql-interpolation-with-psql\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-interpolation-with-psql\/"},"author":{"name":"Open source Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/0b4548362cac3eeff8b3eaf329e3530a"},"headline":"SQL Interpolation with psql","datePublished":"2015-06-15T10:44:41+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-interpolation-with-psql\/"},"wordCount":346,"commentCount":0,"publisher":{"@id":"https:\/\/www.dbi-services.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-interpolation-with-psql\/#primaryimage"},"thumbnailUrl":"http:\/\/wwwold.dbi-services.com\/plugins\/editors\/jce\/tiny_mce\/plugins\/article\/img\/trans.gif","articleSection":["Database"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/sql-interpolation-with-psql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/sql-interpolation-with-psql\/","url":"https:\/\/www.dbi-services.com\/blog\/sql-interpolation-with-psql\/","name":"SQL Interpolation with psql - dbi services | Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-interpolation-with-psql\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-interpolation-with-psql\/#primaryimage"},"thumbnailUrl":"http:\/\/wwwold.dbi-services.com\/plugins\/editors\/jce\/tiny_mce\/plugins\/article\/img\/trans.gif","datePublished":"2015-06-15T10:44:41+00:00","breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-interpolation-with-psql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/sql-interpolation-with-psql\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/sql-interpolation-with-psql\/#primaryimage","url":"http:\/\/wwwold.dbi-services.com\/plugins\/editors\/jce\/tiny_mce\/plugins\/article\/img\/trans.gif","contentUrl":"http:\/\/wwwold.dbi-services.com\/plugins\/editors\/jce\/tiny_mce\/plugins\/article\/img\/trans.gif"},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/sql-interpolation-with-psql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"SQL Interpolation with psql"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi services Blog","description":"#BeSharing","publisher":{"@id":"https:\/\/www.dbi-services.com\/blog\/#organization"},"alternateName":"dbi Blog","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":"Organization","@id":"https:\/\/www.dbi-services.com\/blog\/#organization","name":"dbi services","alternateName":"dbi","url":"https:\/\/www.dbi-services.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2026\/09\/dbi-services-logo.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2026\/09\/dbi-services-logo.png","width":512,"height":512,"caption":"dbi services"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/dbiservices\/","https:\/\/x.com\/dbiservices","https:\/\/www.linkedin.com\/company\/dbi-services\/","https:\/\/www.youtube.com\/user\/dbiservices"],"description":"Swiss IT consulting and services company specialised in efficient data infrastructures and platforms: databases, application servers, cloud, DevOps, digitalization, analytics, data quality and monitoring. Headquartered in Del\u00e9mont with offices in Nyon, Basel, Bern and Zurich.","email":"info@dbi-services.com","telephone":"+41 32 422 96 00","legalName":"dbi services SA"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/0b4548362cac3eeff8b3eaf329e3530a","name":"Open source Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/05\/open-source-author.png","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/05\/open-source-author.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/05\/open-source-author.png","caption":"Open source Team"},"description":"Posts published under the Open source Team account are collective contributions by the dbi services open infrastructure consultants. The practice covers open-source databases and platforms, PostgreSQL first of all, along with MySQL, MariaDB, and Linux, from architecture, replication, and high availability to performance tuning and operations under service level agreements, and contributes actively to the PostgreSQL community.","url":"https:\/\/www.dbi-services.com\/blog\/author\/open-source-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/5158","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\/28"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=5158"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/5158\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=5158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=5158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=5158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}