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" ASC LIMIT 200
Query plan
EXPLAIN (ANALYZE, BUFFERS)
Limit (cost=1495.32..1507.84 rows=1 width=72) (actual time=39.785..39.829 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=39.783..39.825 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=39.518..39.519 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.368..0.369 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=37.964..37.965 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.244 ms
Execution Time: 39.956 ms