SlideShare a Scribd company logo
1 of 46
Download to read offline


1
∼


2
3
4
5
select count(1) from foober;
6
select count(1) from foober;
7
select count(1) from foober;
8
select count(1) from foober;
9
select count(1) from foober;
10
select count(1) from foober;
11
select count(1) from foober;
12
select count(1) from foober;
13
select count(1) from foober;
14
select count(1) from foober;
15
16
17
select count(1) from foober;
・
・
・
・
18
・
・
・
・
SCOTT> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN 1 AND 10
7 AND status = '00'
8* AND ROWNUM <= 101
COUNT(1)
----------
101
SCOTT> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN 1 AND 10
7* AND status = '00'
COUNT(1)
----------
10000
SCOTT> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN 1 AND 10
7 AND status = '00'
8* AND ROWNUM <= 1
COUNT(1)
----------
1
SCOTT> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN 1 AND 10
7* AND status = '01'
COUNT(1)
----------
0
19
・
・
・
・
SCOTT> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN 1 AND 10
7* AND status = '00'
COUNT(1)
----------
10000
SCOTT> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN :1 AND :2
7 AND status = :3
8* AND ROWNUM <= :4
COUNT(1)
----------
1
COUNT(1)
----------
101
SCOTT> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN 1 AND 10
7* AND status = ’01'
COUNT(1)
----------
0
20
・
・
・
・
SCOTT> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN 1 AND 10
7* AND status = '00'
COUNT(1)
----------
10000
SCOTT> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN :1 AND :2
7 AND status = :3
8* AND ROWNUM <= :4
COUNT(1)
----------
1
COUNT(1)
----------
101
SCOTT> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN 1 AND 10
7* AND status = ’01'
AND ROWNUM <= 1
COUNT(1)
----------
0
21
・
・
・
・
SCOTT> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN :1 AND :2
7* AND status = :3
COUNT(1)
----------
10000
SCOTT> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN :1 AND :2
7 AND status = :3
8* AND ROWNUM <= :4
COUNT(1) — タイプ2
----------
101
COUNT(1) — タイプ3
----------
1
COUNT(1) — タイプ4
----------
0
22
23
24
★表
 SQL> desc count4emptyset
 名前 NULL? 型
 ----------------------------------------- -------- ----------------------------
 ID NOT NULL NUMBER
 BRANCH# NOT NULL NUMBER
 STATUS NOT NULL CHAR(2)
 DATA CHAR(500)
★索引
 INDEX_NAME COLUMN_NAME DESC
 ------------------------------ ------------------------------ ----
 PK_COUNT4EMPTYSET ID ASC
 BRANCH# ASC
★列統計
 COLUMN_NAME NUM_DISTINCT NUM_NULLS HISTOGRAM
 ------------------------------ ------------ ---------- ---------------
 ID 1000 0 NONE
 BRANCH# 1999 0 NONE
 STATUS 1 0 FREQUENCY
 DATA 1000 0 NONE
★索引統計
 INDEX_NAME DISTINCT_KEYS NUM_ROWS CLUSTERING_FACTOR
 ------------------------------ ------------- ---------- -----------------
 PK_COUNT4EMPTYSET 1000000 1000000 987729
