Skip to content

Commit

Permalink
Updates for LL 11679: Speed up your analytic queries (#622)
Browse files Browse the repository at this point in the history
* Removed an unneeded escape character

* Updates for new 23ai Livelab

---------

Co-authored-by: Andy Rivenes <[email protected]>
  • Loading branch information
TheInMemoryGuy and AndyRivenes authored Aug 12, 2024
1 parent 007988e commit 947c785
Show file tree
Hide file tree
Showing 7 changed files with 1,318 additions and 789 deletions.
682 changes: 0 additions & 682 deletions in-memory-23ai/aim-23ai/aim-high.md

This file was deleted.

1,221 changes: 1,221 additions & 0 deletions in-memory-23ai/aim-23ai/aim23.md

Large diffs are not rendered by default.

31 changes: 9 additions & 22 deletions in-memory-23ai/joins-aggregations/joins-aggregations.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ Watch the video below for a quick walk-through of the In-memory Joins and Aggreg

### Objectives

- Learn how to enable In-Memory on the Oracle Database
- Perform various queries on the In-Memory Column Store
- Learn how to joins and aggregations work with Database In-Memory.
- Perform joins and aggergations on the In-Memory Column Store.

### Prerequisites

This lab assumes you have:
- A Free Tier, Paid or LiveLabs Oracle Cloud account
- LiveLabs Oracle Cloud account
- You have completed:
- Get Started with noVNC Remote Desktop
- Lab: Initialize Environment
- Lab: Setting up the In-Memory Column Store

Expand All @@ -28,18 +27,12 @@ This lab assumes you have:

Up until now we have been focused on queries that scan only one table, the LINEORDER table. Let’s broaden the scope of our investigation to include joins and parallel execution. This section executes a series of queries that begin with a single join between the fact table, LINEORDER, and one or more dimension tables and works up to a 5 table join. The queries will be executed in both the buffer cache and the column store, to demonstrate the different ways the column store can improve query performance above and beyond just the basic performance benefits of scanning data in a columnar format.

Reload the environment variables for **CDB1** if you exited the terminal after the previous lab

```
<copy>. ~/.set-env-db.sh CDB1</copy>
```

Let's switch to the joins-aggr folder and log back in to the PDB:

```
<copy>
cd /home/oracle/labs/inmemory/joins-aggr
sqlplus ssb/Ora_DB4U@localhost:1521/pdb1
cd /home/oracle/workshops/inmemory/joins-aggr
sqlplus /nolog
</copy>
```

Expand All @@ -55,20 +48,14 @@ set lines 150
Query result:

```
[CDB1:oracle@dbhol:~/labs/inmemory]$ cd /home/oracle/labs/inmemory/joins-aggr
[CDB1:oracle@dbhol:~/labs/inmemory/joins-aggr]$ sqlplus ssb/Ora_DB4U@localhost:1521/pdb1
[oracle@livelabs aim23]$ cd /home/oracle/labs/inmemory/joins-aggr
[oracle@livelabs aim23]$ sqlplus /nolog
SQL*Plus: Release 23.0.0.0.0 - Production on Tue Jun 4 15:26:39 2024
Version 23.4.0.24.05
SQL*Plus: Release 23.0.0.0.0 - for Oracle Cloud and Engineered Systems on Mon Aug 12 16:50:16 2024
Version 23.5.0.24.07
Copyright (c) 1982, 2024, Oracle. All rights reserved.
Last Successful login time: Thu Aug 18 2022 21:37:24 +00:00
Connected to:
Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
Version 21.7.0.0.0
SQL> set pages 9999
SQL> set lines 150
SQL>
Expand Down
27 changes: 7 additions & 20 deletions in-memory-23ai/queries/queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ Watch the video below for a walk through of the In-Memory Queries lab:
### Prerequisites

This lab assumes you have:
- A Free Tier, Paid or LiveLabs Oracle Cloud account
- LiveLabs Oracle Cloud account
- You have completed:
- Get Started with noVNC Remote Desktop
- Lab: Initialize Environment
- Lab: Setting up the In-Memory Column Store

Expand All @@ -30,18 +29,12 @@ This lab assumes you have:

Now that you’ve gotten familiar with the IM column store let’s look at the benefits of using it. You will execute a series of queries against the large fact table LINEORDER, in both the buffer cache and the IM column store, to demonstrate the different ways the IM column store can improve query performance above and beyond the basic performance benefits of accessing data in memory only.

Reload the environment variables for **CDB1** if you exited the terminal after the previous lab

```
<copy>. ~/.set-env-db.sh CDB1</copy>
```

Let's switch to the queries folder and log back in to the PDB.

```
<copy>
cd /home/oracle/labs/inmemory/queries
sqlplus ssb/Ora_DB4U@localhost:1521/pdb1
cd /home/oracle/workshops/inmemory/queries
sqlplus /nolog
</copy>
```

Expand All @@ -57,20 +50,14 @@ set lines 150
Query result:

```
[CDB1:oracle@dbhol:~/labs/inmemory]$ cd /home/oracle/labs/inmemory/queries
[CDB1:oracle@dbhol:~/labs/inmemory/queries]$ sqlplus ssb/Ora_DB4U@localhost:1521/pdb1
[oracle@livelabs aim23]$ cd /home/oracle/workshops/inmemory/queries
[oracle@livelabs aim23]$ sqlplus ssb/Ora_DB4U@localhost:1521/pdb1
SQL*Plus: Release 23.0.0.0.0 - Production on Fri May 31 17:21:31 2024
Version 23.4.0.24.05
SQL*Plus: Release 23.0.0.0.0 - for Oracle Cloud and Engineered Systems on Mon Aug 12 16:50:16 2024
Version 23.5.0.24.07
Copyright (c) 1982, 2024, Oracle. All rights reserved.
Last Successful login time: Fri May 31 2024 17:19:47 -07:00
Connected to:
Oracle Database 23ai Enterprise Edition Release 23.0.0.0.0 - Production
Version 23.4.0.24.05
SQL> set pages 9999
SQL> set lines 150
SQL>
Expand Down
104 changes: 71 additions & 33 deletions in-memory-23ai/setup/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ Quick walk through on how to enable In-Memory.
### Prerequisites

This lab assumes you have:
- A Free Tier, Paid or LiveLabs Oracle Cloud account
- LiveLabs Oracle Cloud account
- You have completed:
- Get Started with noVNC Remote Desktop
- Lab: Initialize Environment

**NOTE:** *When doing Copy/Paste using the convenient* **Copy** *function used throughout the guide, you must hit the* **ENTER** *key after pasting. Otherwise the last line will remain in the buffer until you hit* **ENTER!**
Expand All @@ -35,18 +34,10 @@ In this Lab we will explore how the In-Memory column store is enabled in Oracle

1. Let's switch to the setup folder and log back in to the PDB:

Reload the environment variables for **CDB1** if you exited the terminal after the previous lab

```
<copy>. ~/.set-env-db.sh CDB1</copy>
```
Connect to **PDB1**
```
<copy>
cd /home/oracle/labs/inmemory/setup
sqlplus ssb/Ora_DB4U@localhost:1521/pdb1
cd /home/oracle/workshops/inmemory/setup
sqlplus /nolog
</copy>
```
Expand All @@ -62,20 +53,14 @@ In this Lab we will explore how the In-Memory column store is enabled in Oracle
Query result:
```
[CDB1:oracle@dbhol:~/labs/inmemory]$ cd /home/oracle/labs/inmemory/setup
[CDB1:oracle@dbhol:~/labs/inmemory/setup]$ sqlplus ssb/Ora_DB4U@localhost:1521/pdb1
[oracle@livelabs aim23]$ cd /home/oracle/workshops/inmemory/setup
[oracle@livelabs aim23]$ sqlplus ssb/Ora_DB4U@localhost:1521/pdb1
SQL*Plus: Release 23.0.0.0.0 - Production on Mon May 20 14:02:47 2024
Version 23.4.0.24.05
SQL*Plus: Release 23.0.0.0.0 - for Oracle Cloud and Engineered Systems on Mon Aug 12 16:50:16 2024
Version 23.5.0.24.07
Copyright (c) 1982, 2024, Oracle. All rights reserved.
Last Successful login time: Mon May 20 2024 13:50:04 -07:00
Connected to:
Oracle Database 23ai Enterprise Edition Release 23.0.0.0.0 - Production
Version 23.4.0.24.05
SQL> set pages 9999
SQL> set lines 150
SQL>
Expand Down Expand Up @@ -138,7 +123,7 @@ In this Lab we will explore how the In-Memory column store is enabled in Oracle
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
inmemory_size big integer 3312M
inmemory_size big integer 2800M
SQL>
SQL> show parameter inmemory_automatic_level
Expand Down Expand Up @@ -179,12 +164,12 @@ In this Lab we will explore how the In-Memory column store is enabled in Oracle
SQL>
SQL> show sga
Total System Global Area 8587393600 bytes
Fixed Size 5380672 bytes
Variable Size 469762048 bytes
Database Buffers 4630511616 bytes
Redo Buffers 8855552 bytes
In-Memory Area 3472883712 bytes
Total System Global Area 8587393888 bytes
Fixed Size 5380960 bytes
Variable Size 989855744 bytes
Database Buffers 4647288832 bytes
Redo Buffers 8855552 bytes
In-Memory Area 2936012800 bytes
SQL>
```
Expand Down Expand Up @@ -229,7 +214,7 @@ In this Lab we will explore how the In-Memory column store is enabled in Oracle
POOL ALLOC_BYTES USED_BYTES POPULATE_STATUS CON_ID
---------------- -------------------- -------------------- -------------------------- ----------
1MB POOL 3,288,334,336 0 DONE 3
1MB POOL 2,785,017,856 0 DONE 3
64KB POOL 167,772,160 0 DONE 3
IM POOL METADATA 16,777,216 16,777,216 DONE 3
Expand Down Expand Up @@ -478,16 +463,69 @@ In this Lab we will explore how the In-Memory column store is enabled in Oracle
64KB POOL 167,772,160 6,029,312 DONE 3
IM POOL METADATA 16,777,216 16,777,216 DONE 3
SQL>
```
9. Next we will run a Swingbench workload in order to generate enough workload to trigger the creation of AIM performance features. We will do this now to give the database time to analyze the workload and create any beneficial features. We will take a look at the results in the AIM lab.
Run the script *08\run\workload.sql
```
<copy>
@08_run_workload.sql
</copy>
```
or run the query below:
```
<copy>
set escape ^
host /usr/bin/nohup /home/oracle/swingbench/bin/charbench -c /home/oracle/inmemory/swingbench/SSB_Workload.xml ^&
prompt To view status of the Swingbench process exit sqlplus and type: tail -f nohup.out
prompt Use ctrl-C to exit
</copy>
```

Query result:

```
SQL> @08_run_workload.sql
Connected.
To view status of the Swingbench process exit sqlplus and type: tail -f nohup.out
Use ctrl-C to exit
SQL> /usr/bin/nohup: appending output to 'nohup.out'
SQL> exit
Disconnected from Oracle Database 23ai Enterprise Edition Release 23.0.0.0.0 - for Oracle Cloud and Engineered Systems
Version 23.5.0.24.07
[oracle@livelabs setup]$ tail -f nohup.out
Swingbench
Author : Dominic Giles
Version : 2.7.0.1470
Results will be written to results.xml
Hit Return to Terminate Run...
Time Users TPM TPS
^C05:42 PM 1 87 4
[oracle@livelabs setup]$ sqlplus /nolog
SQL*Plus: Release 23.0.0.0.0 - for Oracle Cloud and Engineered Systems on Thu Aug 8 18:05:53 2024
Version 23.5.0.24.07
Copyright (c) 1982, 2024, Oracle. All rights reserved.
SQL>
```
9. Lets also take a look at the current Heat Map statistics. Automatic In-Memory does not require that Heat Map be enabled, but under the covers it uses the same basic information. We will list that starting heat map statistics in this step and then we will take a look at the statistics in the last lab and compare that with how it affected AIM.
10. Lets also take a look at the current Heat Map statistics. Automatic In-Memory does not require that Heat Map be enabled, but under the covers it uses the same basic information. We will list that starting heat map statistics in this step and then we will take a look at the statistics in the last lab and compare that with how it affected AIM.
Run the script *08\_hm\_stats.sql*
Run the script *09\_hm\_stats.sql*
```
<copy>
@08_hm_stats.sql
@09_hm_stats.sql
</copy>
```
Expand Down
15 changes: 5 additions & 10 deletions in-memory-23ai/workshops/ocw24-sandbox/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,24 @@
"filename": "https://oracle-livelabs.github.io/common/labs/verify-compute/verify-compute-ssh-and-novnc.md"
},
{
"title": "Lab 2: Initialize Environment",
"description": "Initialize Environment",
"filename": "../../initialize-environment/initialize-environment.md"
},
{
"title": "Lab 3: Setting up the In-Memory Column Store",
"title": "Lab 2: Setting up the In-Memory Column Store",
"description": "Populating and administering the In-Memory column store",
"filename": "../../setup/setup.md"
},
{
"title": "Lab 4: Querying the In-Memory Column Store",
"title": "Lab 3: Querying the In-Memory Column Store",
"description": "Queries on In-Memory Column Store",
"filename": "../../queries/queries.md"
},
{
"title": "Lab 5: Joins and Aggregation",
"title": "Lab 4: Joins and Aggregation",
"description": "In-Memory Joins and Aggregation",
"filename": "../../joins-aggregations/joins-aggregations.md"
},
{
"title": "Lab 6: Automatic In-Memory in 23ai",
"title": "Lab 5: Automatic In-Memory in 23ai",
"description": "Using AIM in 23ai",
"filename": "../../aim-23ai/aim-high.md"
"filename": "../../aim-23ai/aim23.md"
},
{
"title": "Need Help?",
Expand Down
27 changes: 5 additions & 22 deletions in-memory-23ai/workshops/ocw24-tenancy/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,31 @@
"filename": "https://oracle-livelabs.github.io/common/labs/cloud-login/pre-register-free-tier-account.md"
},
{
"title": "Lab 1: Prepare Setup",
"description": "How to download your ORM stack and update security rules for an existing VCN",
"publisheddate": "09/28/2020",
"filename": "../../prepare-setup/prepare-setup.md",
"type": "basics"
},
{
"title": "Lab 2: Environment Setup",
"title": "Lab 1: Environment Setup",
"description": "How to provision the workshop environment and connect to it",
"publisheddate": "06/30/2020",
"filename": "https://oracle-livelabs.github.io/common/labs/setup-compute-generic/setup-compute-novnc-ssh.md"
},
{
"title": "Lab 3: Initialize Environment",
"description": "Initialize Environment",
"filename": "../../initialize-environment/initialize-environment.md"
},
{
"title": "Lab 4: Setting up the In-Memory Column Store",
"title": "Lab 2: Setting up the In-Memory Column Store",
"description": "Populating and administering the In-Memory column store",
"filename": "../../setup/setup.md"
},
{
"title": "Lab 5: Querying the In-Memory Column Store",
"title": "Lab 3: Querying the In-Memory Column Store",
"description": "Queries on In-Memory Column Store",
"filename": "../../queries/queries.md"
},
{
"title": "Lab 6: Joins and Aggregation",
"title": "Lab 4: Joins and Aggregation",
"description": "In-Memory Joins and Aggregation",
"filename": "../../joins-aggregations/joins-aggregations.md"
},
{
"title": "Lab 7: Automatic In-Memory in 23ai",
"title": "Lab 5: Automatic In-Memory in 23ai",
"description": "Using AIM in 23ai",
"filename": "../../aim-23ai/aim-high.md"
},
{
"title": "Environment Cleanup",
"description": "Cleanly dispose of all OCI resources created by ORM for the workshop, and delete the stack",
"filename": "https://oracle-livelabs.github.io/common/labs/cleanup-stack/cleanup-stack.md"
},
{
"title": "Need Help?",
"description": "Solutions to Common Problems and Directions for Receiving Live Help",
Expand Down

0 comments on commit 947c785

Please sign in to comment.