Reputation: 6005
Why does this quite simple xquery takes 10min to execute in sql server (the 2mb xml document stored in one column) compared to 14 seconds when using oxygen/file based querying?
SELECT model.query('declare default element namespace "http://www.sbml.org/sbml/level2";
for $all_species in //species, $all_reactions in //reaction
where data($all_species/@compartment)="plasma_membrane" and $all_reactions/listOfReactants/speciesReference/@species=$all_species/@id
return <result>{data($all_species/@id)}</result>') from sbml;
Upvotes: 0
Views: 2351
Reputation: 6005
"//" kills MSSql, use a so exact path as possible instead: http://scarydba.wordpress.com/2009/11/30/xquery-for-idiots/
Upvotes: 5
Reputation: 294287
Do you have a schema declaration for your XML? Did you place appropiate indexes on it?
CREATE XML INDEX
(Transact-SQL) CREATE XML SCHEMA COLLECTION
(Transact-SQL)Upvotes: 1