[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [exonerator/master] Tweak new query towards using an existing index.



commit 8ddfc87840a00ef93990ebe5044bad9cf2f071d2
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Sat Sep 16 17:12:01 2017 +0200

    Tweak new query towards using an existing index.
---
 CHANGELOG.md                         |  6 ++++++
 src/main/resources/db/exonerator.sql | 12 ++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index e36c3bd..1dcee5d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+# Changes in version 1.0.1 - 2017-09-16
+
+ * Medium changes
+   - Tweak new query towards using an existing index.
+
+
 # Changes in version 1.0.0 - 2017-09-15
 
  * Major changes
diff --git a/src/main/resources/db/exonerator.sql b/src/main/resources/db/exonerator.sql
index 233b43c..425df5f 100755
--- a/src/main/resources/db/exonerator.sql
+++ b/src/main/resources/db/exonerator.sql
@@ -226,8 +226,10 @@ CREATE OR REPLACE FUNCTION search_by_address24_date (
   UNION
   SELECT DISTINCT NULL::BYTEA, validafter, NULL::CHARACTER, NULL::TEXT
       FROM statusentry
-      WHERE DATE(validafter) >= ''' || select_date || '''::DATE - 1
-      AND DATE(validafter) <= ''' || select_date || '''::DATE + 1
+      WHERE validafter BETWEEN (''' || select_date || '''::DATE - 1
+          || '' 00:00:00'')::TIMESTAMP WITHOUT TIME ZONE
+      AND (''' || select_date || '''::DATE + 1
+          || '' 23:59:59'')::TIMESTAMP WITHOUT TIME ZONE
   UNION
   SELECT rawstatusentry,
         validafter,
@@ -280,8 +282,10 @@ CREATE OR REPLACE FUNCTION search_by_address48_date (
   UNION
   SELECT DISTINCT NULL::BYTEA, validafter, NULL::CHARACTER, NULL::TEXT
       FROM statusentry
-      WHERE DATE(validafter) >= ''' || select_date || '''::DATE - 1
-      AND DATE(validafter) <= ''' || select_date || '''::DATE + 1
+      WHERE validafter BETWEEN (''' || select_date || '''::DATE - 1
+          || '' 00:00:00'')::TIMESTAMP WITHOUT TIME ZONE
+      AND (''' || select_date || '''::DATE + 1
+          || '' 23:59:59'')::TIMESTAMP WITHOUT TIME ZONE
   UNION
   SELECT rawstatusentry,
         validafter,

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits