There were some doubts on partitioned Tablespace and segmented tablespace. This is discussed below: Clarification (this is a preliminary discussion – I’ll update more on it after a little more research). Basically a partitioned tablespace is used when your table has a large number of records (around millions of records). In this case the entire tablespace will have only rows pertaining to this huge table. The tablespace itself is divided into partitions. Let’s say that we have a table containing info about all the customers within a state. If our applications are going to work on the data on a city-by-city basis then each of the partitions will contain records for a particular city within the state (i.e. Partition 1 might have all records of customers in Pune while Partition 2 may have all Mumbai records). The bottom line is that there should be some parameter which you will use to store records in the partition. A segemented tablespace is used for medium sized tables. The tablespace is divided into segments and each segment will contain rows belonging to ONE table (A segment cannot have rows from 2 tables – this would make it a simple tablespace). But segment number 1 might have rows from Table 1 while segment 2 can have rows from Table 2. To summarize: Every segment will contain rows of 1 table only. If the table is large it could occupy many segments. Different segments can hold different tables. An entire partitioned tablespace will hold only 1 table (every partition in the tablespace will have rows of the same table but the entire table is divided into partitions based on some criteria). Note: Partitioned tablespaces need a clustered index (I’ll discuss this in a later edition). Before continuing with the discussion on optimizer, it would be good to know some interesting points about SQLs:
Of course this can be used if you are really sure that no student will have a negative average. It is important to know your data before using such statements.
Joins:
Some more info on partitioned tablespaces:
Precompiler: The first step is to pass the code through the DB2 pre-compiler. This will comment out the SQL’s, put in some DB2 invoking statements in the code and send the code to the COBOL compiler (this is called the modified source code). In this stage the DCLGENs and use of host variables will be checked (if you specify DCLGENs). But the precompiler will not check as to whether the tables you have used exist/ whether you have used the columns correctly (i.e. the precompiler does not check with DB2). DBRM: The precompiler will also produce a DBRM (Database Request Module) which will contain info about how your program is going to use DB2. The precompiler then puts a timestamp in the modified source code and in the DBRM. Load Module: A source code has to be compiled and linked to produce the load module (i.e. the executable file). The same process happens with our modified source code. But this load module cannot be executed without being combined with the DBRM because the modified source code will have DB2 calls which haven’t been resolved (the SQL stuff is still in the DBRM). This process of combining your load module and DBRM is called binding. Binding: Authority is checked for (whether you have permission to use the tables), the existence of the tables and columns is also checked here (if you make a mistake in your SQL, you might have noticed that we get a bind error indicating the incorrect part of the SQL). Also an efficient way to access the data is decided at bind time. While binding it will also expect the timestamp on the load module and the DBRM to match (because the binder has to bind the correct DBRM with the correct source code). Once this is done, the execution plan is created. Now our load module can be executed using this plan.
Have you ever wondered as to what IKJEFT01, IKJEFT1B, PC.SYSLIB, PC.SYSIN, COB.SYSLIB, DSN are? (answers to that in the next edition!).
Go back to the main contents page
Copyright © 2020 Sethu Subramanian All rights reserved. Reach me via email at ssbell @ gmail.com