Skip to content

Match

Find duplicate records and link the same real-world entity across tables with probabilistic matching

Connector software
Free and open source
Service credentials
Not needed
Use with an agent

Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.

npx skills add Query-farm/vgi-skills --skill orchard

Copy this request into your coding agent to get started.

Use https://query.farm/products/orchard/connectors/match/index.md to help me query Match with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.

Find records that belong to the same person

Example output · captured
Connector release
v0.5.0
Engine
2.0.1
VGI protocol
3.4.0
SELECT first_name, last_name, email, cluster_id
FROM match.main.match_resolve((SELECT * FROM (VALUES ('John','Smith','[email protected]'),('Jon','Smith','[email protected]'),('Jane','Doe','[email protected]')) AS t(first_name,last_name,email)), columns := 'first_name,last_name,email')
ORDER BY cluster_id, first_name
Result
first_name last_name email cluster_id
John Smith [email protected] 0
Jon Smith [email protected] 0
Jane Doe [email protected] 1

Quick start

Choose where to run Match, then follow the steps below.

The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.

1. Install the vgi extension

Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.

setup.sql
SET allow_extension_repositories = 'allowed';

CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
    WITH PREFIX 'https://duckdb-extensions.query.farm';

INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;

2. Attach the connector

Attach with uvx

Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.

ATTACH 'match' AS match (
  TYPE vgi,
  LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-match'
);

3. Run a query

query.sql
SELECT first_name, last_name, email, cluster_id
FROM match.main.match_resolve((SELECT * FROM (VALUES ('John','Smith','[email protected]'),('Jon','Smith','[email protected]'),('Jane','Doe','[email protected]')) AS t(first_name,last_name,email)), columns := 'first_name,last_name,email')
ORDER BY cluster_id, first_name
More example queries →
Technical details
Verified connector release
v0.5.0
Engine
2.0.1
VGI protocol
3.4.0
Verified on
December 1, 2026
Release notes on GitHub
Pin a version for production

When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.

Attach with uvx

Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.

ATTACH 'match' AS match (
  TYPE vgi,
  LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-match'
);

Overview

Probabilistic entity resolution / record linkage / dedup (Splink) for SQL.

Catalog

Everything match exposes once attached — read straight from the worker's released build.

match 1 schema
main 1 view · 1 function

Probabilistic entity resolution / record linkage / dedup (Splink) for SQL

Schema examples (5)
Examples (5)

Resolve three records on name + email and inspect the entity each row was assigned to, grouped by cluster.

SELECT first_name, last_name, email, cluster_id
FROM match.main.match_resolve((SELECT * FROM (VALUES ('John','Smith','[email protected]'),('Jon','Smith','[email protected]'),('Jane','Doe','[email protected]')) AS t(first_name,last_name,email)), columns := 'first_name,last_name,email')
ORDER BY cluster_id, first_name;
Result
first_name last_name email cluster_id
John Smith [email protected] 0
Jon Smith [email protected] 0
Jane Doe [email protected] 1

Count how many records collapsed into each resolved entity, largest duplicate group first.

SELECT cluster_id, count(*) AS n
FROM match.main.match_resolve((SELECT * FROM (VALUES ('Ann','Lee'),('Anne','Lee'),('Bob','Ng')) AS t(first_name,last_name)), columns := 'first_name,last_name')
GROUP BY cluster_id
ORDER BY n DESC;

Build a golden record per entity: resolve the built-in sample_customers demo on name + email and collapse each cluster to one row (lowest record_id, the first-name spellings seen, email, city, and how many source records merged) -- the three Smith variants and two Doe variants each become one row, the two Jones stay separate.

SELECT min(record_id) AS golden_record_id,
  string_agg(DISTINCT first_name, ' / ' ORDER BY first_name) AS name_variants,
  any_value(last_name) AS last_name, any_value(email) AS email,
  any_value(city) AS city, count(*) AS source_records
FROM match.main.match_resolve((SELECT record_id, first_name, last_name, email, city FROM match.main.sample_customers), columns := 'first_name,last_name,email')
GROUP BY cluster_id
ORDER BY golden_record_id;

Score the resolver against sample_customers' ground-truth expected_entity label: self-join the resolved rows into record pairs and count true/false positive and false negative links, with pairwise precision and recall (4 true links, no false ones: precision = recall = 1.0).