25
SCOTT> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN 1 AND 10
7* AND status = '00'
COUNT(1)
----------
10000
---------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows |..| Cost (%CPU)|..|
---------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 |..| 9931 (1)|..|
| 1 | SORT AGGREGATE | | 1 |..| |..|
|* 2 | TABLE ACCESS BY INDEX ROWID BATCHED| COUNT4EMPTYSET | 10008 |..| 9931 (1)|..|
|* 3 | INDEX RANGE SCAN | PK_COUNT4EMPTYSET | 10009 |..| 42 (0)|..|
---------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter("STATUS"='00')
3 - access("ID">=1 AND "ID"<=10)
26
SCOTT> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN 1 AND 10
7* AND status = '00'
COUNT(1)
----------
10000
---------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows |..| Cost (%CPU)|..|
---------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 |..| 9931 (1)|..|
| 1 | SORT AGGREGATE | | 1 |..| |..|
|* 2 | TABLE ACCESS BY INDEX ROWID BATCHED| COUNT4EMPTYSET | 10008 |..| 9931 (1)|..|
|* 3 | INDEX RANGE SCAN | PK_COUNT4EMPTYSET | 10009 |..| 42 (0)|..|
---------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter("STATUS"='00')
3 - access("ID">=1 AND "ID"<=10)
27
SCOTT> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN 1 AND 10
7* AND status = '00'
COUNT(1)
----------
10000
---------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows |..| Cost (%CPU)|..|
---------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 |..| 9931 (1)|..|
| 1 | SORT AGGREGATE | | 1 |..| |..|
|* 2 | TABLE ACCESS BY INDEX ROWID BATCHED| COUNT4EMPTYSET | 10008 |..| 9931 (1)|..|
|* 3 | INDEX RANGE SCAN | PK_COUNT4EMPTYSET | 10009 |..| 42 (0)|..|
---------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter("STATUS"='00')
3 - access("ID">=1 AND "ID"<=10)
28
---------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows |..| Cost (%CPU)|..|
---------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 |..| 9931 (1)|..|
| 1 | SORT AGGREGATE | | 1 |..| |..|
|* 2 | TABLE ACCESS BY INDEX ROWID BATCHED| COUNT4EMPTYSET | 10008 |..| 9931 (1)|..|
|* 3 | INDEX RANGE SCAN | PK_COUNT4EMPTYSET | 10009 |..| 42 (0)|..|
---------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter("STATUS"='00')
3 - access("ID">=1 AND "ID"<=10)
統計
----------------------------------------------------------
0 recursive calls
0 db block gets
9893 consistent gets
0 physical reads
0 redo size
・・・・・ 略 ・・・・・・・
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
29
SCOTT> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN 1 AND 10
7* AND status = '00'
COUNT(1)
----------
10000
統計
-----------------------------
・・・・略・・・・
9893 consistent gets
0 physical reads
・・・・略・・・・
SCOTT> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN 1 AND 10
7* AND status = '01'
COUNT(1)
----------
0
統計
-----------------------------
・・・・略・・・・
9893 consistent gets
0 physical reads
・・・・略・・・・
30
---------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows |..| Cost (%CPU)|..|
---------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 |..| 9931 (1)|..|
| 1 | SORT AGGREGATE | | 1 |..| |..|
|* 2 | TABLE ACCESS BY INDEX ROWID BATCHED| COUNT4EMPTYSET | 10008 |..| 9931 (1)|..|
|* 3 | INDEX RANGE SCAN | PK_COUNT4EMPTYSET | 10009 |..| 42 (0)|..|
---------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter("STATUS"='00')
3 - access("ID">=1 AND "ID"<=10)
統計
----------------------------------------------------------
・・・・・ 略 ・・・・・・・
9893 consistent gets
・・・・・ 略 ・・・・・・・
31
32
----------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 7 | 27 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 7 | | |
|* 2 | INDEX RANGE SCAN| IX1_COUNT4EMPTYSET | 10008 | 70056 | 27 (0)| 00:00:01 |
----------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("ID">=1 AND "STATUS"='00' AND "ID"<=10)
filter("STATUS"='00')
統計
----------------------------------------------------------
・・・・略・・・・
26 consistent gets
・・・・略・・・
治療済!
33
SQL> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN 1 AND 10
7 AND status = '00'
8* AND ROWNUM <= 101
COUNT(1)
----------
101
----------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows |..| Cost (%CPU)|..|
----------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 |..| 104 (0)|..|
| 1 | SORT AGGREGATE | | 1 |..| |..|
|* 2 | COUNT STOPKEY | | |..| |..|
|* 3 | TABLE ACCESS BY INDEX ROWID BATCHED| COUNT4EMPTYSET | 102 |..| 104 (0)|..|
|* 4 | INDEX RANGE SCAN | PK_COUNT4EMPTYSET | 10009 |..| 3 (0)|..|
----------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter(ROWNUM<=101)
3 - filter("STATUS"='00')
4 - access("ID">=1 AND "ID"<=10)
34
SCOTT> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN 1 AND 10
7 AND status = '00'
8* AND ROWNUM <= 101
COUNT(1)
----------
101
統計
----------------------------
・・・・略・・・・
103 consistent gets
・・・・略・・・・
SCOTT> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN 1 AND 10
7 AND status = '01'
8* AND ROWNUM <= 101
COUNT(1)
----------
0
統計
----------------------------
・・・・略・・・・
9893 consistent gets
・・・・略・・・・
35
SCOTT> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN 1 AND 10
7 AND status = '00'
8* AND ROWNUM <= 1
COUNT(1)
----------
1
統計
----------------------------
・・・・略・・・・
4 consistent gets
・・・・略・・・・
SCOTT> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN 1 AND 10
7 AND status = '01'
8* AND ROWNUM <= 1
COUNT(1)
----------
0
統計
----------------------------
・・・・略・・・・
9893 consistent gets
・・・・略・・・・
36
SCOTT> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN 1 AND 10
7 AND status = '01'
8* AND ROWNUM <= 1
COUNT(1)
----------
0
統計
----------------------------
・・・・略・・・・
9893 consistent gets
・・・・略・・・・
SCOTT> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN 1 AND 10
7 AND status = ’00'
8* AND ROWNUM <= 1
COUNT(1)
----------
1
統計
----------------------------
・・・・略・・・・
4 consistent gets
・・・・略・・・・
37
∼
----------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows |..| Cost (%CPU)|..|
----------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 |..| 9931 (1)|..|
| 1 | SORT AGGREGATE | | 1 |..| |..|
|* 2 | COUNT STOPKEY | | |..| |..|
|* 3 | TABLE ACCESS BY INDEX ROWID BATCHED| COUNT4EMPTYSET | 1 |..| 9931 (1)|..|
|* 4 | INDEX RANGE SCAN | PK_COUNT4EMPTYSET | 10009 |..| 42 (0)|..|
----------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter(ROWNUM<=101)
3 - filter("STATUS"='01')
4 - access("ID">=1 AND "ID"<=10)
38
----------------------------------------------------------------------------
| Id | Operation | Name | Rows |..| Cost (%CPU)|..|
----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 |..| 3 (0)|..|
| 1 | SORT AGGREGATE | | 1 |..| |..|
|* 2 | COUNT STOPKEY | | |..| |..|
|* 3 | INDEX RANGE SCAN| IX1_COUNT4EMPTYSET | 102 |..| 3 (0)|..|
----------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter(ROWNUM<=101)
3 - access("ID">=1 AND "STATUS"='00' AND "ID"<=10)
filter("STATUS"='00')
COUNT(1)
----------
101
統計
-----------------------------
・・・・略・・・・
3 consistent gets
・・・・略・・・・
COUNT(1)
----------
0
統計
-----------------------------
・・・・略・・・・
24 consistent gets
・・・・略・・・・
∼
COUNT(1)
----------
1
統計
-----------------------------
・・・・略・・・・
4 consistent gets
・・・・略・・・・
治療済!
3939
・
・
・
・
SCOTT> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN :1 AND :2
7* AND status = :3
SCOTT> r
1 SELECT
2 COUNT(1)
3 FROM
4 count4emptyset
5 WHERE
6 id BETWEEN :1 AND :2
7 AND status = :3
8* AND ROWNUM <= :4
+INDEX_NAME COLUMN_NAME
------------------------------ ------------------------------
IX1_COUNT4EMPTYSET ID
STATUS
治療完!
40
41
42
SELECT
/*+
LEADING(t01 t02 t03)
USE_NL(t01 t02 t03)
INDEX(t01 ix01_count4emptyset)
INDEX(t02 ix01_count4emptyset_b)
INDEX(t03 ix01_count4emptyset_c)
*/
COUNT(1)
FROM
count4emptyset t01
INNER JOIN count4emptyset_b t02
ON
t01.id = t02.id
AND t01.branch# = t02.branch#
AND t02.status = '00'
INNER JOIN count4emptyset_c t03
ON
t02.id = t03.id
AND t02.branch# = t03.branch#
AND t03.status = '01'
WHERE
t01.id BETWEEN 1 AND 10
AND t01.status = '00'
AND ROWNUM <= 1;
43
--------------------------------------------------------------------
| Id | Operation | Name |..| A-Rows |..
--------------------------------------------------------------------
| 0 | SELECT STATEMENT | |..| 1 |..
| 1 | SORT AGGREGATE | |..| 1 |..
|* 2 | COUNT STOPKEY | |..| 0 |..
| 3 | NESTED LOOPS | |..| 0 |..
| 4 | NESTED LOOPS | |..| 10000 |..
|* 5 | INDEX RANGE SCAN| IX01_COUNT4EMPTYSET |..| 10000 |..
|* 6 | INDEX RANGE SCAN| IX01_COUNT4EMPTYSET_B |..| 10000 |..
|* 7 | INDEX RANGE SCAN | IX01_COUNT4EMPTYSET_C |..| 0 |..
--------------------------------------------------------------------
∼
統計
------------------------------
・・・・略・・・・
812 consistent gets
0 physical reads
・・・・略・・・・
統計
------------------------------
・・・・略・・・・
9 consistent gets
0 physical reads
・・・・略・・・・
44
http://discus-hamburg.cocolog-nifty.com/mac_de_oracle/2012/04/index-inde-only.html
http://discus-hamburg.cocolog-nifty.com/mac_de_oracle/2013/06/rownum-1-a44c.html
http://discus-hamburg.cocolog-nifty.com/mac_de_oracle/2014/07/table-access-by.html
45
http://www.jpoug.org
✌46

