cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

How to improve a GraphQL request taking 4 seconds to return all results?

LJRB
Graph Buddy

Hello
I have the following request in GraphQL

query NewDefaultResults {
  ARTICLE (first: 5000){
    id
    silhouette_score
    cluster {
      cluster_id
      node_id
      percent_articles_gt_ts
    }
    title
    sentence
    date_published {
      formatted
    }
    hour_published {
      formatted
    }
    link
    img_url
    source {
      title
    }
    favorite
    like
    read
    node_id
  }
}

It takes 5 seconds to return all the results. I analyzed the query.log file but I don't know what I can improve ?

This is the same request on the analyzer (translated thanks to the resolver I guess):

MATCH (aRTICLE:ARTICLE) RETURN aRTICLE { .id , .silhouette_score ,cluster: head([(aRTICLE)<-[:CONTAINS_ARTICLE]-(aRTICLE_cluster:CLUSTER) aRTICLE_cluster { .cluster_id ,node_id: apoc.cypher.runFirstColumn("RETURN ID(this)", {this: aRTICLE_cluster}, false), .percent_articles_gt_ts }]) , .title , .sentence ,date_published: { formatted: toString(aRTICLE.date_published) },hour_published: { formatted: toString(aRTICLE.hour_published) }, .link , .img_url ,source: head([(aRTICLE)-[:HAS_SOURCE]->(aRTICLE_source:SOURCE) aRTICLE_source{ .title }]) , .favorite , .like , .read ,node_id: apoc.cypher.runFirstColumn("RETURN ID(this)", {this: aRTICLE}, false)} ASaRTICLE LIMIT toInteger($first)

I don't know what to analyze in the query log analyzer to see if my request is okay or not

1 REPLY 1

Does it return all 5000 items?.. If so, why don't you paginate your query and return the items as small bites, perhaps 20 items per request.