tsql - How to formulate index_name in SQL? -


i trying create index on 1 of tables accurate label. here how trying it...expecting "sysname" resolve column or table name. after run command , view in object explorer, listed

"[<name of missing index, sysname + '_prod',>]". 

how u define index_names in better descriptive fashion? (i trying add extension "_prod" index_name, since index of index_name exists).

use [amdmetrics] go   create nonclustered index    [<name of missing index, sysname + '_prod',>]    on [smartsolve].[v_cxp_customer_pxp] ([qxp_udf_string_8], [qxp_report_date],  [qxp_xrs_description])    include ([qxp_id], [qxp_exception_no], [qxp_base_exception], [qxp_category],  [qxp_occurence_date], [qxp_coord_id], [qxp_short_desc], [qxp_root_cause],  [qxp_description], [qxp_qei_id], [pxp_lot_number], [cxp_id], [cxp_aware_date],  [qxp_xsv_code], [qxp_coord_name], [pxp_product_code], [pxp_product_name],  [qxp_oru_name], [qxp_resolution_desc], [qxp_closed_date], [cxp_client_code],  [cxp_client_name])      

i'm not 100% sure trying do, seems trying find way name index (or find naming convention). conventions best when easy follow, , make sense people without having explain them. lot of different conventions fit mo, 1 common this:

  index type                          prefix    complete index name ------------------------------------------------------------------- index (not unique, non clustered)   idx_      idx_<name>_<column>   index (unique, non clustered)       udx_      udx_<name>_<column>   index (not unique, clustered)       cix_      cix_<name>_<column>   index (unique, clustered)           cux_      cux_<name>_<column>  

although on different note, have question why have many columns in include list....without knowing size of columns, there drawbacks adding many columns:

 avoid adding unnecessary columns. adding many index columns,  key or nonkey, can have following performance implications:   - fewer index rows fit on page. create i/o increases  , reduced cache efficiency.  - more disk space required store index. in particular,  adding varchar(max), nvarchar(max), varbinary(max), or xml data types  nonkey index columns may increase disk space requirements.  because column values copied index leaf level.  therefore, reside in both index , base table.  - index maintenance may increase time takes perform modifications,  inserts, updates, or deletes, underlying table or indexed view.  have determine whether gains in query performance outweigh  affect performance during data modification , in additional disk  space requirements.  

from here: http://msdn.microsoft.com/en-us/library/ms190806.aspx


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -