Index Why In the DB2 : Cost Calculation 2 : index only post I noticed something upsetting, well, at least it was upsetting to me. We looked at the explain plan for looking up 1 value by an index. The index had nlevel=3. So there is a root-node, some intermediate-nodes and finally finally some leaf-nodes. …
Index Why? When you supply DB2 with a query DB2 has to make some serious decisions: – Should indexes be utilized? – Which indexes are most suitable? – Which join operation should be used? (hash join/nested loop) – Is all data needed at once or are the first 10 rows as quick as possible (the …
Sometimes you need a mechanism to generate rows. For example when you need to create a demonstration table . Recursive CTE’s (Common Table Expression) might be your friend WITH engine (rownum) AS (select 1 as rownum from sysibm.sysdummy1 union all select rownum + 1 AS rownum from engine where rownum<10) SELECT rownum FROM engine; …
Problem Playing around in DB2 I wanted to know how to create a hiearchical query. This because I wanted to create view for explain plans, a bit resembling the explain plans which oracle provides. First step is understanding how to make the recursive SQL’s The setup: drop table relations; create table relations (id int, parent …
Often I need to create a table just for demonstration puposes, and this table needs to be filled up with data. The question for this post is…..: How to generate rows, preferrably a distinct number. So what I do? If the table has to be created yet: Or if the table allready exists: Did I …