Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This would allow for an index-only lookup of the node, without needing the LIKE comparison or the attribute check.

Optimization: Faster look-ups for lists and list elements

...

Given the bookstore model where books are stored in a list, and given a path query //books[@price=15], using proposed solution, this would use a LIKE 'books[' to find potential matches.

...

The use of the LIKE operator in this case would result in O(N) time, as every fragment may need to be compared against the LIKE pattern. There is a solution which may push this case toward constant O(1) performance, namely adding the list name as an indexed column to the fragments table - note only list elements need this field populated, container nodes can set this field to NULL:

idparent_idanchor_idxpathxpath_componentlist_name
1NULL3/bookstorebookstoreNULL
213/bookstore/categories[@code='1']categories[@code='1']categories
323/bookstore/categories[@code='1']/books[@title='Matilda']books[@title='Matilda']books
423/bookstore/categories[@code='1']/books[@title='The Gruffalo']books[@title='The Gruffalo']books

Our query could be modified to replace the LIKE with an indexed look up:

...