I am relatively new to postgressql. We are using aurora postgressql.
I created a GIN index on a table with about 400k rows with one JSONB column. I created index on JSONB column.
CREATE INDEX index1 ON schemanm.tblname USING gin(colname) TABLESPACE pg_default;
The version i use is PostgreSQL 12.7
With the below query it does not use the gin index and does a seq scan
select count(*) from schemanm.tblname
where jsonb_path_match(colname,'($.colname.system == "X" ||$.colname.system == "Y") && $.colname.attra == "attrvala" && $.colname.attrb == "aatrvalb"' )
But the below uses index and gives the same result as the above query
select count(*) from schemanm.tblname
where colname @@ '($.colname.system == "X" ||$.colname.system == "Y") && $.colname.attra == "attrvala" && $.colname.attrb == "aatrvalb"'
Is there any difference between the queries or i am doing anything wrong