06 Route the OLAP workload — instructor notes
Teaching steps, verification checks, and recovery guidance for module 06.
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_analyticsuses a foreign table inch.shop_writeruses the local table inpublic.
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.