More Related Content

What's hot

Percona live-2012-optimizer-tuning
Percona live-2012-optimizer-tuningPercona live-2012-optimizer-tuning
Percona live-2012-optimizer-tuningSergey Petrunya
 
ANALYZE for executable statements - a new way to do optimizer troubleshooting...
ANALYZE for executable statements - a new way to do optimizer troubleshooting...ANALYZE for executable statements - a new way to do optimizer troubleshooting...
ANALYZE for executable statements - a new way to do optimizer troubleshooting...Sergey Petrunya
 
Exadata - Smart Scan Testing
Exadata - Smart Scan TestingExadata - Smart Scan Testing
Exadata - Smart Scan TestingMonowar Mukul
 
Oracle Diagnostics : Explain Plans (Simple)
Oracle Diagnostics : Explain Plans (Simple)Oracle Diagnostics : Explain Plans (Simple)
Oracle Diagnostics : Explain Plans (Simple)Hemant K Chitale
 
Design and Develop SQL DDL statements which demonstrate the use of SQL objec...
 Design and Develop SQL DDL statements which demonstrate the use of SQL objec... Design and Develop SQL DDL statements which demonstrate the use of SQL objec...
Design and Develop SQL DDL statements which demonstrate the use of SQL objec...bhavesh lande
 
Loopback.vhd
Loopback.vhdLoopback.vhd
Loopback.vhdsachindb9
 
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013Sergey Petrunya
 
More than 12 More things about Oracle Database 12c
More than 12 More things about Oracle Database 12cMore than 12 More things about Oracle Database 12c
More than 12 More things about Oracle Database 12cGuatemala User Group
 
Basic Query Tuning Primer - Pg West 2009
Basic Query Tuning Primer - Pg West 2009Basic Query Tuning Primer - Pg West 2009
Basic Query Tuning Primer - Pg West 2009mattsmiley
 
New Tuning Features in Oracle 11g - How to make your database as boring as po...
New Tuning Features in Oracle 11g - How to make your database as boring as po...New Tuning Features in Oracle 11g - How to make your database as boring as po...
New Tuning Features in Oracle 11g - How to make your database as boring as po...Sage Computing Services
 
Oracle12c For Developers
Oracle12c For DevelopersOracle12c For Developers
Oracle12c For DevelopersAlex Nuijten
 
DataStax: A deep look at the CQL WHERE clause
DataStax: A deep look at the CQL WHERE clauseDataStax: A deep look at the CQL WHERE clause
DataStax: A deep look at the CQL WHERE clauseDataStax Academy
 
A deep look at the cql where clause
A deep look at the cql where clauseA deep look at the cql where clause
A deep look at the cql where clauseBenjamin Lerer
 
MariaDB: Engine Independent Table Statistics, including histograms
MariaDB: Engine Independent Table Statistics, including histogramsMariaDB: Engine Independent Table Statistics, including histograms
MariaDB: Engine Independent Table Statistics, including histogramsSergey Petrunya
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeWim Godden
 

What's hot (19)

Percona live-2012-optimizer-tuning
Percona live-2012-optimizer-tuningPercona live-2012-optimizer-tuning
Percona live-2012-optimizer-tuning
 
