home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / SQLDPN.ZIP / SQLDPND.DOC < prev    next >
Text File  |  1991-06-27  |  2KB  |  51 lines

  1.                         Unclassified
  2.  
  3. The SQLDPND PACKAGE contains a sample program for use with the OS/2
  4. Extended Edition Database Manager.  It takes as input a database name
  5. and a single SQL SELECT statement, and then displays the dependencies
  6. that pre-compiled statement has on objects in the database.             are
  7. This sample program is being distributed to software developers and
  8. key customer accounts at the OS/2 Technical Update seminar.
  9. Feel free to distribute it as you see fit.
  10.  
  11.  
  12. This program shows what indices, if any, a SELECT statement is dependentr.
  13. on, and thus can give you an idea if the optimizer has chosen to access
  14. data through an index.
  15. Note that database manager does not always go THROUGH an index even if
  16. it is listed as a dependency.  One example of such a situation would be:
  17.  
  18.    Suppose you have the following statement:
  19.  
  20.       SELECT DISTINCT EMPLOYEEID, NAME
  21.       FROM EMPLOYEE_TAB
  22.  
  23.    If there is a unique index on the "EMPLOYEEID,NAME" key,
  24.    database manager doesn't have to sort the rows to find the distinct
  25.    values -- it can assume they're distinct because of the unique
  26.    index, and can still access the base table directly (which probably
  27.    would be more efficient in this situation, since all rows are
  28.    being selected).
  29.  
  30. -----------------------------------------------------------------------
  31.  
  32. The sample program name is SQLDPND.SQC
  33. It prompts the user for a database name and then for a complete
  34. SELECT statement.
  35. It then precompiles the statement and queries the system table
  36. SYSIBM.SYSPLANDEP, printing out the results.
  37.  
  38.  
  39. A batch and link file is included to show how to precompile and
  40. compile this application.  You should precompile the program with
  41. deferred bind.  You do not need to bind SQLDPND to your database
  42. since it binds itself to the database you specify.                      n
  43.  
  44. PRECOMPILE WITH DEFERRED BIND:
  45.  
  46. sqlprep sqldpnd.sqc dbname /B
  47. cmp sqldpnd
  48. lnk sqldpnd
  49.  
  50. ...where 'dbname' is any database on your machine.
  51.