vesoft-inc / nebula-python

Client API of Nebula Graph in Python
191 stars 75 forks source link

Query statistics #263

Closed doublex closed 1 year ago

doublex commented 1 year ago

Is there a button to query nebula-python if a query was exhausting? Nebula is never slow - but I have the impression some queries are CPU expensive. I would like to pinpoint those.

wey-gu commented 1 year ago

Is there a button to query nebula-python if a query was exhausting? Nebula is never slow - but I have the impression some queries are CPU expensive. I would like to pinpoint those.

Would you mind describing more on your picture of this feature? Better with some reference that other lib provided similar functions?

doublex commented 1 year ago

Yes, sorry. Some query is causing a lot of CPU load on the Nebula server. Is there a profiler tool to find out which query it is? My first thought was a summary-feature like:

result = session.execute( statement )
slow_query = result.get_stats()
wey-gu commented 1 year ago

You could go with SHOW QUERIES, for now, we could only see like how long they were executed.

But normally long run queries are those we need to care about, right?

doublex commented 1 year ago

@wey-gu Thanks for everything!!

wey-gu commented 1 year ago

np, @doublex will SHOW QUERIES and KILL QUERY help?

doublex commented 1 year ago

You put me on the right track: https://docs.nebula-graph.io/3.4.0/3.ngql-guide/17.query-tuning-statements/1.explain-and-profile/ Best wishes!

wey-gu commented 1 year ago

Wow good to know it helped in some way.

Then I would recommend my blog post about this: https://www.siwei.io/ngql-execution-plan/ while it's Chinese only for now, if you can't read Chinese, I'll post the English version soon.(sorry about this)

doublex commented 1 year ago

@wey-gu Impressive! Thanks for everything!