By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
4 rows affected
4 rows affected
| id | res_id | path |
|---|---|---|
| 1 | res_1 | res_1 |
| 2 | res_1_1 | res_1.res_1_1 |
| 4 | res_1_1_1 | res_1.res_1_1.res_1_1_1 |
| id | res_id | path |
|---|---|---|
| 1 | res_1 | res_1 |
| 2 | res_1_1 | res_1.res_1_1 |
| 4 | res_1_1_1 | res_1.res_1_1.res_1_1_1 |
| QUERY PLAN |
|---|
| Index Scan using tbl_path_gist_idx on tbl_ltree (cost=8.28..16.30 rows=1 width=68) |
| Index Cond: (path @> $0) |
| InitPlan 1 (returns $0) |
| -> Index Scan using tbl_path_gist_idx on tbl_ltree tbl_ltree_1 (cost=0.13..8.15 rows=1 width=32) |
| Index Cond: (path ~ '*.res_1_1_1'::lquery) |
| id | res_id | path |
|---|---|---|
| 1 | res_1 | res_1 |
| 2 | res_1_1 | res_1.res_1_1 |
| 4 | res_1_1_1 | res_1.res_1_1.res_1_1_1 |