By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE
INSERT 0 10000
INSERT 0 1
INSERT 0 10000
| QUERY PLAN |
|---|
| Seq Scan on leads (actual time=8.232..14.977 rows=1 loops=1) |
| Filter: (lower((user_details ->> 'name'::text)) ~~ '%doe%'::text) |
| Rows Removed by Filter: 20000 |
| Planning Time: 0.465 ms |
| Execution Time: 15.289 ms |
EXPLAIN
CREATE INDEX
| QUERY PLAN |
|---|
| Bitmap Heap Scan on leads (actual time=0.439..0.440 rows=1 loops=1) |
| Recheck Cond: (lower((user_details ->> 'name'::text)) ~~ '%doe%'::text) |
| Heap Blocks: exact=1 |
| -> Bitmap Index Scan on leads_user_details_name_idx (actual time=0.418..0.418 rows=1 loops=1) |
| Index Cond: (lower((user_details ->> 'name'::text)) ~~ '%doe%'::text) |
| Planning Time: 3.523 ms |
| Execution Time: 0.496 ms |
EXPLAIN