How to get updated stats for a truncated table
We now used the following solution to ensure that all our raw data tables were filled:

CREATE OR REPLACE FUNCTION util.assert_table_not_empty(schema_tablename TEXT)
  RETURNS BOOLEAN AS $$
DECLARE
  result TEXT;
BEGIN
  -- * doesn't work if the first cell would be NULL
  EXECUTE 'SELECT 1 FROM ' || schema_tablename || ' LIMIT 1'
  INTO result;

  IF result is NULL
  THEN
    RAISE EXCEPTION 'assertion table not empty, failed for:
%', schema_tablename;
  END IF;
  RETURN result IS NULL;
END
$$ LANGUAGE 'plpgsql';


CREATE OR REPLACE FUNCTION raw_data.ensure_data()
  RETURNS VOID AS
$$
DECLARE
  tablename TEXT;
BEGIN


  FOR tablename IN SELECT table_schema || '.' || table_name
                   FROM information_schema.tables
                   WHERE table_schema IN ('raw_data')

  LOOP
    PERFORM util.assert_table_not_empty(tablename);
  END LOOP;
END;
$$ LANGUAGE 'plpgsql';

-- in the ETL parts:
SELECT raw_data.ensure_data();