WITH resolved AS (SELECT record_id, expected_entity, cluster_id FROM match.main.match_resolve((SELECT record_id, first_name, last_name, email, expected_entity FROM match.main.sample_customers), columns := 'first_name,last_name,email')), pairs AS (SELECT a.cluster_id = b.cluster_id AS predicted_same, a.expected_entity = b.expected_entity AS actually_same FROM resolved AS a JOIN resolved AS b ON a.record_id < b.record_id) SELECT count(*) FILTER (WHERE predicted_same AND actually_same) AS true_pos, count(*) FILTER (WHERE predicted_same AND NOT actually_same) AS false_pos, count(*) FILTER (WHERE NOT predicted_same AND actually_same) AS false_neg, round(true_pos / nullif(true_pos + false_pos, 0), 3) AS precision, round(true_pos / nullif(true_pos + false_neg, 0), 3) AS recall
FROM pairs;
1 more example

Check what dropping email costs: resolve sample_customers on first + last name only at threshold 0.7 and count clusters per ground-truth entity -- Jane/Janet Doe still link, but the John/Jon/Johnny Smith variants split into three clusters (under-merging).

SELECT expected_entity, count(*) AS records,
  count(DISTINCT cluster_id) AS clusters
FROM match.main.match_resolve((SELECT record_id, first_name, last_name, expected_entity FROM match.main.sample_customers), columns := 'first_name,last_name', threshold := 0.7)
GROUP BY expected_entity
ORDER BY expected_entity;
Views
sample_customers 2 examples6 cols

A small, browsable demo relation of customer records with planted duplicates (and a ground-truth expected_entity label) to try match_resolve against.

Columns
record_id INTEGER
Stable 1-based integer row identifier for the sample record (a dimensionless key, not a measured quantity or an ordinal to compute on).
first_name VARCHAR
Given name; deliberately varied across duplicates (John / Jon / Johnny).
last_name VARCHAR
Surname; note the two distinct Jones people who only share a surname.
email VARCHAR
Contact email; duplicates of one person share an email, distinct people do not.
city VARCHAR
City of the record, carried along as a non-comparison passthrough column.
expected_entity VARCHAR
Ground-truth label: rows with the same value are the same real-world person, so a correct resolver should give them one cluster_id.
Examples (2)

Count the sample records that belong to each ground-truth entity -- the planted duplicate groups match_resolve should reproduce.

SELECT expected_entity, count(*) AS records
FROM match.main.sample_customers
GROUP BY expected_entity
ORDER BY records DESC, expected_entity;

Inspect just the messy Smith records (three spelling variants of one real person) to see the kind of duplication entity resolution targets.

SELECT record_id, first_name, last_name, email
FROM match.main.sample_customers
WHERE last_name = 'Smith'
ORDER BY record_id;
Link
Table in-out functions
match_resolve (data TABLE, columns := VARCHAR, threshold := DOUBLE, train := BOOLEAN) 8 examples

Probabilistic entity resolution / record linkage / dedup (Splink, MIT). Buffers the whole input relation, runs Splink's Fellegi-Sunter model with fuzzy (Jaro-Winkler / Levenshtein) comparisons over the chosen columns, links record pairs above a match-probability threshold, and returns the input rows unchanged plus an appended cluster_id (rows sharing one are the same real-world entity) and match_probability. Use it to deduplicate or link customer, contact, or product records that exact GROUP BY / JOIN miss.

Positional arguments
data TABLE
Relation of records to resolve/dedup (the rows to cluster).
Named arguments
columns := VARCHAR
Comma-separated comparison columns to match on, e.g. 'first_name,last_name,email'. · default ""
threshold := DOUBLE
Match-probability threshold in [0,1] for linking pairs / forming clusters (default 0.5). · default 0.5
train := BOOLEAN
Run Splink's unsupervised EM to refine the default model (opt-in; weak on tiny inputs). · default false
Returns columns
cluster_id VARCHAR
Resolved-entity id; rows sharing a cluster_id are the same entity (a singleton entity gets its own id).
match_probability DOUBLE
Strongest pairwise match probability linking the row into its cluster, in [0, 1] (1.0 for a singleton).
first_name VARCHAR
Echo of the like-named input column (a comparison column in this demo).
last_name VARCHAR
Echo of the like-named input column (a comparison column in this demo).
email VARCHAR
Echo of the like-named input column (a comparison column in this demo).
Returns columns · depends on the arguments
Appended columns (always present)
cluster_id VARCHAR
Resolved-entity id; rows sharing a cluster_id are the same entity (a singleton entity gets its own id).
match_probability DOUBLE
Strongest pairwise match probability linking the row into its cluster, in [0, 1] (1.0 for a singleton).
Passthrough columns (vary by input) — shown for the (first_name, last_name, email) demo relation
first_name VARCHAR
Echo of the like-named input column (a comparison column in this demo).
last_name VARCHAR
Echo of the like-named input column (a comparison column in this demo).
email VARCHAR
Echo of the like-named input column (a comparison column in this demo).
Examples (8)