ANALYZE for executable statements - a new way to do optimizer troubleshooting...
ANALYZE for executable statements - a new way to do optimizer troubleshooting...ANALYZE for executable statements - a new way to do optimizer troubleshooting...
ANALYZE for executable statements - a new way to do optimizer troubleshooting...
 
Exadata - Smart Scan Testing
Exadata - Smart Scan TestingExadata - Smart Scan Testing
Exadata - Smart Scan Testing
 
Oracle Diagnostics : Explain Plans (Simple)
Oracle Diagnostics : Explain Plans (Simple)Oracle Diagnostics : Explain Plans (Simple)
Oracle Diagnostics : Explain Plans (Simple)
 
Design and Develop SQL DDL statements which demonstrate the use of SQL objec...
 Design and Develop SQL DDL statements which demonstrate the use of SQL objec... Design and Develop SQL DDL statements which demonstrate the use of SQL objec...
Design and Develop SQL DDL statements which demonstrate the use of SQL objec...
 
Loopback.vhd
Loopback.vhdLoopback.vhd
Loopback.vhd
 
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013
 
Mysql56 replication
Mysql56 replicationMysql56 replication
Mysql56 replication
 
More than 12 More things about Oracle Database 12c
More than 12 More things about Oracle Database 12cMore than 12 More things about Oracle Database 12c
More than 12 More things about Oracle Database 12c
 
Basic Query Tuning Primer - Pg West 2009
Basic Query Tuning Primer - Pg West 2009Basic Query Tuning Primer - Pg West 2009
Basic Query Tuning Primer - Pg West 2009
 
New Tuning Features in Oracle 11g - How to make your database as boring as po...
New Tuning Features in Oracle 11g - How to make your database as boring as po...New Tuning Features in Oracle 11g - How to make your database as boring as po...
New Tuning Features in Oracle 11g - How to make your database as boring as po...
 
MySQL SQL Tutorial
MySQL SQL TutorialMySQL SQL Tutorial
MySQL SQL Tutorial
 
SAV
SAVSAV
SAV
 
Oracle12c For Developers
Oracle12c For DevelopersOracle12c For Developers
Oracle12c For Developers
 
DataStax: A deep look at the CQL WHERE clause
DataStax: A deep look at the CQL WHERE clauseDataStax: A deep look at the CQL WHERE clause
DataStax: A deep look at the CQL WHERE clause
 
A deep look at the cql where clause
A deep look at the cql where clauseA deep look at the cql where clause
A deep look at the cql where clause
 
Sql2
Sql2Sql2
Sql2
 
MariaDB: Engine Independent Table Statistics, including histograms
MariaDB: Engine Independent Table Statistics, including histogramsMariaDB: Engine Independent Table Statistics, including histograms
MariaDB: Engine Independent Table Statistics, including histograms
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 

Viewers also liked

Oracle cloudworld な〜んでだ?#3
Oracle cloudworld な〜んでだ?#3Oracle cloudworld な〜んでだ?#3
Oracle cloudworld な〜んでだ?#3Hiroshi Sekiguchi
 
Riak: 本物の高可用性を実現する仕組みとは?
Riak: 本物の高可用性を実現する仕組みとは?Riak: 本物の高可用性を実現する仕組みとは?
Riak: 本物の高可用性を実現する仕組みとは?Takahiko Sato
 
[B31] LOGMinerってレプリケーションソフトで使われているけどどうなってる? by Toshiya Morita
[B31] LOGMinerってレプリケーションソフトで使われているけどどうなってる? by Toshiya Morita[B31] LOGMinerってレプリケーションソフトで使われているけどどうなってる? by Toshiya Morita
[B31] LOGMinerってレプリケーションソフトで使われているけどどうなってる? by Toshiya MoritaInsight Technology, Inc.
 
IT業界のサバイバビリティ - Oracle LOVERS 勉強会 #12 / 18-Jun-2009
IT業界のサバイバビリティ - Oracle LOVERS 勉強会 #12 / 18-Jun-2009IT業界のサバイバビリティ - Oracle LOVERS 勉強会 #12 / 18-Jun-2009
IT業界のサバイバビリティ - Oracle LOVERS 勉強会 #12 / 18-Jun-2009Hiroshi Sekiguchi
 
20140620 dbts osaka_redshift_v1.0_slideshare
20140620 dbts osaka_redshift_v1.0_slideshare20140620 dbts osaka_redshift_v1.0_slideshare
20140620 dbts osaka_redshift_v1.0_slideshareJun Okubo
 
db tech showcase Tokyo 2013 - A35 特濃JPOUG:潮溜まりでジャブジャブ、SQLチューニング
db tech showcase Tokyo 2013 - A35 特濃JPOUG:潮溜まりでジャブジャブ、SQLチューニングdb tech showcase Tokyo 2013 - A35 特濃JPOUG:潮溜まりでジャブジャブ、SQLチューニング
db tech showcase Tokyo 2013 - A35 特濃JPOUG:潮溜まりでジャブジャブ、SQLチューニングHiroshi Sekiguchi
 
[D35] インメモリーデータベース徹底比較 by Komori
[D35] インメモリーデータベース徹底比較 by Komori[D35] インメモリーデータベース徹底比較 by Komori
[D35] インメモリーデータベース徹底比較 by KomoriInsight Technology, Inc.
 

Viewers also liked (7)

Oracle cloudworld な〜んでだ?#3
Oracle cloudworld な〜んでだ?#3Oracle cloudworld な〜んでだ?#3
Oracle cloudworld な〜んでだ?#3
 
Riak: 本物の高可用性を実現する仕組みとは?
Riak: 本物の高可用性を実現する仕組みとは?Riak: 本物の高可用性を実現する仕組みとは?
Riak: 本物の高可用性を実現する仕組みとは?
 
