How do I remove an index from a table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2016 07:19 AM
How do I remove an index from a table? I created an index using a field that I thought originally should be unique but it turns out that field is not a determining characteristic of the record. Is there a way to remove this index?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2016 07:20 AM
Hi Robert,
Reach out to customer support. They can assist with this as it requires low level interaction with the database.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2016 07:24 AM
Hi Robert,
index can only be removed by ServiceNow support personnel, customers cannot do this operation. Please raise a HI ticket for the same.
HI Service Portal - ServiceNow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2017 02:23 AM
You can drop indexes, but I don't think it's supported and I don't recommend doing it.
Use at your own risk in sandbox-environments:
//dropIndex("task", "sys_updated_on_2");
function dropIndex(tableName, indexName) {
var td = new GlideTableDescriptor(tableName);
td.getSchema();
var indexes = td.getIndexDescriptors();
for (var iter = indexes.values().iterator(); iter.hasNext();) {
var idx = iter.next();
if (idx.isPrimary())
continue;
var flds = idx.getFields();
var idxname = idx.getName();
var parts = idxname.split("_");
var unique = idx.isUnique();
if (idxname === indexName) {
gs.print("Index " + indexName + " found and will be dropped");
var dbi = new GlideDBConfiguration.getDBI(tableName);
gs.print(new GlideDBIndex(dbi).drop(idx));
dbi.close();
}
td.close();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2017 06:36 AM
Hi Dan,
Your script was really helpful, thank you. Could you tell where i can read more about these APIs (i.e. GlideTableDescriptor, GlideDBConfiguration, etc), as i can't find it in official API documentation ( https://developer.servicenow.com/app.do#!/api_doc?v=jakarta&id=server )