You are on page 1of 5

DB2 1. Product modules 1)DB2 Express edition 2)DB2 work groups 3)DB2 Enterprise edition 2.

Express edition 1) Entry level 2)Restricted to 2 CPU or 4 GB RAM 3)Full functionality 3. Work Group 1) DB2 Express + 2) Restricted to 4 CPU /16 GB RAM 4. Enterprise edition 1) work group + 2) No hardware restriction 3) High availability features 4) High performance features.-> multidimensional clustering, partitioning, materialized query 5. Dead lock may occur if more than one sub agent is holding locks on particular data block in buffer pool. 6. Dead lock detector will detect the dead lock and releases on of the sub agent. 7. Two types of loggings. 1) circular logging 2) Retain logging 8. Circular Logging ->Logs are overwritten after a while. Data bases are not recovered. 9. Retain logging-> log files are archived and not over written. 10. Log files are first written in log buffers. 11. logger process will write the log details from log buffer to hard disk when 1) transaction is completed 2)Structural changes are made 3)log buffer gets full 12. Any database created in DB2 is located in the following directory -> /<DB2Home directory>/<DB2 instance Directory>/NODE0000/SQL00001 13. Sub sequent databases are created in SQL00002 and so on. 14. Table space is a storage structure containing table, indexes, large objects and long data. 15. Table space is made up of one or more containers. 16. A container is a file, directory or a raw device that stores the data. 17. Container is organized as a set of extents. 18. Extents are organized as set of pages. 19. Page is a smallest unit of disk space handled by the disk space that database wil read or write. 20. Possible values for pages are 4,8,16 and 32 kb. 21. Choose large page size in DW environment 1) single query fetches large sequential data. 2) Required data collocates together in fewer pages 3) input or output becomes faster. 22. Choose smallest page in OLTP-> Transactions read or write very few records at a time 2) there fore records spread wide in the table space. 23. Stripe extents across containers. 24. this results in distributing data across files. 25. Distributed data helps in query perfornmance. 26. if new container is added extents are balanced across themselves. 27. Rebalanceing is moving extents between containers. 28. there are options to avoid rebalancing. 29. SMS-> System Managed Space 1) file manager of OS allocates space and manages it. 2) Allocates space on demand 3) Do not have to predefine the containers. 4) ther is no control on placement of data on disk

30. DMS-> Database Managed Space 1) DB manager allocates and manages space. 2)space is pre allotted when table space is created 3) ther is great control of placement of data in disk. 4) Performs well for large objects coz the space allocated in the beginning itself. 31. Indexes 1) B+indexes 2) Cluster block indexes. 32. Index-> hierarchical data structure that provides rowid for records and reads for satisfying a query. 33. if a row is indexed then no need to find thousands of records in the database. 34. Block indexing is preferable for low cardinality columns. 35. Data is physically ordered by indexed column. index points to block that satisfies the query criteria rather than rowID 36. block index is much smaller than B+index. 37. SMP-> Symmetric multi processor. 38. MMP-> massive multi processor 39. Concurrency -> allowing multiple DB users to read or right from same table simaltanously 40. concurrency is controlled by a. Repeatable read b. Read stability c. Cursor stability d. Uncommitted read 41. locks will allow limited access to shared data 42. this can degrade the performance efor the user 43. preventing lock issues a. frequently using COMMIT command (for every 10000 rows) b. attaching with ur with the select clause will set the minimum level of locking.(uncommitted read) c. Use table level locks d. While updating not allowing the other users to update the data e. This is more efficient than locking at the row level f. Always close the cursors in stored procedure to release the lock 44. levels of locking a. block level b. row level c. table level 45. minimum locking allows user to access as much data as possible 46. Details of various locks held by various transactions are stored in a buffer pool area called Locklist 47. too many row level locks converts into one table level lock. This is called lock escalation 48. lock escalations reduce the concurrency 49. IO efficiency a. Avoid select* , specify columns b. Use wher clause to restrict the rows c. Use fetch first n rows only or optimize first k rows only d. Use for read only or to fetch only to avoid excessive locking

