puppetlabs/puppetdb — pull request #633 by nicklewis (2013-09-06 19:30:38+00:00)
Title: Use a faster query to retrieve report_timestamp

This was performing a correlated subquery with an ORDER BY clause on reports
in order to retrieve the latest report for each node, which is slow and runs
many times. Now we take advantage of the latest_reports table to make fetching
the latest report inexpensive. In testing, the round trip time for /v2/nodes
with 179 nodes went from ~700ms to ~33ms.