Dedup on name + email; the John/Jon Smith rows share a cluster_id, Jane Doe is separate.

SELECT first_name, last_name, email, cluster_id, match_probability
FROM match.main.match_resolve((SELECT * FROM (VALUES ('John','Smith','[email protected]'),('Jon','Smith','[email protected]'),('Jane','Doe','[email protected]')) AS t(first_name,last_name,email)), columns := 'first_name,last_name,email')
ORDER BY cluster_id, first_name;

Build a golden record per entity: resolve the built-in sample_customers demo on name + email and collapse each cluster to one row (lowest record_id, the first-name spellings seen, email, city, and how many source records merged) -- the three Smith variants and two Doe variants each become one row, the two Jones stay separate.

SELECT min(record_id) AS golden_record_id,
  string_agg(DISTINCT first_name, ' / ' ORDER BY first_name) AS name_variants,
  any_value(last_name) AS last_name, any_value(email) AS email,
  any_value(city) AS city, count(*) AS source_records
FROM match.main.match_resolve((SELECT record_id, first_name, last_name, email, city FROM match.main.sample_customers), columns := 'first_name,last_name,email')
GROUP BY cluster_id
ORDER BY golden_record_id;

Score the resolver against sample_customers' ground-truth expected_entity label: self-join the resolved rows into record pairs and count true/false positive and false negative links, with pairwise precision and recall (4 true links, no false ones: precision = recall = 1.0).

WITH resolved AS (SELECT record_id, expected_entity, cluster_id FROM match.main.match_resolve((SELECT record_id, first_name, last_name, email, expected_entity FROM match.main.sample_customers), columns := 'first_name,last_name,email')), pairs AS (SELECT a.cluster_id = b.cluster_id AS predicted_same, a.expected_entity = b.expected_entity AS actually_same FROM resolved AS a JOIN resolved AS b ON a.record_id < b.record_id) SELECT count(*) FILTER (WHERE predicted_same AND actually_same) AS true_pos, count(*) FILTER (WHERE predicted_same AND NOT actually_same) AS false_pos, count(*) FILTER (WHERE NOT predicted_same AND actually_same) AS false_neg, round(true_pos / nullif(true_pos + false_pos, 0), 3) AS precision, round(true_pos / nullif(true_pos + false_neg, 0), 3) AS recall
FROM pairs;
5 more examples

Check what dropping email costs: resolve sample_customers on first + last name only at threshold 0.7 and count clusters per ground-truth entity -- Jane/Janet Doe still link, but the John/Jon/Johnny Smith variants split into three clusters (under-merging).

SELECT expected_entity, count(*) AS records,
  count(DISTINCT cluster_id) AS clusters
FROM match.main.match_resolve((SELECT record_id, first_name, last_name, expected_entity FROM match.main.sample_customers), columns := 'first_name,last_name', threshold := 0.7)
GROUP BY expected_entity
ORDER BY expected_entity;

Surface only duplicate groups by clustering and keeping entities with more than one record.

SELECT cluster_id, count(*) AS rows_in_entity
FROM match.main.match_resolve((SELECT * FROM (VALUES ('John','Smith','[email protected]'),('Jon','Smith','[email protected]'),('Jane','Doe','[email protected]'),('Jayne','Doe','[email protected]'),('Bob','Ng','[email protected]')) AS t(first_name,last_name,email)), columns := 'first_name,last_name,email')
GROUP BY cluster_id
HAVING count(*) > 1
ORDER BY rows_in_entity DESC;

Stricter resolution: raise the link threshold and keep only the more-confident matches.