[B31] LOGMinerってレプリケーションソフトで使われているけどどうなってる? by Toshiya Morita
[B31] LOGMinerってレプリケーションソフトで使われているけどどうなってる? by Toshiya Morita[B31] LOGMinerってレプリケーションソフトで使われているけどどうなってる? by Toshiya Morita
[B31] LOGMinerってレプリケーションソフトで使われているけどどうなってる? by Toshiya Morita
 
IT業界のサバイバビリティ - Oracle LOVERS 勉強会 #12 / 18-Jun-2009
IT業界のサバイバビリティ - Oracle LOVERS 勉強会 #12 / 18-Jun-2009IT業界のサバイバビリティ - Oracle LOVERS 勉強会 #12 / 18-Jun-2009
IT業界のサバイバビリティ - Oracle LOVERS 勉強会 #12 / 18-Jun-2009
 
20140620 dbts osaka_redshift_v1.0_slideshare
20140620 dbts osaka_redshift_v1.0_slideshare20140620 dbts osaka_redshift_v1.0_slideshare
20140620 dbts osaka_redshift_v1.0_slideshare
 
db tech showcase Tokyo 2013 - A35 特濃JPOUG:潮溜まりでジャブジャブ、SQLチューニング
db tech showcase Tokyo 2013 - A35 特濃JPOUG:潮溜まりでジャブジャブ、SQLチューニングdb tech showcase Tokyo 2013 - A35 特濃JPOUG:潮溜まりでジャブジャブ、SQLチューニング
db tech showcase Tokyo 2013 - A35 特濃JPOUG:潮溜まりでジャブジャブ、SQLチューニング
 
[D35] インメモリーデータベース徹底比較 by Komori
[D35] インメモリーデータベース徹底比較 by Komori[D35] インメモリーデータベース徹底比較 by Komori
[D35] インメモリーデータベース徹底比較 by Komori
 

Similar to SQLチューニング総合診療Oracle CloudWorld出張所

Oracle dbms_xplan.display_cursor format
Oracle dbms_xplan.display_cursor formatOracle dbms_xplan.display_cursor format
Oracle dbms_xplan.display_cursor formatFranck Pachot
 
Relational DB Course
Relational DB  Course Relational DB  Course
Relational DB Course Sunny U Okoro
 
Managing Statistics for Optimal Query Performance
Managing Statistics for Optimal Query PerformanceManaging Statistics for Optimal Query Performance
Managing Statistics for Optimal Query PerformanceKaren Morton
 
Demystifying cost based optimization
Demystifying cost based optimizationDemystifying cost based optimization
Demystifying cost based optimizationRiyaj Shamsudeen
 
Dbms plan - A swiss army knife for performance engineers
Dbms plan - A swiss army knife for performance engineersDbms plan - A swiss army knife for performance engineers
Dbms plan - A swiss army knife for performance engineersRiyaj Shamsudeen
 
SQL Tuning 101 - Sep 2013
SQL Tuning 101 - Sep 2013SQL Tuning 101 - Sep 2013
SQL Tuning 101 - Sep 2013Connor McDonald
 
Cardinality and the Optimizer
Cardinality and the OptimizerCardinality and the Optimizer
Cardinality and the OptimizerConnor McDonald
 
Common Performance Pitfalls in Odoo apps
Common Performance Pitfalls in Odoo appsCommon Performance Pitfalls in Odoo apps
Common Performance Pitfalls in Odoo appsOdoo
 
SQL Top-N and pagination pattern (IOUG)
SQL Top-N and pagination pattern (IOUG)SQL Top-N and pagination pattern (IOUG)
SQL Top-N and pagination pattern (IOUG)Maxym Kharchenko
 
Sydney Oracle Meetup - access paths
Sydney Oracle Meetup - access pathsSydney Oracle Meetup - access paths
Sydney Oracle Meetup - access pathspaulguerin
 
Understanding Optimizer-Statistics-for-Developers
Understanding Optimizer-Statistics-for-DevelopersUnderstanding Optimizer-Statistics-for-Developers
Understanding Optimizer-Statistics-for-DevelopersEnkitec
 
Riyaj: why optimizer_hates_my_sql_2010
Riyaj: why optimizer_hates_my_sql_2010Riyaj: why optimizer_hates_my_sql_2010
Riyaj: why optimizer_hates_my_sql_2010Riyaj Shamsudeen
 
Understanding Query Optimization with ‘regular’ and ‘Exadata’ Oracle
Understanding Query Optimization with ‘regular’ and ‘Exadata’ OracleUnderstanding Query Optimization with ‘regular’ and ‘Exadata’ Oracle
Understanding Query Optimization with ‘regular’ and ‘Exadata’ OracleGuatemala User Group
 
Histograms : Pre-12c and Now
Histograms : Pre-12c and NowHistograms : Pre-12c and Now
Histograms : Pre-12c and NowAnju Garg
 
How to use histograms to get better performance
How to use histograms to get better performanceHow to use histograms to get better performance
How to use histograms to get better performanceMariaDB plc
 
Using histograms to get better performance
Using histograms to get better performanceUsing histograms to get better performance
Using histograms to get better performanceSergey Petrunya
 
Chasing the optimizer
Chasing the optimizerChasing the optimizer
Chasing the optimizerMauro Pagano
 

Similar to SQLチューニング総合診療Oracle CloudWorld出張所 (20)

5 Cool Things About SQL
5 Cool Things About SQL5 Cool Things About SQL
5 Cool Things About SQL
 
Oracle dbms_xplan.display_cursor format
Oracle dbms_xplan.display_cursor formatOracle dbms_xplan.display_cursor format
Oracle dbms_xplan.display_cursor format
 
