Searching for: JULIA NIGEL (Jan. 1, 1990)
Explaining: soundex
Phonetic pre-filter using SOUNDEX codes.
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" FROM "records_courtrecord" WHERE (((SOUNDEX(first_name) = SOUNDEX(JULIA)) AND (SOUNDEX(last_name) = SOUNDEX(NIGEL))) AND "records_courtrecord"."date_of_birth" = 1990-01-01) ORDER BY "records_courtrecord"."date_of_birth" DESC LIMIT 200
Query plan
EXPLAIN (ANALYZE, BUFFERS)
Limit (cost=2297.25..2309.59 rows=1 width=64) (actual time=47.071..47.133 rows=7.00 loops=1)
Buffers: shared hit=207 read=1
-> Bitmap Heap Scan on records_courtrecord (cost=2297.25..2309.59 rows=1 width=64) (actual time=47.069..47.130 rows=7.00 loops=1)
Recheck Cond: ((date_of_birth = '1990-01-01'::date) AND (soundex((first_name)::text) = 'J400'::text))
Filter: (soundex((last_name)::text) = 'N240'::text)
Rows Removed by Filter: 46
Heap Blocks: exact=13
Buffers: shared hit=207 read=1
-> BitmapAnd (cost=2297.25..2297.25 rows=11 width=0) (actual time=46.939..46.940 rows=0.00 loops=1)
Buffers: shared hit=194 read=1
-> Bitmap Index Scan on idx_person_date_of_birth (cost=0.00..19.54 rows=2236 width=0) (actual time=0.361..0.361 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_first_name_soundex (cost=0.00..2277.47 rows=270000 width=0) (actual time=44.625..44.625 rows=220388.00 loops=1)
Index Cond: (soundex((first_name)::text) = 'J400'::text)
Index Searches: 1
Buffers: shared hit=188 read=1
Planning:
Buffers: shared hit=281
Planning Time: 2.163 ms
Execution Time: 47.239 ms