add remove split language show hidden hide
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
DROP TABLE
CREATE TABLE
INSERT 0 5
CREATE INDEX
id jsonb_col
1 {"order": {"amount": 100, "createdAt": "2025-08-10"}}
2 {"order": {"amount": 150, "createdAt": "2025-08-11"}}
3 {"order": {"amount": 250, "createdAt": "2025-08-12"}}
4 {"order": {"amount": 300, "createdAt": "2025-08-13"}}
5 {"order": {"amount": 400, "createdAt": "2025-08-14"}}
SELECT 5
id jsonb_col
3 {"order": {"amount": 250, "createdAt": "2025-08-12"}}
4 {"order": {"amount": 300, "createdAt": "2025-08-13"}}
5 {"order": {"amount": 400, "createdAt": "2025-08-14"}}
SELECT 3
SET
QUERY PLAN
Bitmap Heap Scan on my_table (cost=61.29..65.31 rows=1 width=36) (actual time=0.034..0.036 rows=3 loops=1)
  Recheck Cond: (jsonb_col @@ '($."order"."createdAt" >= "2025-08-12")'::jsonpath)
  Rows Removed by Index Recheck: 2
  Heap Blocks: exact=1
  Buffers: shared hit=4
  -> Bitmap Index Scan on my_index (cost=0.00..61.29 rows=1 width=0) (actual time=0.020..0.020 rows=5 loops=1)
        Index Cond: (jsonb_col @@ '($."order"."createdAt" >= "2025-08-12")'::jsonpath)
        Buffers: shared hit=3
Planning:
  Buffers: shared hit=17
Planning Time: 0.095 ms
Execution Time: 0.059 ms
EXPLAIN
INSERT 0 1
CREATE FUNCTION
CREATE INDEX
id jsonb_col
SELECT 0