Hi, Facing a big performance degradation while using sort query in subquery If I run query without sorting the response of my query is around 200 ms but when I use the order by query, performance comes to be around 4-5 seconds.
Here is my query : PREFIX text: <http://jena.apache.org/text#> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX skosxl: <http://www.w3.org/2008/05/skos-xl#> PREFIX relations: <https://cxdata.bold.com/ontologies/myDomain#> SELECT ?concept ?titleSkosxl ?title ?languageCode (GROUP_CONCAT(DISTINCT ?relatedTitle; separator=", ") AS ?relatedTitles) (GROUP_CONCAT(DISTINCT ?alternate; separator=", ") AS ?alternates) WHERE { (?titleSkosxl ?score) text:query ('cashier'). ?concept skosxl:prefLabel ?titleSkosxl. ?titleSkosxl skosxl:literalForm ?title. ?titleSkosxl relations:usedInLocale ?controlledList. ?controlledList relations:languageMarketCode ?languageCode FILTER(?languageCode = 'en-US'). # get alternate title OPTIONAL { Select ?alternate { ?concept skosxl:altLabel ?alternateSkosxl. ?alternateSkosxl skosxl:literalForm ?alternate; relations:hasUserCount ?alternateUserCount. } ORDER BY DESC (?alternateUserCount) LIMIT 10 } # get related titles OPTIONAL { Select ?relatedTitle { ?titleSkosxl relations:isRelatedTo ?relatedSkosxl. ?relatedSkosxl skosxl:literalForm ?relatedTitle; relations:hasUserCount ?relatedUserCount. } ORDER BY DESC (?relatedUserCount) LIMIT 10 } } GROUP BY ?concept ?titleSkosxl ?title ?languageCode ?alternateJobTitle ?notation ORDER BY DESC(?jobtitleWeight) DESC(?score) LIMIT 10 The sorting queries given causes huge performance degradation : ORDER BY DESC (?alternateUserCount) AND ORDER BY DESC (?relatedUserCount) How can this be improved, this sorting will be used in each and every query in my application. -- This email may contain material that is confidential, privileged, or for the sole use of the intended recipient. Any review, disclosure, reliance, or distribution by others or forwarding without express permission is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies, including attachments.
