ClickHouse Managed Postgres로 마이그레이션한 후 데이터가 올바른지 검증하는 방법을 알아봅니다
모든 테이블의 개수 비교
마이그레이션 후 데이터가 정확한지 검증하는 간단한 방법은 원본 데이터베이스와 대상 데이터베이스의 모든 테이블 개수를 비교하는 것입니다. 이를 위해 두 데이터베이스에서 다음 쿼리를 실행할 수 있습니다.
SELECT table_name, (xpath('/row/cnt/text()', xml_count))[1]::text::bigint AS row_countFROM ( SELECT table_name, query_to_xml('SELECT count(*) AS cnt FROM ' || quote_ident(table_name), false, true, '') AS xml_count FROM information_schema.tables WHERE table_schema = 'public') tORDER BY table_name;