Unique Index
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2017 07:58 AM
Hi All,
Per requirement, Added unique index for few fields of a Custome table by following the steps mentioned in the link (http://wiki.servicenow.com/index.php?title=Creating_a_Custom_Table#Adding_a_Database_Index&gsc.tab=0 ) but those fields are not yet showing under database indexs list.
As per the information mentioned in the above link, The index is not created immediately and it would take some time. But we have already crossed 4 business days.
Could anyone know how much time it would take?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2017 01:35 PM
Go to System logs--> Events from left nav
Check with filter events name = "text_index" & table = "yyour table" created on that day. it will give you idea that index was generated on that table or not.
what is current status of the events if created.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2017 10:43 PM
Thanks for the quick turnaround.
Just I have walkthrough the Events (System Logs) and found one of the indexes of the field is processed and confirmed in the table database indexes.
But I didn't found logs for other two fields and not yet showing Indexes in those tables and even not showing any logs (which is Created on 13 Sep 2017).
Do I need to create again?
Below screenshot for reference -
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2017 11:06 PM
My apologies, with the table name I'm not able to see any events. I believe above screenshot is an incorrect search.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2017 11:50 PM
Don't confuse a database index with a text index. It looks to me dddkkk made this confusion.
When you create a database index via UI, the index is created via a scheduled job and depending on the table size where the index is added it may take a while. But 4 days seems too much for me.
Use the following script in background scripts to see if the indexes are there or not:
var td = GlideTableDescriptor.get('task'); //replace here with your tablename rather than task table
if (!td.isValid()){
gs.print('Table is not valid');
}
var indexDescList = [];
var indexIDs = td.getIndexDescriptors().values().iterator();
while (indexIDs.hasNext()) {
var tableIndex = indexIDs.next();
var tableIndexColumns = tableIndex.getFields();
indexDescList.push(tableIndex);
}
gs.print('The following indexes are present on table task:');
for (i=0; i<indexDescList.length;i++){
gs.print(indexDescList[i]);
}
For above example on task I get:
*** Script: The following indexes are present on table task:
*** Script: parent:[parent, active]
*** Script: cgqwykgs_ref:[a_ref_19, active]
*** Script: delivery_task:[delivery_task, active]
*** Script: assignment_group:[assignment_group, active]
*** Script: sys_class_name_2:[sys_class_name, a_ref_1, state, opened_by]
*** Script: tfbooirh_ref:[a_ref_15, active]
*** Script: vrhvybwj_ref:[a_ref_17, active]
*** Script: a_str_16:[a_str_16, active, a_ref_9]
*** Script: sys_updated_on:[sys_updated_on]
*** Script: xmlnebmy_ref:[a_ref_18, active]
*** Script: fqycrbdc_ref:[a_ref_10, active]
*** Script: sys_class_name:[sys_class_name, number]
*** Script: closed_by:[closed_by, active]
*** Script: a_int_2:[a_int_2]
*** Script: eopnfhdy_ref:[a_ref_11, active]
*** Script: number:[number]
*** Script: opened_by:[opened_by, active]
*** Script: sys_created_on:[sys_created_on]
*** Script: sys_domain:[sys_domain, active]
*** Script: company:[company, active]
*** Script: tmqrlvmh_ref:[a_ref_13, active]
*** Script: oecazfmq_ref:[a_ref_16, active]
*** Script: assigned_to:[assigned_to, active]
*** Script: a_ref_8:[a_ref_8, active]
*** Script: a_ref_9:[a_ref_9, active]
*** Script: a_ref_6:[a_ref_6, active]
*** Script: a_ref_7:[a_ref_7, active]
*** Script: closed_at:[closed_at]
*** Script: a_ref_4:[a_ref_4, active]
*** Script: a_ref_5:[a_ref_5, active]
*** Script: a_str_2:[a_str_2, active]
*** Script: cmdb_ci:[cmdb_ci, active]
*** Script: delivery_plan:[delivery_plan, active]
*** Script: a_ref_2:[a_ref_2, active]
*** Script: a_ref_3:[a_ref_3, active]
*** Script: active:[active, sys_class_name, number]
*** Script: a_ref_1:[a_ref_1, active]
*** Script: PRIMARY:[sys_id]
*** Script: business_service:[business_service, active]
*** Script: a_str_4:[a_str_4, active]
*** Script: nnhojmzg_ref:[a_ref_14, active]
*** Script: sys_domain_path:[sys_domain_path]
*** Script: rejection_goto:[rejection_goto, active]
*** Script: opened_at:[opened_at]
*** Script: dnlnfuse_ref:[a_ref_12, active]
*** Script: location:[location, active]
*** Script: wf_activity:[wf_activity, active]
First is the index name, secondly the columns on which the index is built.