Hi Andreas, having only one session brings some seconds. When I run the queries in the GUI on the same server, I get this: (total number of positive hits) index:facets("collect", "flat")//element[@name = "selected"]/entry[text() = "yes"]/@count/data() takes 2 to 4 ms (number of phrasemes searched) count(distinct-values(//entry/phraseme/text())) takes 370 to 500 ms (create info table) for $phraseme in distinct-values(//entry/phraseme) let $nodes := //phraseme[text() = $phraseme] let $count := count($nodes[../selected[text() = "yes"]]) let $person := distinct-values($nodes/../person) order by $phraseme return<tr><td>({$phraseme})</td> <td>{$person}</td> <td>{$count}</td><td><a href="basex-show-phraseme.pl?phraseme={$phraseme}">anzeigen/aussortieren</a></td></tr> takes 1000 to 1400 ms (last timestamp) let $i := //entry/@time order by $i/@time ascending return <p>Letzte Bearbeitung: {data($i[last()])}</p> takes 250 to 380 ms However, I just switched to using count() for the number of phrasemes accessed. Before I took the distinct values, splitted them into an array, and then used the number of indices. And this probably took a lot of time. Using count() and dropping the splitting results in the page showing up in 2 to 3 seconds. Perfect! Thanks for helping! I will probably soon will ask for help with another slow process :-) Best regards Cerstin -- Dr. phil. Cerstin Mahlow Universität Basel Departement Sprach- und Literaturwissenschaften Fachbereich Deutsche Sprach- und Literaturwissenschaft Nadelberg 4 4051 Basel Schweiz Tel: +41 61 267 07 65 Fax: +41 61 267 34 40 Mail: cerstin.mahlow@unibas.ch Web: http://www.oldphras.net ________________________________________ Von: Andreas Weiler [andreas.weiler@uni-konstanz.de] Gesendet: Dienstag, 2. Oktober 2012 10:34 An: Cerstin Elisabeth Mahlow Cc: basex-talk@mailman.uni-konstanz.de Betreff: Re: [basex-talk] slow processing Hi Cerstin, can you check each single query contained in the script with the GUI and see how much time each one takes? Why are you creating a new session for each query? You should be able to take the same session for all queries. -- Andreas