20. Accelerating Analytical Queries using the AlloyDB Columnar Engine
2024. 12. 2. 07:58ㆍ클라우드/GCP
Task 1. Create Baseline Dataset for Testing the Columnar Engine
export ALLOYDB=ALLOYDB_ADDRESS |
echo $ALLOYDB > alloydbip.txt |
pgbench -h $ALLOYDB -U postgres -i -s 500 -F 90 -n postgres |
psql -h $ALLOYDB -U postgres |
select count (*) from pgbench_accounts; |
Task 2. Run a Baseline Test
\timing on |
SELECT aid, bid, abalance FROM pgbench_accounts WHERE bid < 189 OR abalance > 100 LIMIT 20; |
EXPLAIN (ANALYZE,COSTS,SETTINGS,BUFFERS,TIMING,SUMMARY,WAL,VERBOSE) SELECT count(*) FROM pgbench_accounts WHERE bid < 189 OR abalance > 100; |
Task 3. Verify the Database Flag for the Columnar Engine
Notice that the flag named google_columnar_engine.enabled is already enabled (status of on). You will not add an additional flag as part of this lab.
Task 4. Set or Verify a Database Extension for the Columnar Engine
1.Return to the alloydb-client shell. The psql client should still be active. If not, reconnect using the instructions in Task 1.
2.Ensure that you are connected to the postgres database by running the following query.
\c postgres |
\dx |
CREATE EXTENSION IF NOT EXISTS google_columnar_engine; |
\dx |
Task 5. Testing the Columnar Engine
SELECT google_columnar_engine_add('pgbench_accounts'); |
EXPLAIN (ANALYZE,COSTS,SETTINGS,BUFFERS,TIMING,SUMMARY,WAL,VERBOSE) SELECT count(*) FROM pgbench_accounts WHERE bid < 189 OR abalance > 100; |
참고 : https://www.cloudskillsboost.google/paths/22/course_templates/642/labs/501234
반응형
'클라우드 > GCP' 카테고리의 다른 글
22. Migrate to Cloud SQL for PostgreSQL using Database Migration Service (0) | 2024.12.04 |
---|---|
21. Create and Manage AlloyDB Instances: Challenge Lab (1) | 2024.12.03 |
19. Administering an AlloyDB Database (0) | 2024.11.27 |
18. Migrating to AlloyDB from PostgreSQL Using Database Migration Service (0) | 2024.11.26 |
17. AlloyDB - Database Fundamentals (0) | 2024.11.25 |