Skip to main content
Skip table of contents

How to speed up listing jobs that match metadata criteria on a large database [VC UG]


Due to the large amount of data inside the table containing job metadata (XML documents of various sizes for example) the table has a limited amount of indexes to reduce the size of the database. For large databases this might result in a slower performance when searching through it. Some customer have however requested additional indexes to this table to make certain operations faster when listing jobs matching a given criteria.

GET /job?jobmetadata=key=value


As a workaround it is possible to add some optional indexes to the database to speed things up; please note that these all come at the price of an increased size of the database. Proceed with caution.

For PostgreSQL it is recommended that you use what is called partial indexes. The following syntax can be used to add these to the t_jobdata table:

CREATE INDEX t_jobdata_item_idx ON t_jobdata USING btree (c_index, c_data) WHERE c_index = 'itemId';

In this example "itemId" was used, To find other valid key's you can find these inside the return data using the query parameter, "metadata=true":

GET /job/VX-123?metadata=true

This will return an XML JobDocument similar to this, in which you can find the appropriate keys you may be able to add as partial indexes if you so wish:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns0:JobDocument xmlns:ns0="">
        <ns0:description>Importing sidecar files.</ns0:description>

In the example above you can see keys such as <ns0:key>baseUri</ns0:key> which is a possible key to add as an index.

For MySQL partial indexing isn't possible, so here it is possible to do what is called a prefix index instead; these index only the leading part of the column value, but at the same time, this indexes ALL the data in this column. To create a prefix index that is limited to the leading 19 characters:

CREATE INDEX t_jobdata_prefix_idx ON t_jobdata (c_data(19));

Please note that this is also possible for PostgreSQL using:

CREATE INDEX t_jobdata_prefix ON t_jobdata (left(c_data,19));

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.