Relational DB Course
Relational DB  Course Relational DB  Course
Relational DB Course
 
Managing Statistics for Optimal Query Performance
Managing Statistics for Optimal Query PerformanceManaging Statistics for Optimal Query Performance
Managing Statistics for Optimal Query Performance
 
Demystifying cost based optimization
Demystifying cost based optimizationDemystifying cost based optimization
Demystifying cost based optimization
 
Sql queries
Sql queriesSql queries
Sql queries
 
Dbms plan - A swiss army knife for performance engineers
Dbms plan - A swiss army knife for performance engineersDbms plan - A swiss army knife for performance engineers
Dbms plan - A swiss army knife for performance engineers
 
SQL Tuning 101 - Sep 2013
SQL Tuning 101 - Sep 2013SQL Tuning 101 - Sep 2013
SQL Tuning 101 - Sep 2013
 
Cardinality and the Optimizer
Cardinality and the OptimizerCardinality and the Optimizer
Cardinality and the Optimizer
 
Common Performance Pitfalls in Odoo apps
Common Performance Pitfalls in Odoo appsCommon Performance Pitfalls in Odoo apps
Common Performance Pitfalls in Odoo apps
 
SQL Top-N and pagination pattern (IOUG)
SQL Top-N and pagination pattern (IOUG)SQL Top-N and pagination pattern (IOUG)
SQL Top-N and pagination pattern (IOUG)
 
Sydney Oracle Meetup - access paths
Sydney Oracle Meetup - access pathsSydney Oracle Meetup - access paths
Sydney Oracle Meetup - access paths
 
Understanding Optimizer-Statistics-for-Developers
Understanding Optimizer-Statistics-for-DevelopersUnderstanding Optimizer-Statistics-for-Developers
Understanding Optimizer-Statistics-for-Developers
 
Riyaj: why optimizer_hates_my_sql_2010
Riyaj: why optimizer_hates_my_sql_2010Riyaj: why optimizer_hates_my_sql_2010
Riyaj: why optimizer_hates_my_sql_2010
 
Understanding Query Optimization with ‘regular’ and ‘Exadata’ Oracle
Understanding Query Optimization with ‘regular’ and ‘Exadata’ OracleUnderstanding Query Optimization with ‘regular’ and ‘Exadata’ Oracle
Understanding Query Optimization with ‘regular’ and ‘Exadata’ Oracle
 
Histograms : Pre-12c and Now
Histograms : Pre-12c and NowHistograms : Pre-12c and Now
Histograms : Pre-12c and Now
 
Oracle 11g caracteristicas poco documentadas 3 en 1
Oracle 11g caracteristicas poco documentadas 3 en 1Oracle 11g caracteristicas poco documentadas 3 en 1
Oracle 11g caracteristicas poco documentadas 3 en 1
 
How to use histograms to get better performance
How to use histograms to get better performanceHow to use histograms to get better performance
How to use histograms to get better performance
 
Using histograms to get better performance
Using histograms to get better performanceUsing histograms to get better performance
Using histograms to get better performance
 
Chasing the optimizer
Chasing the optimizerChasing the optimizer
Chasing the optimizer
 

Recently uploaded

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 