SELECT first_name, last_name, cluster_id, match_probability
FROM match.main.match_resolve((SELECT * FROM (VALUES ('John','Smith','[email protected]'),('Jon','Smith','[email protected]'),('Jane','Doe','[email protected]')) AS t(first_name,last_name,email)), columns := 'first_name,last_name,email', threshold := 0.9)
WHERE match_probability >= 0.5
ORDER BY cluster_id, first_name;
SELECT first_name, last_name, cluster_id
FROM match.main.match_resolve((SELECT * FROM (VALUES ('John','Smith','[email protected]'),('Jon','Smith','[email protected]'),('Jane','Doe','[email protected]')) AS t(first_name,last_name,email)), columns := 'first_name,last_name,email')
ORDER BY cluster_id, first_name;
SELECT count(DISTINCT cluster_id) AS entities
FROM match.main.match_resolve((SELECT * FROM (VALUES ('Ann','Lee','[email protected]'),('Anne','Lee','[email protected]'),('Bob','Ng','[email protected]')) AS t(first_name,last_name,email)), columns := 'first_name,last_name,email');
Link

Try these queries

Count how many records collapsed into each resolved entity, largest duplicate group first.

SELECT cluster_id, count(*) AS n
FROM match.main.match_resolve((SELECT * FROM (VALUES ('Ann','Lee'),('Anne','Lee'),('Bob','Ng')) AS t(first_name,last_name)), columns := 'first_name,last_name')
GROUP BY cluster_id
ORDER BY n DESC

Uses match_resolve

Build a golden record per entity: resolve the built-in sample_customers demo on name + email and collapse each cluster to one row (lowest record_id, the first-name spellings seen, email, city, and how many source records merged) -- the three Smith variants and two Doe variants each become one row, the two Jones stay separate.

SELECT min(record_id) AS golden_record_id,
  string_agg(DISTINCT first_name, ' / ' ORDER BY first_name) AS name_variants,
  any_value(last_name) AS last_name, any_value(email) AS email,
  any_value(city) AS city, count(*) AS source_records
FROM match.main.match_resolve((SELECT record_id, first_name, last_name, email, city FROM match.main.sample_customers), columns := 'first_name,last_name,email')
GROUP BY cluster_id
ORDER BY golden_record_id

Uses match_resolvesample_customers

Score the resolver against sample_customers' ground-truth expected_entity label: self-join the resolved rows into record pairs and count true/false positive and false negative links, with pairwise precision and recall (4 true links, no false ones: precision = recall = 1.0).

WITH resolved AS (SELECT record_id, expected_entity, cluster_id FROM match.main.match_resolve((SELECT record_id, first_name, last_name, email, expected_entity FROM match.main.sample_customers), columns := 'first_name,last_name,email')), pairs AS (SELECT a.cluster_id = b.cluster_id AS predicted_same, a.expected_entity = b.expected_entity AS actually_same FROM resolved AS a JOIN resolved AS b ON a.record_id < b.record_id) SELECT count(*) FILTER (WHERE predicted_same AND actually_same) AS true_pos, count(*) FILTER (WHERE predicted_same AND NOT actually_same) AS false_pos, count(*) FILTER (WHERE NOT predicted_same AND actually_same) AS false_neg, round(true_pos / nullif(true_pos + false_pos, 0), 3) AS precision, round(true_pos / nullif(true_pos + false_neg, 0), 3) AS recall
FROM pairs

Uses match_resolvesample_customers

Check what dropping email costs: resolve sample_customers on first + last name only at threshold 0.7 and count clusters per ground-truth entity -- Jane/Janet Doe still link, but the John/Jon/Johnny Smith variants split into three clusters (under-merging).

SELECT expected_entity, count(*) AS records,
  count(DISTINCT cluster_id) AS clusters
FROM match.main.match_resolve((SELECT record_id, first_name, last_name, expected_entity FROM match.main.sample_customers), columns := 'first_name,last_name', threshold := 0.7)
GROUP BY expected_entity
ORDER BY expected_entity

Uses match_resolvesample_customers

Count the sample records that belong to each ground-truth entity -- the planted duplicate groups match_resolve should reproduce.

SELECT expected_entity, count(*) AS records
FROM match.main.sample_customers
GROUP BY expected_entity
ORDER BY records DESC, expected_entity

Uses sample_customers

Inspect just the messy Smith records (three spelling variants of one real person) to see the kind of duplication entity resolution targets.

SELECT record_id, first_name, last_name, email
FROM match.main.sample_customers
WHERE last_name = 'Smith'
ORDER BY record_id

Uses sample_customers

5 more examples in the Catalog, each listed under the table or function it uses.

Match is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.