scribase
Text search and indexingversion 1.2

fuzzystrmatch

Soundex, Metaphone and Levenshtein distance.

What it is for

fuzzystrmatch compares strings by edit distance (levenshtein) or by how they sound (soundex, metaphone, dmetaphone). Useful for matching names that are spelled differently, deduplicating contacts, or suggesting "did you mean" corrections.

Enable it

sql
create extension if not exists fuzzystrmatch with schema extensions;

Example

sql
select levenshtein('kitten', 'sitting');        -- 3
select soundex('Robert'), soundex('Rupert');     -- R163, R163
select dmetaphone('Thompson'), dmetaphone('Tomson');

select name from customers where levenshtein(lower(name), lower('jon smith')) <= 2;

Questions

How do I enable fuzzystrmatch?

Run create extension if not exists fuzzystrmatch with schema extensions; in the SQL editor, or switch it on from the Extensions page in the console. You do not need superuser access.

Which version of fuzzystrmatch is installed?

1.2, on Postgres 17.6, as read from the running engine on 2026-10-08. Check yours with: select extversion from pg_extension where extname = 'fuzzystrmatch';

Upstream project: www.postgresql.org/docs/17/fuzzystrmatch.html

More text search and indexing extensions

  • pg_trgm Fuzzy text search and fast LIKE and ILIKE with trigram indexes.
  • unaccent Remove accents from text for search.
  • btree_gin GIN indexes over plain columns, for mixed indexes.
  • btree_gist GiST indexes over plain columns, for exclusion constraints.