SQL> select department_id from employees;
DEPARTMENT_ID
90 90 90 60 60 60 50 50 50 50 50 80 80 80
10 20 20 110 110
20 rows selected.
Execution Plan
Plan hash value: 1445457117
Id | Operation | Name | Rows | Bytes | Cost (%CPU) | Time |
——————————————————————————-
0 | SELECT STATEMENT | 20 | 60 | 3 (0) | 00:00:01 | |
1 | TABLE ACCESS FULL | EMPLOYEES | 20 | 60 | 3 (0) | 00:00:01 |
——————————————————————————-
SQL> ed Wrote file afiedt.buf
1 select department_id from employees 2* group by department_id
SQL> /
DEPARTMENT_ID
90 20 110 50 80 60 10
8 rows selected.
Execution Plan
Plan hash value: 1192169904
Id | Operation | Name | Rows | Bytes | Cost (%CPU) | Time |
——————————————————————————–
0 | SELECT STATEMENT | 7 | 21 | 4 (25) | 00:00:01 | |
1 | HASH GROUP BY | 7 | 21 | 4 (25) | 00:00:01 | |
2 | TABLE ACCESS FULL | EMPLOYEES | 20 | 60 | 3 (0) | 00:00:01 |
——————————————————————————–
SQL> select distinct department_id from employees;
DEPARTMENT_ID
90 20 110 50 80 60 10
8 rows selected.
Execution Plan
Plan hash value: 3042654289
Id | Operation | Name | Rows | Bytes | Cost (%CPU) | Time |
——————————————————————————–
0 | SELECT STATEMENT | 7 | 21 | 4 (25) | 00:00:01 | |
1 | HASH UNIQUE | 7 | 21 | 4 (25) | 00:00:01 | |
2 | TABLE ACCESS FULL | EMPLOYEES | 20 | 60 | 3 (0) | 00:00:01 |
——————————————————————————–