On Mon, Jul 11, 2016 at 7:17 PM, Lizzi, Vincent <Vincent.Lizzi@taylorandfrancis.com> wrote:

I have a similar situation in which I want to get all distinct values of a specific attribute. I’ve tried using 2 different approaches: group and distinct-values. On small or medium size databases group tends to be faster. When trying to get distinct values of a specific attribute from large databases however both approaches are timing out for me. I’m looking for a way to optimize this query:

 

distinct-values(for $db in db:list() return distinct-values(db:open($db)//@sec-type))

 



With the current logic available it look possible given an attribute index on sec-type to associate a prefix onto the attribute value prior to insertion into the database like sec-type="type:13F" with the prefix type: and then use index:texts("dbname","type:") to get a distinct list of types all be it with a prefix that would need adjusting logic in using that data or querying.