bitnine-oss / agensgraph

AgensGraph, a transactional graph database based on PostgreSQL
http://www.agensgraph.org
Other
1.33k stars 148 forks source link

Agens Query planer behavior on data imported from the foreign table #538

Open ztestapp opened 3 years ago

ztestapp commented 3 years ago

We have a 3.77GB of data which contains 11 Vertex tables and 97 Edge tables(Totally 12471688 vertices and 15126883 edges). I have tried to import data using two different approaches in AgensGraph.

Approach 1 : As mentioned in the documentation dump data into a foreign table and import data using the LOAD FROM command. Approach 2 : Dump data into flat tables using the COPY command and import data from those tables using the LOAD FROM command.

Property indexes have been created on both databases and verified graph schemas using Pgadmin4's schema diff tools and there is no diff.

And also we ran VACUUM (ANALYZE) in both databases.

Now we tried variable length path query in both databases.

**MATCH p= (mc_src0:METHOD_CALL{CLASS_NAME:'CLASS_NAME1', METHOD_NAME: 'METHOD_NAME2'})-[*]-> (mc_sink0:METHOD_CALL{CLASS_NAME:'CLASS_NAME2', METHOD_NAME: 'METHOD_NAME2'}) RETURN p;**

Data imported from approach 1 never complete its execution(waited for more than an hour) Data imported from approach 2 return result in 1119.955 ms

Same query and Same data, then why there is two behavior. Does someone explain the technical reason behind this behavior ?

I have attached the query plan of that query from both databases. data_import_from_foriegn_table.log data_import_from_table.log

kysmou commented 2 years ago

It is incomprehensible that the plan comes out differently under the same data, the same statistical information, and the same index creation. Do you have different instance configurations or servers?