arca1n opened a new issue, #1009:
URL: https://github.com/apache/age/issues/1009

   **Describe the bug**
   GIN indexes on Specific properties does not seem to work. This is basing off 
of the issue #954 
   
   **How are you accessing AGE (Command line, driver, etc.)?**
   - [e.g. JDBC]
   
   **What data setup do we need to do?**
   ```pgsql
   ...
   SELECT create_graph('cypher_index');
   SELECT create_vlabel('cypher_index', 'Movie');
   CREATE INDEX imdb ON cypher_index."Movie" USING gin 
((properties->'imdbRank'));
   SELECT * from cypher('cypher_index', $$
   CREATE
   (:Movie {id: 'movie1', name: 'The Shawshank Redemption', imdbRank : 25}),
   (:Movie {id: 'movie2', name: 'The Godfather', imdbRank : 60}),
   (:Movie {id: 'movie3', name: 'The Dark Knight', imdbRank : 100})
   $$) as (V agtype);
   ...
   -- Explain plans are not using the index
   SELECT * FROM cypher('cypher_index', $$ EXPLAIN ANALYZE MATCH(n:Movie) where 
n.imdbRank = 25 return n  $$) AS (a agtype);
   ```
   Result of the above EXPLAIN query
   ```
   "Seq Scan on ""Movie"" n  (cost=0.00..34.03 rows=6 width=32) (actual 
time=0.019..0.025 rows=1 loops=1)"
   "  Filter: (agtype_access_operator(VARIADIC ARRAY[_agtype_build_vertex(id, 
_label_name('91013'::oid, id), properties), '""imdbRank""'::agtype]) = 
'25'::agtype)"
     Rows Removed by Filter: 2
   Planning Time: 0.058 ms
   Execution Time: 0.037 ms
   ```
   Another EXPLAIN query using the MATCH by property
   ```
   
   SELECT * FROM cypher('cypher_index', $$ EXPLAIN ANALYZE MATCH(n:Movie 
{imdbRank: 25}) return n  $$) AS (a agtype);
   ```
   Result from the above plan
   ```
   "Seq Scan on ""Movie"" n  (cost=0.00..28.00 rows=1 width=32) (actual 
time=0.016..0.018 rows=1 loops=1)"
   "  Filter: (properties @> agtype_build_map('imdbRank'::text, '25'::agtype))"
     Rows Removed by Filter: 2
   Planning Time: 0.051 ms
   Execution Time: 0.031 ms
   
   ```
   
   
   **What is the necessary configuration info needed?**
   Just pg13 with the latest release of apache age
   
   **What is the command that caused the error?**
   ```pgsql
   SELECT * from cypher('my_graph_name', $$
     MATCH (a:Part {part_num: '123'}), (b:Part {part_num: '345'})
     CREATE (a)-[u:used_by { quantity: 1 }]->(b)
   $$) as (a agtype);
   ```
   ```
   ERROR:  something failed to execute
   ```
   
   **Expected behavior**
   The query should be hitting the GIN index
   
   **Environment (please complete the following information):**
   - Version: Postgres13 with the latest tag of Apache AGE compiled and added.
   
   **Additional context**
   Based on the discussions reported in other issues posted earlier indexing 
seems to be a bit of a riddle. I have been able to add uniqueness based on a 
unique index on a `property` in the json be example, but that index doesn't get 
used when running match queries.
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@age.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to