commit 1400d7b99cd3e7ee32a58e0025ba2a56a16aa561 Author: Karsten Loesing karsten.loesing@gmx.net Date: Sat Jan 14 12:04:36 2012 +0100
Avoid SELECT MAX() on partitioned statusentry table.
For some reason, SELECT MAX() performs a full table scan on all child tables of a partitioned table. Good thing we have a non-partitioned table containing the consensuses that has the same information. --- .../torproject/ernie/web/RouterDetailServlet.java | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/org/torproject/ernie/web/RouterDetailServlet.java b/src/org/torproject/ernie/web/RouterDetailServlet.java index 033e9e6..677c293 100644 --- a/src/org/torproject/ernie/web/RouterDetailServlet.java +++ b/src/org/torproject/ernie/web/RouterDetailServlet.java @@ -71,7 +71,7 @@ public class RouterDetailServlet extends HttpServlet { + "FROM statusentry JOIN descriptor " + "ON descriptor.descriptor = statusentry.descriptor " + "WHERE statusentry.validafter = " - + "(SELECT MAX(validafter) FROM statusentry) " + + "(SELECT MAX(validafter) FROM consensus) " + "AND statusentry.fingerprint = ?";
try {
tor-commits@lists.torproject.org