home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / ingres04.lzh / doc / quel / modify.doc < prev    next >
Encoding:
Text File  |  1992-11-19  |  7.7 KB  |  176 lines

  1.  
  2.  
  3.  
  4.  
  5.      MODIFY(QUEL)                 2/23/79                 MODIFY(QUEL)
  6.  
  7.  
  8.  
  9.      NAME
  10.           modify - convert the storage structure of a relation
  11.  
  12.      SYNOPSIS
  13.           _m_o_d_i_f_y relname _t_o storage-structure [ _o_n key1 [ :  _s_o_r_t_o_r_d_e_r
  14.                ] [ { , key2 [ : _s_o_r_t_o_r_d_e_r ] } ] ] [ _w_h_e_r_e [ _f_i_l_l_f_a_c_t_o_r
  15.                = _n ] [ , _m_i_n_p_a_g_e_s = _n ] [ , _m_a_x_p_a_g_e_s = _n ] [ , _l_i_d_n  =
  16.                _l_i_d_n_a_m_e ] [
  17.  
  18.      DESCRIPTION
  19.           _R_e_l_n_a_m_e is modified  to  the  specified  storage  structure.
  20.           Only the owner of a relation can modify that relation.  This
  21.           command is used to increase performance when using large  or
  22.           frequently referenced relations.  The storage structures are
  23.           specified as follows:
  24.  
  25.                isam - indexed sequential storage structure
  26.                cisam - compressed isam
  27.                hash - random hah storage structure
  28.                chash - compressed hash
  29.                heap - unkeyed and unstructured
  30.                cheap - compressed heap
  31.                heapsort - heap with tuples sorted and  duplicates  re-
  32.                     moved
  33.                cheapsort - compressed heapsort
  34.                truncated - heap with all tuples deleted
  35.                orderedn - ordered relation where n is the ordering di-
  36.                     mension
  37.  
  38.           The paper ``Creating and Maintaining a Database in  INGRES''
  39.           (ERL Memo M77-71) discusses how to select storage structures
  40.           based on how the relation is used.
  41.  
  42.           The current compression algorithm only  suppresses  trailing
  43.           blanks  in  character  fields.  A more effective compression
  44.           scheme may be possible, but tradeoffs  between  that  and  a
  45.           larger and slower compression algorithm are not clear.
  46.  
  47.           If the _o_n phrase is omitted when modifying to  isam,  cisam,
  48.           hash  or  chash, the relation will automatically be keyed on
  49.           the first domain.  When modifying to heap or  cheap  the  _o_n
  50.           phrase  must  be  omitted.   When  modifying  to heapsort or
  51.           cheapsort the _o_n phrase is optional.
  52.  
  53.           When a relation is being sorted (isam, cisam,  heapsort  and
  54.           cheapsort), the primary sort keys will be those specified in
  55.           the _o_n phrase (if any).  The first key after the  _o_n  phrase
  56.           will  be  the  most significant sort key and each successive
  57.           key specified will be the next most  significant  sort  key.
  58.           Any  domains  not specified in the _o_n phrase will be used as
  59.           least significant sort keys in domain number sequence.
  60.  
  61.           When a relation is modified to heapsort  or  cheapsort,  the
  62.           _s_o_r_t_o_r_d_e_r  can  be  specified to be _a_s_c_e_n_d_i_n_g or _d_e_s_c_e_n_d_i_n_g.
  63.           The default is always _a_s_c_e_n_d_i_n_g.  Each key given in  the  _o_n
  64.           phrase can be optionally modified to be:
  65.  
  66.                key:descending
  67.  
  68.           which will cause that key to be sorted in descending  order.
  69.           For completeness, _a_s_c_e_n_d_i_n_g can be specified after the colon
  70.           (`:'), although this is unnecessary since it is the default.
  71.           _D_e_s_c_e_n_d_i_n_g   can   be  abbreviated  by  a  single  `_d'  and,
  72.           correspondingly, _a_s_c_e_n_d_i_n_g can be  abreviated  by  a  single
  73.           `_a'.
  74.  
  75.           When modifying to _o_r_d_e_r_e_d_n, up to n  ordering  keys  can  be
  76.           specified  using  the  _o_n clause.  Ordering keys are used to
  77.           specify the ordering of tuples in the new relation.  Changes
  78.           on key field values indicate the incrementing of a lid value
  79.           for the lid corresponding to the key change.  If no ordering
  80.           keys are specified, only the lid corresponding to the lowest
  81.           lid level is incremented by one for  every  new  tuple.   In
  82.           this  case,the  order  of  the tuples is determined by their
  83.           sort order on file.  However, note that  ordering  does  not
  84.           destroy any current storage structures on a relation (except
  85.           secondary indices).
  86.  
  87.           _L_i_d_n can only be specified if modifying  to  _o_r_d_e_r_e_d_n.   De-
  88.           fault values are _l_i_d_1 , _l_i_d_2 , and _l_i_d_3.
  89.  
  90.           _F_i_l_l_f_a_c_t_o_r specifies the percentage (from 1 to 100) of  each
  91.           primary  data  page that should be filled with tuples, under
  92.           ideal conditions.  _F_i_l_l_f_a_c_t_o_r may be used with isam,  cisam,
  93.           hash  and  chash.   Care  should  be  taken when using large
  94.           fillfactors since a non-uniform distribution of  key  values
  95.           could  cause  overflow pages to be created, and thus degrade
  96.           access performance for the relation.
  97.  
  98.           _M_i_n_p_a_g_e_s specifies the minimum number  of  primary  pages  a
  99.           hash  or  chash  relation must have.  _M_a_x_p_a_g_e_s specifies the
  100.           maximum number of primary pages a hash or chash relation may
  101.           have.   _M_i_n_p_a_g_e_s and _m_a_x_p_a_g_e_s must be at least one.  If both
  102.           _m_i_n_p_a_g_e_s and _m_a_x_p_a_g_e_s are specified in  a  modify,  _m_i_n_p_a_g_e_s
  103.           cannot exceed _m_a_x_p_a_g_e_s.
  104.  
  105.           Default values for _f_i_l_l_f_a_c_t_o_r, _m_i_n_p_a_g_e_s, and _m_a_x_p_a_g_e_s are as
  106.           follows:
  107.  
  108.                       _F_I_L_L_F_A_C_T_O_R   _M_I_N_P_A_G_E_S  _M_A_X_P_A_G_E_S
  109.  
  110.                hash   50           10        no limit
  111.                chash  75           1         no limit
  112.                isam   80           NA        NA
  113.                cisam  100          NA        NA
  114.  
  115.      EXAMPLES
  116.           /* modify the emp relation to an indexed
  117.                   sequential storage structure with
  118.                   "name" as the keyed domain */
  119.  
  120.           modify emp to isam on name
  121.  
  122.           /* if "name" is the first domain of the emp relation,
  123.                   the same result can be achieved by */
  124.  
  125.           modify emp to isam
  126.  
  127.           /* do the same modify but request a 60% occupancy
  128.                   on all primary pages */
  129.  
  130.           modify emp to isam on name where fillfactor = 60
  131.  
  132.           /* modify the supply relation to compressed hash
  133.                   storage structure with "num" and "quan"
  134.                   as keyed domains */
  135.  
  136.           modify supply to chash on num, quan
  137.  
  138.           /* now the same modify but also request 75% occupancy
  139.                   on all primary, a minimum of 7 primary pages
  140.                   pages and a maximum of 43 primary pages */
  141.  
  142.           modify supply to chash on num, quan
  143.                   where fillfactor = 75, minpages = 7,
  144.                   maxpages = 43
  145.  
  146.           /* again the same modify but only request a minimum
  147.                   of 16 primary pages */
  148.  
  149.           modify supply to chash on num, quan
  150.                   where minpages = 16
  151.  
  152.           /* modify parts to a heap storage structure */
  153.  
  154.           modify parts to heap
  155.  
  156.           /* modify parts to a heap again, but have tuples
  157.                   sorted on "pnum" domain and have any duplicate
  158.                   tuples removed */
  159.  
  160.           modify parts to heapsort on pnum
  161.  
  162.           /* modify employee in ascending order by manager,
  163.                   descending order by salary and have any
  164.                   duplicate tuples removed */
  165.  
  166.           modify employee to heapsort on manager, salary:descending
  167.  
  168.           /* ordered relation */
  169.  
  170.           modify text to ordered1 on lid where lid1 = lidfield
  171.  
  172.      SEE ALSO
  173.           sysmod(unix) ordered(quel)
  174.  
  175.  
  176.