Commit 42f10d8a authored by Hiro's avatar Hiro 🏄
Browse files

Update sql

parent 7bff63fb
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -234,7 +234,7 @@ BEGIN
  CREATE TEMPORARY TABLE IF NOT EXISTS merged_part_name AS
  SELECT * FROM merged
  WHERE DATE(merged.stats_start) IN (
    SELECT DISTINCT DATE(stats_start) FROM imported););
    SELECT DISTINCT DATE(stats_start) FROM imported);


  -- Explicitly lock the temporary table
@@ -599,7 +599,7 @@ BEGIN
    WHERE aggregated.date = aggregated_responses_bytes.date
    AND aggregated.node = aggregated_responses_bytes.node;

    RAISE NOTICE '% Deleting temporary tables update_no_dimensions and update.', timeofday();
    RAISE NOTICE '% Deleting temporary tables.', update_no_dimensions_temp_name, update_temp_name, timeofday();
    DROP TABLE update_no_dimensions_temp_name;
    DROP TABLE update_temp_name;

@@ -625,7 +625,7 @@ BEGIN

  BEGIN
    SELECT EXTRACT(EPOCH FROM current_timestamp)::bigint INTO current_timestamp;
    -- Generate a unique name for merged_part
    -- Generate a unique name for update_temp_name
    update2_temp_name text := 'pg_temp.update_temp_name_' || TO_CHAR(current_timestamp, 'YYYYMMDDHH24MISSUS');

  -- Create a new temporary table containing all relevant information
@@ -688,7 +688,7 @@ BEGIN
    AND transport.nickname = total.nickname
    GROUP BY country.date, country.country, transport.transport;

  RAISE NOTICE '% Deleting temporary table update2.', timeofday();
  RAISE NOTICE '% Deleting temporary table ', update2_temp_name, timeofday();
  DROP TABLE update2_temp_name;

  -- We're done combining new data.