diff options
| author | Karsten Loesing <karsten.loesing@gmx.net> | 2018-08-31 08:47:57 +0200 |
|---|---|---|
| committer | Karsten Loesing <karsten.loesing@gmx.net> | 2018-08-31 08:47:57 +0200 |
| commit | deec83da277e5921977a17dd38262f7f91d93e7d (patch) | |
| tree | 9cebece3075966e1e33a6d2906c1944ec1e3f32a | |
| parent | 2cb74cd9bb6858b5442442f70667cdf5db75013f (diff) | |
squash! Reduce database size and variance of query response times.
- Improve logging to make it clear that the first query may take days
to return.
| -rwxr-xr-x | src/main/sql/exonerator2.sql | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/sql/exonerator2.sql b/src/main/sql/exonerator2.sql index 91682e6..9abf0ee 100755 --- a/src/main/sql/exonerator2.sql +++ b/src/main/sql/exonerator2.sql @@ -374,10 +374,13 @@ DECLARE BEGIN RAISE NOTICE '% Starting schema migration.', timeofday(); SELECT COUNT(*) INTO existing_rows FROM statusentry; - RAISE NOTICE '% Copying % rows from statusentry.', + RAISE NOTICE '% Sorting % rows in statusentry (this may take days!).', timeofday(), existing_rows; FOR rec IN SELECT * FROM statusentry ORDER BY fingerprint, validafter LOOP + IF copied_rows = 0 THEN + RAISE NOTICE '% Query returned, starting to copy.', timeofday(); + END IF; encoded_rawstatusentry := ENCODE(rec.rawstatusentry, 'escape'); matches := regexp_matches(encoded_rawstatusentry, '^r (\S+) (\S+) '); IF last_nickname IS NULL OR matches[1] != last_nickname THEN @@ -429,11 +432,14 @@ BEGIN SELECT COUNT(*) INTO existing_rows FROM exitlistentry; copied_rows := 0; last_printed_progress := 0; - RAISE NOTICE '% Copying % rows from from exitlistentry.', + RAISE NOTICE '% Sorting % rows in exitlistentry (this may take hours!).', timeofday(), existing_rows; FOR rec IN SELECT * FROM exitlistentry ORDER BY fingerprint, DATE(scanned) LOOP + IF copied_rows = 0 THEN + RAISE NOTICE '% Query returned, starting to copy.', timeofday(); + END IF; fingerprint_base64 := SUBSTRING(ENCODE(DECODE(rec.fingerprint, 'hex'), 'base64'), 1, 27); IF last_fingerprint_base64 IS NULL |