Recently uploaded (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 

SQLチューニング総合診療Oracle CloudWorld出張所

  • 3. 3
  • 4. 4
  • 15. 15
  • 16. 16
  • 17. 17 select count(1) from foober; ・ ・ ・ ・
  • 18. 18 ・ ・ ・ ・ SCOTT> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN 1 AND 10 7 AND status = '00' 8* AND ROWNUM <= 101 COUNT(1) ---------- 101 SCOTT> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN 1 AND 10 7* AND status = '00' COUNT(1) ---------- 10000 SCOTT> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN 1 AND 10 7 AND status = '00' 8* AND ROWNUM <= 1 COUNT(1) ---------- 1 SCOTT> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN 1 AND 10 7* AND status = '01' COUNT(1) ---------- 0
  • 19. 19 ・ ・ ・ ・ SCOTT> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN 1 AND 10 7* AND status = '00' COUNT(1) ---------- 10000 SCOTT> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN :1 AND :2 7 AND status = :3 8* AND ROWNUM <= :4 COUNT(1) ---------- 1 COUNT(1) ---------- 101 SCOTT> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN 1 AND 10 7* AND status = ’01' COUNT(1) ---------- 0
  • 20. 20 ・ ・ ・ ・ SCOTT> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN 1 AND 10 7* AND status = '00' COUNT(1) ---------- 10000 SCOTT> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN :1 AND :2 7 AND status = :3 8* AND ROWNUM <= :4 COUNT(1) ---------- 1 COUNT(1) ---------- 101 SCOTT> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN 1 AND 10 7* AND status = ’01' AND ROWNUM <= 1 COUNT(1) ---------- 0
  • 21. 21 ・ ・ ・ ・ SCOTT> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN :1 AND :2 7* AND status = :3 COUNT(1) ---------- 10000 SCOTT> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN :1 AND :2 7 AND status = :3 8* AND ROWNUM <= :4 COUNT(1) — タイプ2 ---------- 101 COUNT(1) — タイプ3 ---------- 1 COUNT(1) — タイプ4 ---------- 0
  • 22. 22
  • 23. 23
  • 24. 24 ★表  SQL> desc count4emptyset  名前 NULL? 型  ----------------------------------------- -------- ----------------------------  ID NOT NULL NUMBER  BRANCH# NOT NULL NUMBER  STATUS NOT NULL CHAR(2)  DATA CHAR(500) ★索引  INDEX_NAME COLUMN_NAME DESC  ------------------------------ ------------------------------ ----  PK_COUNT4EMPTYSET ID ASC  BRANCH# ASC ★列統計  COLUMN_NAME NUM_DISTINCT NUM_NULLS HISTOGRAM  ------------------------------ ------------ ---------- ---------------  ID 1000 0 NONE  BRANCH# 1999 0 NONE  STATUS 1 0 FREQUENCY  DATA 1000 0 NONE ★索引統計  INDEX_NAME DISTINCT_KEYS NUM_ROWS CLUSTERING_FACTOR  ------------------------------ ------------- ---------- -----------------  PK_COUNT4EMPTYSET 1000000 1000000 987729
  • 25. 25 SCOTT> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN 1 AND 10 7* AND status = '00' COUNT(1) ---------- 10000 --------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows |..| Cost (%CPU)|..| --------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 |..| 9931 (1)|..| | 1 | SORT AGGREGATE | | 1 |..| |..| |* 2 | TABLE ACCESS BY INDEX ROWID BATCHED| COUNT4EMPTYSET | 10008 |..| 9931 (1)|..| |* 3 | INDEX RANGE SCAN | PK_COUNT4EMPTYSET | 10009 |..| 42 (0)|..| --------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - filter("STATUS"='00') 3 - access("ID">=1 AND "ID"<=10)
  • 26. 26 SCOTT> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN 1 AND 10 7* AND status = '00' COUNT(1) ---------- 10000 --------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows |..| Cost (%CPU)|..| --------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 |..| 9931 (1)|..| | 1 | SORT AGGREGATE | | 1 |..| |..| |* 2 | TABLE ACCESS BY INDEX ROWID BATCHED| COUNT4EMPTYSET | 10008 |..| 9931 (1)|..| |* 3 | INDEX RANGE SCAN | PK_COUNT4EMPTYSET | 10009 |..| 42 (0)|..| --------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - filter("STATUS"='00') 3 - access("ID">=1 AND "ID"<=10)
  • 27. 27 SCOTT> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN 1 AND 10 7* AND status = '00' COUNT(1) ---------- 10000 --------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows |..| Cost (%CPU)|..| --------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 |..| 9931 (1)|..| | 1 | SORT AGGREGATE | | 1 |..| |..| |* 2 | TABLE ACCESS BY INDEX ROWID BATCHED| COUNT4EMPTYSET | 10008 |..| 9931 (1)|..| |* 3 | INDEX RANGE SCAN | PK_COUNT4EMPTYSET | 10009 |..| 42 (0)|..| --------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - filter("STATUS"='00') 3 - access("ID">=1 AND "ID"<=10)
  • 28. 28 --------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows |..| Cost (%CPU)|..| --------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 |..| 9931 (1)|..| | 1 | SORT AGGREGATE | | 1 |..| |..| |* 2 | TABLE ACCESS BY INDEX ROWID BATCHED| COUNT4EMPTYSET | 10008 |..| 9931 (1)|..| |* 3 | INDEX RANGE SCAN | PK_COUNT4EMPTYSET | 10009 |..| 42 (0)|..| --------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - filter("STATUS"='00') 3 - access("ID">=1 AND "ID"<=10) 統計 ---------------------------------------------------------- 0 recursive calls 0 db block gets 9893 consistent gets 0 physical reads 0 redo size ・・・・・ 略 ・・・・・・・ 2 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 1 rows processed
  • 29. 29 SCOTT> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN 1 AND 10 7* AND status = '00' COUNT(1) ---------- 10000 統計 ----------------------------- ・・・・略・・・・ 9893 consistent gets 0 physical reads ・・・・略・・・・ SCOTT> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN 1 AND 10 7* AND status = '01' COUNT(1) ---------- 0 統計 ----------------------------- ・・・・略・・・・ 9893 consistent gets 0 physical reads ・・・・略・・・・
  • 30. 30 --------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows |..| Cost (%CPU)|..| --------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 |..| 9931 (1)|..| | 1 | SORT AGGREGATE | | 1 |..| |..| |* 2 | TABLE ACCESS BY INDEX ROWID BATCHED| COUNT4EMPTYSET | 10008 |..| 9931 (1)|..| |* 3 | INDEX RANGE SCAN | PK_COUNT4EMPTYSET | 10009 |..| 42 (0)|..| --------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - filter("STATUS"='00') 3 - access("ID">=1 AND "ID"<=10) 統計 ---------------------------------------------------------- ・・・・・ 略 ・・・・・・・ 9893 consistent gets ・・・・・ 略 ・・・・・・・
  • 31. 31
  • 32. 32 ---------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ---------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 7 | 27 (0)| 00:00:01 | | 1 | SORT AGGREGATE | | 1 | 7 | | | |* 2 | INDEX RANGE SCAN| IX1_COUNT4EMPTYSET | 10008 | 70056 | 27 (0)| 00:00:01 | ---------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - access("ID">=1 AND "STATUS"='00' AND "ID"<=10) filter("STATUS"='00') 統計 ---------------------------------------------------------- ・・・・略・・・・ 26 consistent gets ・・・・略・・・ 治療済!
  • 33. 33 SQL> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN 1 AND 10 7 AND status = '00' 8* AND ROWNUM <= 101 COUNT(1) ---------- 101 ---------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows |..| Cost (%CPU)|..| ---------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 |..| 104 (0)|..| | 1 | SORT AGGREGATE | | 1 |..| |..| |* 2 | COUNT STOPKEY | | |..| |..| |* 3 | TABLE ACCESS BY INDEX ROWID BATCHED| COUNT4EMPTYSET | 102 |..| 104 (0)|..| |* 4 | INDEX RANGE SCAN | PK_COUNT4EMPTYSET | 10009 |..| 3 (0)|..| ---------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - filter(ROWNUM<=101) 3 - filter("STATUS"='00') 4 - access("ID">=1 AND "ID"<=10)
  • 34. 34 SCOTT> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN 1 AND 10 7 AND status = '00' 8* AND ROWNUM <= 101 COUNT(1) ---------- 101 統計 ---------------------------- ・・・・略・・・・ 103 consistent gets ・・・・略・・・・ SCOTT> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN 1 AND 10 7 AND status = '01' 8* AND ROWNUM <= 101 COUNT(1) ---------- 0 統計 ---------------------------- ・・・・略・・・・ 9893 consistent gets ・・・・略・・・・
  • 35. 35 SCOTT> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN 1 AND 10 7 AND status = '00' 8* AND ROWNUM <= 1 COUNT(1) ---------- 1 統計 ---------------------------- ・・・・略・・・・ 4 consistent gets ・・・・略・・・・ SCOTT> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN 1 AND 10 7 AND status = '01' 8* AND ROWNUM <= 1 COUNT(1) ---------- 0 統計 ---------------------------- ・・・・略・・・・ 9893 consistent gets ・・・・略・・・・
  • 36. 36 SCOTT> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN 1 AND 10 7 AND status = '01' 8* AND ROWNUM <= 1 COUNT(1) ---------- 0 統計 ---------------------------- ・・・・略・・・・ 9893 consistent gets ・・・・略・・・・ SCOTT> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN 1 AND 10 7 AND status = ’00' 8* AND ROWNUM <= 1 COUNT(1) ---------- 1 統計 ---------------------------- ・・・・略・・・・ 4 consistent gets ・・・・略・・・・
  • 37. 37 ∼ ---------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows |..| Cost (%CPU)|..| ---------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 |..| 9931 (1)|..| | 1 | SORT AGGREGATE | | 1 |..| |..| |* 2 | COUNT STOPKEY | | |..| |..| |* 3 | TABLE ACCESS BY INDEX ROWID BATCHED| COUNT4EMPTYSET | 1 |..| 9931 (1)|..| |* 4 | INDEX RANGE SCAN | PK_COUNT4EMPTYSET | 10009 |..| 42 (0)|..| ---------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - filter(ROWNUM<=101) 3 - filter("STATUS"='01') 4 - access("ID">=1 AND "ID"<=10)
  • 38. 38 ---------------------------------------------------------------------------- | Id | Operation | Name | Rows |..| Cost (%CPU)|..| ---------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 |..| 3 (0)|..| | 1 | SORT AGGREGATE | | 1 |..| |..| |* 2 | COUNT STOPKEY | | |..| |..| |* 3 | INDEX RANGE SCAN| IX1_COUNT4EMPTYSET | 102 |..| 3 (0)|..| ---------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - filter(ROWNUM<=101) 3 - access("ID">=1 AND "STATUS"='00' AND "ID"<=10) filter("STATUS"='00') COUNT(1) ---------- 101 統計 ----------------------------- ・・・・略・・・・ 3 consistent gets ・・・・略・・・・ COUNT(1) ---------- 0 統計 ----------------------------- ・・・・略・・・・ 24 consistent gets ・・・・略・・・・ ∼ COUNT(1) ---------- 1 統計 ----------------------------- ・・・・略・・・・ 4 consistent gets ・・・・略・・・・ 治療済!
  • 39. 3939 ・ ・ ・ ・ SCOTT> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN :1 AND :2 7* AND status = :3 SCOTT> r 1 SELECT 2 COUNT(1) 3 FROM 4 count4emptyset 5 WHERE 6 id BETWEEN :1 AND :2 7 AND status = :3 8* AND ROWNUM <= :4 +INDEX_NAME COLUMN_NAME ------------------------------ ------------------------------ IX1_COUNT4EMPTYSET ID STATUS 治療完!
  • 40. 40
  • 41. 41
  • 42. 42 SELECT /*+ LEADING(t01 t02 t03) USE_NL(t01 t02 t03) INDEX(t01 ix01_count4emptyset) INDEX(t02 ix01_count4emptyset_b) INDEX(t03 ix01_count4emptyset_c) */ COUNT(1) FROM count4emptyset t01 INNER JOIN count4emptyset_b t02 ON t01.id = t02.id AND t01.branch# = t02.branch# AND t02.status = '00' INNER JOIN count4emptyset_c t03 ON t02.id = t03.id AND t02.branch# = t03.branch# AND t03.status = '01' WHERE t01.id BETWEEN 1 AND 10 AND t01.status = '00' AND ROWNUM <= 1;
  • 43. 43 -------------------------------------------------------------------- | Id | Operation | Name |..| A-Rows |.. -------------------------------------------------------------------- | 0 | SELECT STATEMENT | |..| 1 |.. | 1 | SORT AGGREGATE | |..| 1 |.. |* 2 | COUNT STOPKEY | |..| 0 |.. | 3 | NESTED LOOPS | |..| 0 |.. | 4 | NESTED LOOPS | |..| 10000 |.. |* 5 | INDEX RANGE SCAN| IX01_COUNT4EMPTYSET |..| 10000 |.. |* 6 | INDEX RANGE SCAN| IX01_COUNT4EMPTYSET_B |..| 10000 |.. |* 7 | INDEX RANGE SCAN | IX01_COUNT4EMPTYSET_C |..| 0 |.. -------------------------------------------------------------------- ∼ 統計 ------------------------------ ・・・・略・・・・ 812 consistent gets 0 physical reads ・・・・略・・・・ 統計 ------------------------------ ・・・・略・・・・ 9 consistent gets 0 physical reads ・・・・略・・・・
  • 45. 45