{"id":5165,"date":"2015-06-29T12:52:46","date_gmt":"2015-06-29T10:52:46","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/indexing-for-likesimilarity-operations\/"},"modified":"2015-06-29T12:52:46","modified_gmt":"2015-06-29T10:52:46","slug":"indexing-for-likesimilarity-operations","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/indexing-for-likesimilarity-operations\/","title":{"rendered":"Indexing for like\/similarity operations"},"content":{"rendered":"<p>Indexing queries for like\/similarity conditions is not that easy with the usual index types. The only option you have with btree indexes (especially if the wild-card is at the beginning of the filter) is to create a <a href=\"http:\/\/www.postgresql.org\/docs\/current\/static\/indexes-partial.html\" target=\"_blank\">partial index<\/a> on that columns for a very specific query.<br \/>\n<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 \/>\nLet&#8217;s do a simple example with a btree index. The test data:<\/p>\n<pre class=\"brush: java; gutter: true; first-line: 1\">drop table if exists t1;\n create table t1 ( a varchar(50) );\n insert into t1 ( select md5(tt::text)\n from generate_series ( 1, 100000) tt\n );<\/pre>\n<p>This created 1&#8217;000&#8217;000 distinct rows:<\/p>\n<pre class=\"brush: java; gutter: true; first-line: 1\">postgres=# with aa as ( select a, count(*) from t1 group by a having count(*) = 1  )\nselect count(*) from aa;\n count  \n--------\n 100000\n(1 row)\n<\/pre>\n<p>This is a perfect distribution for creating an index if we look for few rows. What options do we have? The first, obvious one, is to create a btree index:<\/p>\n<pre class=\"brush: java; gutter: true; first-line: 1\">postgres=# create index i_btree on t1(a);\nCREATE INDEX\n<\/pre>\n<p>This will perfectly work for queries like this:<\/p>\n<pre class=\"brush: java; gutter: true; first-line: 1\">postgres=# explain analyze select * from t1 where a = 'd0e2dc293c21d9628c65b5032fe9dc76';\n                                                    QUERY PLAN                                               \n     \n-------------------------------------------------------------------------------------------------------------\n-----\n Index Only Scan using i_btree on t1  (cost=0.42..8.44 rows=1 width=33) (actual time=0.041..0.041 rows=1 loop\ns=1)\n   Index Cond: (a = 'd0e2dc293c21d9628c65b5032fe9dc76'::text)\n   Heap Fetches: 1\n Planning time: 0.135 ms\n Execution time: 0.060 ms\n(5 rows)\n<\/pre>\n<p>But what if we want to query the data like this (Please excuse the double quotes around the like. I found no other ways to prevent this blog software from doing funny things with it):<\/p>\n<pre class=\"brush: java; gutter: true; first-line: 1\">postgres=# explain analyze select * from t1 where a like '\"%\"e2dc293c21d9628c65b5032fe9dc76';\n                                            QUERY PLAN                                             \n---------------------------------------------------------------------------------------------------\n Seq Scan on t1  (cost=0.00..2084.00 rows=10 width=33) (actual time=11.656..14.481 rows=1 loops=1)\n   Filter: ((a)::text~~ '\"%\"e2dc293c21d9628c65b5032fe9dc76'::text)\n   Rows Removed by Filter: 99999\n Planning time: 0.069 ms\n Execution time: 14.493 ms\n(5 rows)\npostgres=# explain analyze select * from t1 where a like '\"%\"e2dc93\"%\"c21d9628c65b5032fe9dc76';\n                                            QUERY PLAN                                             \n---------------------------------------------------------------------------------------------------\n Seq Scan on t1  (cost=0.00..2084.00 rows=10 width=33) (actual time=10.990..14.112 rows=1 loops=1)\n   Filter: ((a)::text ~~ '\"%\"e2dc93\"%\"c21d9628c65b5032fe9dc76'::text)\n   Rows Removed by Filter: 99999\n Planning time: 0.046 ms\n Execution time: 14.183 ms\n(5 rows)\n<\/pre>\n<p>This will trigger a full table scan on the table as the index can not be used. Any chance to fix this with a btree index? We could create a partial index like this for the first query:<\/p>\n<pre class=\"brush: java; gutter: true; first-line: 1\">postgres=# create index i_btree_t1 on t1(a) where a like '\"%\"e2dc293c21d9628c65b5032fe9dc76'; CREATE INDEX postgres=#<\/pre>\n<p>Does it help?:<\/p>\n<pre class=\"brush: java; gutter: true; first-line: 1\">postgres=# explain analyze select * from t1 where a like '\"%\"e2dc293c21d9628c65b5032fe9dc76';\n                                                     QUERY PLAN                                              \n       \n-------------------------------------------------------------------------------------------------------------\n-------\n Bitmap Heap Scan on t1  (cost=4.13..40.97 rows=10 width=33) (actual time=0.013..0.013 rows=1 loops=1)\n   Recheck Cond: ((a)::text ~~ '\"%\"e2dc293c21d9628c65b5032fe9dc76'::text)\n   Heap Blocks: exact=1\n   -&gt;  Bitmap Index Scan on i_btree_t1  (cost=0.00..4.13 rows=10 width=0) (actual time=0.010..0.010 rows=1 lo\nops=1)\n Planning time: 0.208 ms\n Execution time: 0.029 ms\n(6 rows)<\/pre>\n<p>&nbsp;<\/p>\n<p>Yes, it does help. But only in this case. As soon as the query is slightly modified this will not work anymore:<\/p>\n<pre class=\"brush: java; gutter: true; first-line: 1\">postgres=# explain analyze select * from t1 where a like '\"%\"XXdc293c21d9628c65b5032fe9dc76';\n                                            QUERY PLAN                                             \n---------------------------------------------------------------------------------------------------\n Seq Scan on t1  (cost=0.00..2084.00 rows=10 width=33) (actual time=11.529..11.529 rows=0 loops=1)\n   Filter: ((a)::text ~~ '\"%\"XXdc293c21d9628c65b5032fe9dc76'::text)\n   Rows Removed by Filter: 100000\n Planning time: 0.080 ms\n Execution time: 11.541 ms\n(5 rows)\n<\/pre>\n<p>So this is only an option for very static queries asking for the same &#8220;like&#8221; over and over again.<br \/>\nLuckily, in PostgreSQL, there is the <a href=\"http:\/\/www.postgresql.org\/docs\/current\/static\/pgtrgm.html\" target=\"_blank\">pg_trgm extension<\/a> which is shipped by default. From the documentation: &#8220;The pg_trgm module provides functions and operators for determining the similarity of alphanumeric text based on trigram matching, as well as index operator classes that support fast searching for similar strings.&#8221;<br \/>\nCan this help us? Let&#8217;s try. Installing extensions which are shipped by default is just matter of:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">postgres=# create extension pg_trgm;\n CREATE EXTENSION\n postgres=#\nBtw.: There is a plsql shortcut to list all the extension currently installed;\npostgres=# \\dx\n                                     List of installed extensions\n    Name    | Version |   Schema   |                            Description                            \n------------+---------+------------+-------------------------------------------------------------------\n cstore_fdw | 1.2     | public     | foreign-data wrapper for flat cstore access\n hstore     | 1.3     | public     | data type for storing sets of (key, value) pairs\n pg_trgm    | 1.1     | public     | text similarity measurement and index searching based on trigrams\n plpgsql    | 1.0     | pg_catalog | PL\/pgSQL procedural language\n(4 rows)<\/pre>\n<p>Now that the extension is installed let&#8217;s create an index using the extension:<\/p>\n<pre class=\"brush: java; gutter: true; first-line: 1\">postgres=# drop index i_btree;\nDROP INDEX\npostgres=# drop index i_btree_t1;\nDROP INDEX\npostgres=# \npostgres=# create index i_rtgm on t1 using gist ( a gist_trgm_ops);\nCREATE INDEX\npostgres=# \n<\/pre>\n<p>Does it help for the queries above? :<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">postgres=# explain analyze select * from t1 where a like '\"%\"e2dc293c21d9628c65b5032fe9dc76';\n                                                   QUERY PLAN                                                \n   \n-------------------------------------------------------------------------------------------------------------\n---\n Bitmap Heap Scan on t1  (cost=4.36..41.20 rows=10 width=33) (actual time=1.654..1.654 rows=1 loops=1)\n   Recheck Cond: ((a)::text ~~ '\"%\"e2dc293c21d9628c65b5032fe9dc76'::text)\n   Heap Blocks: exact=1\n   -&gt;  Bitmap Index Scan on i_rtgm  (cost=0.00..4.36 rows=10 width=0) (actual time=1.646..1.646 rows=1 loops=\n1)\n         Index Cond: ((a)::text ~~ '\"%\"e2dc293c21d9628c65b5032fe9dc76'::text)\n Planning time: 0.113 ms\"\n Execution time: 1.682 ms\n(7 rows)\npostgres=# explain analyze select * from t1 where a like '\"%\"XXdc293c21d9628c65b5032fe9dc76';\n                                                   QUERY PLAN                                                \n   \n-------------------------------------------------------------------------------------------------------------\n---\nBitmap Heap Scan on t1  (cost=4.36..41.20 rows=10 width=33) (actual time=1.633..1.633 rows=0 loops=1)\n   Recheck Cond: ((a)::text ~~ '\"%\"XXdc293c21d9628c65b5032fe9dc76'::text)\n   -&gt;  Bitmap Index Scan on i_rtgm  (cost=0.00..4.36 rows=10 width=0) (actual time=1.630..1.630 rows=0 loops=\n1)\n         Index Cond: ((a)::text ~~ '\"%\"XXdc293c21d9628c65b5032fe9dc76'::text)\n Planning time: 0.058 ms\n Execution time: 1.650 ms\n(6 rows)<\/pre>\n<p>Even for multiple wild-cards;<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">postgres=# explain analyze select * from t1 where a like '\"%\"e2dc\"%\"93c21d\"%%\"62\"%%\"65b5032fe9dc76';\n                                                   QUERY PLAN\n   \n-------------------------------------------------------------------------------------------------------------\n---\n Bitmap Heap Scan on t1  (cost=4.36..41.20 rows=10 width=33) (actual time=1.480..1.481 rows=1 loops=1)\n   Recheck Cond: ((a)::text ~~ '\"%\"e2dc\"%\"93c21d\"%%\"62\"%%\"65b5032fe9dc76'::text)\n   Heap Blocks: exact=1\n   -&gt;  Bitmap Index Scan on i_rtgm  (cost=0.00..4.36 rows=10 width=0) (actual time=1.475..1.475 rows=1 loops=\n1)\n         Index Cond: ((a)::text ~~ '\"%\"e2dc\"%\"93c21d\"%%\"62\"%%\"65b5032fe9dc76'::text)\n Planning time: 0.100 ms\n Execution time: 1.501 ms\n(7 rows)<\/pre>\n<p>&nbsp;<\/p>\n<p>Isn&#8217;t that cool?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Indexing queries for like\/similarity conditions is not that easy with the usual index types. The only option you have with btree indexes (especially if the wild-card is at the beginning of the filter) is to create a partial index on that columns for a very specific query. Let&#8217;s do a simple example with a btree&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-5165","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>Indexing for like\/similarity operations - 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\/indexing-for-likesimilarity-operations\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Indexing for like\/similarity operations\" \/>\n<meta property=\"og:description\" content=\"Indexing queries for like\/similarity conditions is not that easy with the usual index types. The only option you have with btree indexes (especially if the wild-card is at the beginning of the filter) is to create a partial index on that columns for a very specific query. Let&#8217;s do a simple example with a btree&hellip;&nbsp;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/indexing-for-likesimilarity-operations\/\" \/>\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-29T10:52:46+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=\"5 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\\\/indexing-for-likesimilarity-operations\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/indexing-for-likesimilarity-operations\\\/\"},\"author\":{\"name\":\"Open source Team\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/0b4548362cac3eeff8b3eaf329e3530a\"},\"headline\":\"Indexing for like\\\/similarity operations\",\"datePublished\":\"2015-06-29T10:52:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/indexing-for-likesimilarity-operations\\\/\"},\"wordCount\":323,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/indexing-for-likesimilarity-operations\\\/#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\\\/indexing-for-likesimilarity-operations\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/indexing-for-likesimilarity-operations\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/indexing-for-likesimilarity-operations\\\/\",\"name\":\"Indexing for like\\\/similarity operations - dbi services | Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/indexing-for-likesimilarity-operations\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/indexing-for-likesimilarity-operations\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/wwwold.dbi-services.com\\\/plugins\\\/editors\\\/jce\\\/tiny_mce\\\/plugins\\\/article\\\/img\\\/trans.gif\",\"datePublished\":\"2015-06-29T10:52:46+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/indexing-for-likesimilarity-operations\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/indexing-for-likesimilarity-operations\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/indexing-for-likesimilarity-operations\\\/#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\\\/indexing-for-likesimilarity-operations\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Indexing for like\\\/similarity operations\"}]},{\"@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":"Indexing for like\/similarity operations - 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\/indexing-for-likesimilarity-operations\/","og_locale":"en_US","og_type":"article","og_title":"Indexing for like\/similarity operations","og_description":"Indexing queries for like\/similarity conditions is not that easy with the usual index types. The only option you have with btree indexes (especially if the wild-card is at the beginning of the filter) is to create a partial index on that columns for a very specific query. Let&#8217;s do a simple example with a btree&hellip;&nbsp;","og_url":"https:\/\/www.dbi-services.com\/blog\/indexing-for-likesimilarity-operations\/","og_site_name":"dbi services | Blog","article_publisher":"https:\/\/www.facebook.com\/dbiservices\/","article_published_time":"2015-06-29T10:52:46+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":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/indexing-for-likesimilarity-operations\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/indexing-for-likesimilarity-operations\/"},"author":{"name":"Open source Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/0b4548362cac3eeff8b3eaf329e3530a"},"headline":"Indexing for like\/similarity operations","datePublished":"2015-06-29T10:52:46+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/indexing-for-likesimilarity-operations\/"},"wordCount":323,"commentCount":0,"publisher":{"@id":"https:\/\/www.dbi-services.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/indexing-for-likesimilarity-operations\/#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\/indexing-for-likesimilarity-operations\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/indexing-for-likesimilarity-operations\/","url":"https:\/\/www.dbi-services.com\/blog\/indexing-for-likesimilarity-operations\/","name":"Indexing for like\/similarity operations - dbi services | Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/indexing-for-likesimilarity-operations\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/indexing-for-likesimilarity-operations\/#primaryimage"},"thumbnailUrl":"http:\/\/wwwold.dbi-services.com\/plugins\/editors\/jce\/tiny_mce\/plugins\/article\/img\/trans.gif","datePublished":"2015-06-29T10:52:46+00:00","breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/indexing-for-likesimilarity-operations\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/indexing-for-likesimilarity-operations\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/indexing-for-likesimilarity-operations\/#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\/indexing-for-likesimilarity-operations\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Indexing for like\/similarity operations"}]},{"@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\/5165","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=5165"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/5165\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=5165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=5165"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=5165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}