e. Avoid distinct or orderby clause f. Avoid datatype conversion g. Avoid or clause h. Avoid outer joins 50. buffer pool: a. create buffer pool with large page size(4, 8, 16, 32 k) b. few input or output operations required to move data in or out from buffer pool c. high transaction rate with same response time d. reduce input or output contention e. create small buffer pools for tables with less frequently accessed data f. assign separate bufferpools for temporary table spaces g. increase page cleanser agent to write data to disk quickly in update intensive environment. 51. query plans provided by the query compiler depends on the statistic provided by the systemc catlog 52. optimal query plan are generated when the table and indexes statics are upto date 53. Prefetching: a. Data to be fetched previously before it is processed. b. Agents do not have to wait for data to be loaded from disk to buffer pools c. Configure num_ioservers parameter to be equal to atleast number of physical disks in the DB to improve pre-fetch 54. create scripts for the statistical update and schedule to run regularly. 55. collect statistics for the following purpose a. for a newly created or loaded table with index b. the table is reorganized c. after large insertion or updation d. distribute the statistical collections for different users to avoid impacting peofrmance e. statistics can be collected only for index or certain columns 56. Memory allocation-memory parameters. a. Logbufsz i. Size of the Memory to buffer log before they are written to disk ii. Increase this value if large updates on a table iii. If locklist gets full lock escalation will happen and will generate more table locks and few row locks thus reducing concurrency on shared objects. iv. Increase the locklist value when the problem with lock escalation occours b. Audit_buf_sz i. Size of the DB when auditing the database ii. If it is zero the buffer wont be utilized and audit writes data to disk. iii. If non-zero then ll utilize the buffer to improve performance c. Catalog_cache_sz i. Memory to cache system catalog information

ii. More chache is required during the compilation of dynamic SQl statements or package binding d. Pckcachesz i. Memory used for caching of sections for static and dynamic SQL statement ii. Improve performance especially when the same statement is used multiple times by the application iii. Effective in OLTP environment e. Sortheap i. Sortheap is the area where the data is sorted. ii. Usage of appropriate indexes will reduces the sort heap required iii. Increase value when large sorts are required f. Aslheapsz i. Communication buffer between local application and its associated agents ii. If application request are small then have to reduce the value of this parameter. iii. For application with large queries, increase this appropriately g. Maxlocks i. Percentage of the locklist held by an application that must be filled before the databse manager performs lock escalation ii. If the value is too low, lock escalation can happen frequently. h. Chngpgs_thresh i. Percentage of changed pages in the buffer pool ii. For heavy updates decrease this value below default i. Num_iocleaners i. Number of asynchronous page cleaners for the DB ii. If 0then no page cleaners are started iii. If no page cleaners then agent willl write data from buffer pool to disk iv. Incresiing the value will increase the performance j. Num_ioservers i. Input or output servers are used on behalf of the DB agent to perform prefetch ii. good to have one or two more than the number of physical devices 57. Exporting a. Exports data from DB to external operating system files. b. Data can be specified with an SQL statement c. Formats that can be exported are i. DEL (delimited ASCII format) ii. IXF (integrated eXchange format) iii. WSF (work sheet format) d. The exported file does not have data about the dtable structure. So cannot be used for recreation of tables. e. Recreate the table and load the data that have exported

58. Importing a. import data from a file to DB tables b. either append or replace the data c. file format supported i. IXF (integrated eXchange for,mat) ii. Del( delimited ASCII format) iii. WSF(work sheet format) iv. ASC (ascii format) d. Data cannot be imported to declared temporary tables, system tables, summary tables e. Commit interval can be iincludede in the command 59. DB2 Load a. Move l;arge qty of data to DB efficiently b. Faster than import utility c. Load writes data directly to hard disk but the import utility performs SQl inserts d. Cannot specify commit interval e. Phases of load i. Load phase - data is written to disk ii. Build phase - indexes are built iii. Delete phase- any rows violating the constraints are deleted iv. Index copy phase copy index data from system temporary space to original table space f. File formats i. DEL ii. ASC iii. PC or IXF iv. Cursor (current set of rows) g. Data can be appended or replaced in the table h. Load operations are not logged