19.06.2013 Views

DB2 UDB for z/OS Version 8 Performance Topics - IBM Redbooks

DB2 UDB for z/OS Version 8 Performance Topics - IBM Redbooks

DB2 UDB for z/OS Version 8 Performance Topics - IBM Redbooks

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Figure 3-9 MQTs and short running queries<br />

Observations on MQTs and short running queries:<br />

► Create several MQTs which scan various numbers of 4 KB pages to count the number of<br />

rows in the table<br />

► Enable/disable MQTs <strong>for</strong> query rewrite <strong>for</strong> queries in MQT fullselect<br />

► Compare query CPU time with and without MQT<br />

► MQTs are not used <strong>for</strong> short running query scanning 815 page table (0.019 sec. CPU<br />

time)<br />

► MQTs are used <strong>for</strong> query scanning 1032 page table (0.015 sec. CPU using MQT, 0.037<br />

sec. without MQT)<br />

If the estimated cost <strong>for</strong> a given query is below the <strong>DB2</strong> threshold, the automatic query rewrite<br />

is not attempted. The value is similar to the threshold to prevent parallelism <strong>for</strong> short running<br />

queries.<br />

Increase of bind cost<br />

Figure 3-10 shows the overhead introduced by the number of MQTs qualified in BIND cost.<br />

46 <strong>DB2</strong> <strong>UDB</strong> <strong>for</strong> z/<strong>OS</strong> <strong>Version</strong> 8 Per<strong>for</strong>mance <strong>Topics</strong><br />

MQTs and short running queries<br />

CPU time <strong>for</strong> SELECT<br />

COUNT(*) from tables with<br />

various numbers of 4K<br />

pages<br />

MQTs are not used <strong>for</strong> short<br />

running query scanning 815<br />

page table (0.019s CPU<br />

time)<br />

MQTs are used <strong>for</strong> query<br />

scanning 1032 page table<br />

(0.015s cpu, 0.037s w/o<br />

MQT)<br />

CPU Time (sec)<br />

CPU Time <strong>for</strong> SELECT COUNT(*)<br />

0.08<br />

0.07<br />

0.06<br />

0.05<br />

0.04<br />

0.03<br />

0.02<br />

0.01<br />

0<br />

815 1148<br />

1032 1449<br />

Number of Pages<br />

NO MQT<br />

MQT

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!