Searching for: JULIA NIGEL (Jan. 1, 1990)
Explaining: dm + levenshtein
Phonetic codes with stronger Slavic/Germanic coverage. Edit distance ≤ 2 — precision filter applied on top of other modes.
SQL
SELECT "records_courtrecord"."id", "records_courtrecord"."first_name", "records_courtrecord"."last_name", "records_courtrecord"."middle_name", "records_courtrecord"."date_of_birth", "records_courtrecord"."nicknames", "records_courtrecord"."person_id", levenshtein_less_equal(UPPER("records_courtrecord"."first_name"), JULIA, 2) AS "_fn_dist", levenshtein_less_equal(UPPER("records_courtrecord"."last_name"), NIGEL, 2) AS "_ln_dist" FROM "records_courtrecord" WHERE (((DAITCH_MOKOTOFF(first_name) && DAITCH_MOKOTOFF(JULIA)) AND (DAITCH_MOKOTOFF(last_name) && DAITCH_MOKOTOFF(NIGEL))) AND "records_courtrecord"."date_of_birth" = 1990-01-01 AND levenshtein_less_equal(UPPER("records_courtrecord"."first_name"), JULIA, 2) <= 2 AND levenshtein_less_equal(UPPER("records_courtrecord"."last_name"), NIGEL, 2) <= 2) ORDER BY "records_courtrecord"."date_of_birth" DESC LIMIT 200
Query plan
EXPLAIN (ANALYZE, BUFFERS)
Limit (cost=1495.32..1507.84 rows=1 width=72) (actual time=32.061..32.104 rows=7.00 loops=1)
Buffers: shared hit=52
-> Bitmap Heap Scan on records_courtrecord (cost=1495.32..1507.84 rows=1 width=72) (actual time=32.059..32.100 rows=7.00 loops=1)
Recheck Cond: ((date_of_birth = '1990-01-01'::date) AND (daitch_mokotoff((last_name)::text) && '{658000}'::text[]))
Filter: ((daitch_mokotoff((first_name)::text) && '{180000,480000}'::text[]) AND (levenshtein_less_equal(upper((first_name)::text), 'JULIA'::text, 2) <= 2) AND (levenshtein_less_equal(upper((last_name)::text), 'NIGEL'::text, 2) <= 2))
Rows Removed by Filter: 3
Heap Blocks: exact=4
Buffers: shared hit=52
-> BitmapAnd (cost=1495.32..1495.32 rows=11 width=0) (actual time=31.801..31.802 rows=0.00 loops=1)
Buffers: shared hit=42
-> Bitmap Index Scan on idx_person_date_of_birth (cost=0.00..19.54 rows=2236 width=0) (actual time=0.418..0.419 rows=2196.00 loops=1)
Index Cond: (date_of_birth = '1990-01-01'::date)
Index Searches: 1
Buffers: shared hit=6
-> Bitmap Index Scan on idx_person_last_name_dm (cost=0.00..1475.54 rows=270000 width=0) (actual time=30.279..30.279 rows=126512.00 loops=1)
Index Cond: (daitch_mokotoff((last_name)::text) && '{658000}'::text[])
Index Searches: 1
Buffers: shared hit=36
Planning:
Buffers: shared hit=328
Planning Time: 2.126 ms
Execution Time: 32.224 ms