Versions Compared

Key

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

Kiwi queries originating from LDP requests are run as prepared queries. In PSQL 9.1 and before, these queries are executed using a generic query plan, allowing for arbitrary entries for each variable (including pattern matching, etc...) in the executed query.

This started to become a problem for us after making some unrelated changes to the indexes and memory profile of our server. Typical GET requests for LDP-RSs result in handfuls of queries like:

...

In this case, we see a scan on idx_triples_spo, and a filter on context. The relevant context appears to be the base LDP graph, which contains many statements with common predicates and objects, but different subjects. The result of changing the query index to a more suitable plan for the executed query is a total query time of 0.044 ms; we see results up to 1.5 ms when running queries this way.  The shared buffer hit count is reduced to 4 accounting for the several thousand-fold performance difference.

...