3

I'm facing a very serious problem when running a set of queries. I'm getting the following error: Time limit exceeded. I tried to run them each at a time and they returned. Although I've changed the default time limit, max time limit, session timeout ..., but the error message appears after approximately 1 minute. Note: I'm executing my query using Query Console. The error appears after 2147 seconds The attached photo is a screenshot of my server settings.time settings

How to solve this problem?

s.e
  • 271
  • 2
  • 15
  • None of your description says **how** you are running your code. That makes a big difference. Example- if you are using anything related to spawn, then you are in the wrong place. More detail will help. – David Ennis -CleverLlamas.com Jul 13 '16 at 23:14
  • I'm executing my query using **Query Console** – s.e Jul 14 '16 at 11:22
  • 1
    **An extremely long running query is usually an indication that something is "wrong" (not being done efficiently).** It would be helpful if you posted an example of your query. If it is taking that long, you are likely going to disk for a large number of documents. If it is a query, especially if a vanilla XPath statement not using `search:` or `cts:`, it may not be leveraging indexes effectively and/or filtering. If you need to go to disk for a large set of docs, you might consider leveraging CoRB2, which will break it up into N number of individual queries and combine the results for you. – Mads Hansen Jul 15 '16 at 13:00

2 Answers2

3

It can matter how exactly you're executing your queries (i.e.: HTTP, XDBC, QConsole). Try adding before your query, either:

xdmp:set-request-time-limit(3600)

or:

xdmp:set-transaction-time-limit(3600)
wst
  • 11,681
  • 1
  • 24
  • 39
  • I'm executing my query using **Query Console** – s.e Jul 14 '16 at 11:23
  • 1
    I've got this error `XDMP-TIMELIMIT: xdmp:set-request-time-limit(8000) -- Request time limit exceeds the maximum allowed` – s.e Jul 14 '16 at 18:41
  • 1
    @s.e You can't set the request time limit to a value above the one you set for `max time limit` on the server. – wst Jul 14 '16 at 19:02
  • 1
    I've changed them both to 8000 – s.e Jul 14 '16 at 19:11
  • You have tried both `xdmp:set-request-time-limit` and 'xdmp:set-transaction-time-limit'? – wst Jul 15 '16 at 00:41
  • Yes I have. I'm calling these functions in a for loop return `for ..... return ( myquery) [xdmp:set-request-time-limit(8000)]` . Is it possible that I'm putting them in a wrong place? – s.e Jul 15 '16 at 10:46
  • 2
    @s.e In a sequence, put the call first, followed by a comma, followed by your queries. Also, be sure that in the Content Source drop down list you have selected the same server that you have configured (from your screenshot). – wst Jul 15 '16 at 15:44
2

It sounds like a better approach to solving the problem is to improve your queries, instead of increasing time-out limits. Unless there's absolutely no other way to write the queries, index the data, or structure your data to make it more efficiently searched, you should be able to tune your queries to get acceptable performance.

More information about this is in the Query Performance and Tuning Guide on the MarkLogic site- http://docs.marklogic.com/guide/performance

Harry Bakken
  • 693
  • 6
  • 11