Hi Robert, thanks for your precise observations. I agree that the second query should have been optimized as well, and is now rewritten in the latest snapshot [1] (the optimizer was bold enough to reject all path expressions that contained any positional predicates).
Hope this helps, Christian [1] http://files.basex.org/releases/latest/ On Thu, Jan 30, 2014 at 3:25 PM, Robert schlichtner <r_schlicht...@hotmail.com> wrote: > Hello, > > I found that a number of similar queries have quite different performance: > > xquery > doc('mcev_temp_5/20140130_11_55_40.xml')//column[@name='KLV_m1_rdr']/v takes > only 0.68ms, which is great. > > But xquery > doc('mcev_temp_5/20140130_11_55_40.xml')//column[@name='KLV_m1_rdr']/v[1] > takes 1479.81ms. > > If I change this to the equivalent (for my data) xquery > (doc('mcev_temp_5/20140130_11_55_40.xml')//column[@name='KLV_m1_rdr'])/v[1] > it runs fast again (0.53ms) > > Checking the query execution plan I found that only query 1 and 3 utilize > the attribute index. > > I find this rather surprising, and I would like to ask if there is some > general reason/rule why the second can not use the index, so I can avoid > such 'bad' queries in the future. > > Thanks! > > (I am using BaseX 7.7.2 on Windows XP.) > > Regards, > > Robert > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk@mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk