Parsing the text of a query

Hi,
I've two questions:

(1) I'm wondering how I can see the breakdown of query execution on the stardog server (eg, version 8). I'm interested to know parsing time of a query as well.

(2) I have a bunch of queries within their texts, some prefixes are used. I have also the full list of all prefixes which are something around 70 different prefixes. I just want to be lazy here and either import all the prefixes as namespaces to the stardog server or just append all of the prefixes to all of the queries. It means each query will have 70 prefixes even though all the prefixes are not used with the text. But I have no idea about its performance implications and overhead. So, it would be great if you could let me know how these two approaches that I mentioned are different in the query execution from the internal implementation and technical point of view of the stardog server.
Thank you.

Hi,

  1. If you run the query profiler (stardog query explain --profile on the CLI or Run Profiler from the dropdown menu next to Show Plan in Studio), you'll get exactly what you're asking for. It will break down the query plan and show you the time taken and memory used by each of the Joins/Scans/etc, and also includes query execution time and number of results

  2. If you format the prefixes in Turtle format, you can use the stardog namespace import command on the CLI to import all namespaces in the file. This is certainly easier than appending 70 prefixes to each query

1 Like

Hi @stephen
Thank you for your reply.
I checked Run Profiler from the dropdown menu next to Show Plan in Studio. It's cool. I have now another question. I did not understand these two metrics. I hope you do not mind if I ask what are includes in the pre-execution? Is query text parsing included as well. Is it just server-side calculation, right? I mean the communication time between Studio and server is not included, right?

Pre-execution time: 200 ms (64.1%)
Post-processing time: 0 ms (0.0%)

What about post-processing?

Correct, this is only server-side processing and currently it does not account for parsing time. We start measuring at optimisation, after it's been determined that the query is syntactically valid (this can change in the future).

Post-processing is mostly decoding the final query results from the internal representation to human-readable RDF terms. This mostly matters for queries with large result sets.

Best,
Pavel

1 Like

Thank you @pavel
I see. I think Post-processing refers to the row mapping. For instance, the server sends a payload something like below and in the client-side it will be mapped to a let's say tabular form for the sake of human-readability.

{
  "head": {
    "vars": [
      "id",
      "label",
      "type"
    ]
  },
  "results": {
    "bindings": [
      {
        "id": {
          "type": "uri",
          "value": "http://X2"
        },
        "label": {
          "type": "literal",
          "value": "Management"
        },
        "type": {
          "type": "uri",
          "value": "http://ABILITY"
        }
      },
      {
        "id": {
          "type": "uri",
          "value": "http://Class42"
        },
        "label": {
          "type": "literal",
          "value": "Man"
        },
        "type": {
          "type": "uri",
          "value": "CAP"
        }
      }
    ]
  }
}

No. Everything in the profiler output is measured solely on the server-side. Studio or the CLI clients are not involved in that process at all.

Best,
Pavel

1 Like