Postgres migrationClickHouse Workshops

06 Route the OLAP workload — instructor notes

Teaching steps, verification checks, and recovery guidance for module 06.

Your computer
macOS terminal: Run workshop commands in Terminal using zsh or bash.

Allow 45 to 60 minutes. Use the learner module for commands.

Verify role-specific routing

Read sql/06_pg_clickhouse.sql before running it. Grant access after importing the foreign tables and change only shop_analytics's search_path. Recycle Grafana's connections, then verify the setting in a fresh session.

Compare plans for the same query under both roles:

  • shop_analytics uses a foreign table in ch.
  • shop_writer uses the local table in public.

Run preflight before editing queries to confirm that routing preserves panel SQL.

Inspect pushdown

Record the extension version and inspect all eight plans. Look for aggregation in remote SQL. A Foreign Scan alone only establishes routing. Compare query text and result_rows in the ClickHouse log; read_rows counts source rows scanned within ClickHouse.

Use q7 as a candidate for repair, rather than promising that it fails in every version. If all panels push down, record that result and analyze a more complex query. Check that any repair preserves results, then apply it to both the panel and harness query.

Run the measurement

Stop Grafana and the standing writer so only harness load runs during measurement. Start the harness after the role setting changes. Keep the baseline load configuration. Read exit status, warnings, and errors, then save results/after.json with the configuration.

The comparison changes both the writer's database and the analytical engine. It does not isolate their effects or establish performance against an untested read replica. Record query edits with latency comparisons.

End checkpoint

Confirm role-specific plans, preflight, pushdown inspection, and a valid saved measurement. Proceed to the assessment and teardown.

Trên trang này

VI