Thanks Thomas for your valuable insight! I already looked at the sql2_index.txt but wasnt sure how to interpret.
On Oak 1.0.0 my experience is I see Explain's in three variants /* property /* traverse /* Filter( --> I see this quite a bit actually ... Ive never seen /* ordered (even on ordered indices) Wrt to Filter( .. does this mean is will use MULTIPLE indexes? Or can it also result in a traversal query? Or a "mix" (get initial filter by property index and then "traverse" that result set checking for specific properties/attributes) On Wed, Jun 4, 2014 at 2:53 AM, Thomas Mueller <[email protected]> wrote: > Hi, > > I will try... You will find examples in the test file "sql2_index.txt" in > the source code. > > The plan contains the indexes that are used (one index per selector). The > index implementation itself decides what format to use. The format is not > yet stable; once we see more or different information is needed, the > format will be changed. > > >*Property*; denoted by "/* property" - This means the query will execute > >against a property or ordered index. > > The index that is in use is in the comment. The orderd index should use > "/* ordered ... */", not "/* property ... */". I'm not sure if that's > already the case. > > >Example: [nt:unstructured] as [a] /* property jcr:title where > >([a].[jcr:content/jcr:title] is not null) and (isdescendantnode([a], > >[/content])) */ > > In this case it's using the property index on the property "jcr:title". > > >Example: [nt:unstructured] as [a] /* traverse jcr:title where > >([a].[jcr:content/jcr:title] is not null) and (isdescendantnode([a], > >[/content])) */ > > This example is incorrect. A real-world example are: > > explain select * from [nt:base] where [jcr:uuid]=1 or [b]=2 > > [nt:base] as [nt:base] /* traverse "*" */ > > So, the conditions are not used here. It's traversing all nodes. > > explain select b.[jcr:uuid] from [nt:base] as a > inner join [nt:base] as b on isdescendantnode(b, a) > where (a.[jcr:uuid] = '1' or a.[jcr:uuid] = '2') > > [nt:base] as [a] /* property jcr:uuid > where ([a].[jcr:uuid] is not null) > and ([a].[jcr:uuid] in(cast('1' as string), cast('2' as string))) */ > inner join [nt:base] as [b] /* traverse "* && //path/from/join//*" */ > on isdescendantnode([b], [a]) > > Here, the selector "a" uses a property index on "jcr:uuid". The selector > "b" uses traversal, where the path is the one from selector "a". > > > > >*Filter*; denoted by "/* Filter(" - Not sure what this means... > > The filter is the list of conditions used by an index. I think it > shouldn't be included in the query plan - is it? If yes, probably we > should change the format as it is very verbose (it includes the query). > > Regards, > Thomas > >
