<h2>Best Practices for Writing Efficient Queries</h2><br/><div style="overflow-x:auto"><style type="text/css"><!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } span { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } h2 { font-size: 24pt; font-family: Lato; color: var(--now-color--text-primary, black); } h3 { font-size: 18pt; font-family: Lato; color: var(--now-color--text-primary, black); } h4 { font-size: 14pt; font-family: Lato; color: var(--now-color--text-primary, black); } a { font-size: 12pt; font-family: Lato; color: var(--now-color--link-primary, #00718F); } a:hover { font-size: 12pt; color: var(--now-color--link-primary, #024F69); } a:target { font-size: 12pt; color: var(--now-color--link-primary, #032D42); } a:visited { font-size: 12pt; color: var(--now-color--link-primary, #00718f); } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } </style> <div class="ns-kb-css-body-editor-container"> <div style="font-family: Lato, Arial, Helvetica, sans-serif; padding: 16pt; margin: 0pt; background-color: #f8f9fa; border-radius: 8pt;"> <div style="background: linear-gradient(135deg, #032D42 0%, #00718F 100%); color: #ffffff; border-radius: 8pt; padding: 24pt; margin-bottom: 16pt; box-shadow: 0pt 4pt 12pt rgba(0,0,0,0.15);"> <div style="font-size: 28pt; font-weight: bold; line-height: 34pt;">Best Practices for Writing Efficient Queries and Code</div> <div style="font-size: 12pt; line-height: 20pt; color: #d1d5db; margin-top: 8pt;">Customer-facing guidelines for building fast lists, reports, business rules, and scripts on the ServiceNow platform.</div> </div> <div style="background-color: #ffffff; border: 1pt solid #e5e7eb; border-radius: 8pt; padding: 16pt; margin-bottom: 16pt; border-left: 5pt solid #00718F; box-shadow: 0pt 2pt 6pt rgba(0,0,0,0.05);"> <div style="font-size: 16pt; font-weight: bold; color: #111827; margin-bottom: 8pt;">Summary</div> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563;">Slow pages, reports, and background jobs are often caused by inefficient queries or scripts. This article explains the concepts behind query performance in plain terms and gives actionable best practices that any ServiceNow administrator or developer can use inside the platform. You do not need database access to apply these recommendations; ServiceNow manages the underlying database engine, whether it is <strong>MariaDB</strong> or <strong>Postgres (RaptorDB)</strong>.</div> </div> <div style="background-color: #ffffff; border: 1pt solid #e5e7eb; border-radius: 8pt; padding: 16pt; margin-bottom: 16pt; border-top: 5pt solid #0ea5e9; box-shadow: 0pt 2pt 6pt rgba(0,0,0,0.05);"> <div style="font-size: 18pt; font-weight: bold; color: #111827; margin-bottom: 12pt;">Key Concepts</div> <div style="font-size: 12pt; font-weight: bold; color: #032d42; margin-top: 16pt; margin-bottom: 6pt;">What is an index?</div> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-bottom: 8pt;">An index is like the index at the back of a book. Instead of reading every page to find a topic, the database looks at the index and jumps straight to the right page. Fields such as <code>sys_id</code>, <code>number</code>, <code>sys_created_on</code>, <code>sys_updated_on</code>, and reference fields are typically indexed by default. When your query uses one of these fields, the database finds matching records quickly.</div> <div style="font-size: 12pt; font-weight: bold; color: #032d42; margin-top: 16pt; margin-bottom: 6pt;">What is a B-tree?</div> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-bottom: 8pt;">A B-tree is the most common type of index structure. It organizes values in a balanced tree so the database can find, insert, and delete entries quickly. Think of it as a sorted list that the database can search in steps instead of scanning one item at a time. ServiceNow uses B-tree indexes on most fields automatically; you generally do not need to manage them directly.</div> <div style="font-size: 12pt; font-weight: bold; color: #032d42; margin-top: 16pt; margin-bottom: 6pt;">What is a full scan?</div> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-bottom: 8pt;">If a query cannot use an index, the database has to read every row in the table. This is called a full table scan. It works fine for small tables but becomes slow as data grows. The goal of efficient querying is to give the database enough information to use an index so it avoids reading every row.</div> <div style="font-size: 12pt; font-weight: bold; color: #032d42; margin-top: 16pt; margin-bottom: 6pt;">What does ANALYZE mean?</div> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-bottom: 8pt;"><code>ANALYZE</code> is a database command that updates statistics about the data in a table, such as how many rows exist and how unique values are distributed. The database uses these statistics to choose the fastest way to run a query. On ServiceNow, this maintenance is handled by the platform; customers do not run it themselves. However, performance issues after a large data import or upgrade can sometimes be related to stale statistics, and support can request a refresh.</div> <div style="font-size: 12pt; font-weight: bold; color: #032d42; margin-top: 16pt; margin-bottom: 6pt;">What is an EXPLAIN plan?</div> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-bottom: 8pt;">An EXPLAIN plan is a preview of how the database intends to run a query. It shows which indexes the database plans to use, how many rows it expects to read, and the order in which it will access tables. It is like looking at a map before taking a trip. EXPLAIN does not actually run the query, so it is fast and safe.</div> <div style="font-size: 12pt; font-weight: bold; color: #032d42; margin-top: 16pt; margin-bottom: 6pt;">What is the difference between EXPLAIN and EXPLAIN ANALYZE?</div> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-bottom: 8pt;">The difference is whether the query actually runs.</div> <ul style="padding-left: 18pt; margin: 0pt; font-size: 10pt; line-height: 17pt; color: #4b5563;"><li style="margin-bottom: 6pt;"><code>EXPLAIN</code> only estimates the plan. It shows what the database thinks will happen.</li><li><code>EXPLAIN ANALYZE</code> runs the query and shows what actually happened, including real timings and real row counts. Because it executes the query, it can take longer and use more resources.</li></ul> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-top: 8pt;">Both are internal support tools. Customers do not run them directly on a ServiceNow instance, but support may use them when investigating a performance case.</div> <div style="font-size: 12pt; font-weight: bold; color: #032d42; margin-top: 16pt; margin-bottom: 6pt;">What is a query hint?</div> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-bottom: 8pt;">A query hint is a special instruction added to a SQL statement that tells the database engine how to run the query. For example, a hint might say "use this specific index" or "join tables in this order." Hints are powerful, but they can also cause problems if the data changes over time. In ServiceNow, query hints are used only by support engineers in specific situations; customers do not add hints themselves.</div> </div> <div style="background-color: #ffffff; border: 1pt solid #e5e7eb; border-radius: 8pt; padding: 16pt; margin-bottom: 16pt; border-top: 5pt solid #00718F; box-shadow: 0pt 2pt 6pt rgba(0,0,0,0.05);"> <div style="font-size: 18pt; font-weight: bold; color: #111827; margin-bottom: 12pt;">Best Practices</div> <div style="background-color: #ffffff; border: 1pt solid #e5e7eb; border-left: 4pt solid #00718F; border-radius: 6pt; padding: 12pt; margin-bottom: 12pt; box-shadow: 0pt 1pt 3pt rgba(0,0,0,0.05);"> <div style="font-size: 12pt; font-weight: bold; color: #032d42; margin-bottom: 6pt;">1. Filter on indexed fields first</div> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-bottom: 8pt;">Always start your list, report, or script query with a selective filter on an indexed field. This tells the database exactly where to look and avoids reading every record. Good starting filters include <code>active</code>, <code>state</code>, dates such as <code>sys_created_on</code>, and reference fields.</div> <div style="background-color: #1e293b; border-radius: 6pt; border-left: 4pt solid #00718F; padding: 12pt; font-family: Consolas, Monaco, monospace; font-size: 10pt; line-height: 15pt; color: #e2e8f0; margin-bottom: 12pt; white-space: pre;">var gr = new GlideRecord('incident'); gr.addQuery('active', true); gr.addQuery('sys_created_on', '>', gs.daysAgo(30)); gr.setLimit(100); gr.orderByDesc('sys_updated_on'); gr.query();</div> <div style="background-color: #e0f2fe; border-left: 4pt solid #0ea5e9; border-radius: 6pt; padding: 12pt;"> <div style="font-size: 12pt; font-weight: bold; color: #032d42; margin-bottom: 6pt;">How to check if a field is indexed</div> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-bottom: 8pt;">You can check indexing directly in the platform without database access:</div> <ol style="padding-left: 18pt; margin: 0pt; font-size: 10pt; line-height: 17pt; color: #4b5563;"><li style="margin-bottom: 6pt;">Navigate to <strong>System Definition > Tables</strong>.</li><li style="margin-bottom: 6pt;">Open the table you want to check.</li><li style="margin-bottom: 6pt;">Click <strong>Columns</strong> in the related links, or open a column from the list.</li><li style="margin-bottom: 6pt;">In the Dictionary record, look for the <strong>Has index</strong> field. If it is checked, the field is indexed.</li><li>You can also scroll to the <strong>Indexes</strong> related list at the bottom of the Dictionary record to see the exact indexes that include this field.</li></ol> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-top: 8pt;">If you frequently filter or sort by a custom field that is not indexed, consider opening a support case or working with your ServiceNow contact to evaluate whether an index is appropriate. Adding too many indexes can also hurt write performance, so it is a balance.</div> </div> </div> <div style="background-color: #ffffff; border: 1pt solid #e5e7eb; border-left: 4pt solid #00718F; border-radius: 6pt; padding: 12pt; margin-bottom: 12pt; box-shadow: 0pt 1pt 3pt rgba(0,0,0,0.05);"> <div style="font-size: 12pt; font-weight: bold; color: #032d42; margin-bottom: 6pt;">2. Make your filters as selective as possible</div> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-bottom: 8pt;">The more specific your query, the fewer rows the database has to examine. Combine these habits to keep result sets small and fast.</div> <ul style="padding-left: 18pt; margin: 0pt; font-size: 10pt; line-height: 17pt; color: #4b5563;"><li style="margin-bottom: 6pt;"><strong>Filter on active records when you can.</strong> <code>active = true</code> is selective on most tables and removes closed or inactive rows from the result set.</li><li style="margin-bottom: 6pt;"><strong>Use specific date ranges.</strong> Prefer <code>sys_created_on > last 30 days</code> over <code>All time</code>. Open-ended date filters force the database to consider the entire history of the table.</li><li style="margin-bottom: 6pt;"><strong>Be careful with null or empty checks.</strong> Searching for <code>is empty</code> on an unindexed field often causes a full scan. Pair empty checks with another indexed filter such as <code>active</code> or a date range.</li><li><strong>Keep the row count low.</strong> Use <code>setLimit()</code> in scripts, keep list views under a few thousand rows, and paginate reports. Returning more rows than the user needs wastes database, network, and browser resources.</li></ul> <div style="background-color: #1e293b; border-radius: 6pt; border-left: 4pt solid #00718F; padding: 12pt; font-family: Consolas, Monaco, monospace; font-size: 10pt; line-height: 15pt; color: #e2e8f0; margin-bottom: 12pt; white-space: pre;">var gr = new GlideRecord('incident'); gr.addActiveQuery(); // active = true gr.addQuery('caller_id', callerId); gr.addQuery('sys_created_on', '>', gs.daysAgo(7)); gr.setLimit(50); gr.query();</div> </div> <div style="background-color: #ffffff; border: 1pt solid #e5e7eb; border-left: 4pt solid #00718F; border-radius: 6pt; padding: 12pt; margin-bottom: 12pt; box-shadow: 0pt 1pt 3pt rgba(0,0,0,0.05);"> <div style="font-size: 12pt; font-weight: bold; color: #032d42; margin-bottom: 6pt;">3. Avoid overly broad searches and leading wildcards</div> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-bottom: 8pt;">A search for <em>contains</em> text without any other filter often scans large amounts of data. A leading wildcard, such as searching for <code>*error</code>, is especially expensive because the database cannot use an index. Use exact or starts-with filters when possible, and always pair text searches with another indexed filter such as a date or active flag.</div> </div> <div style="background-color: #ffffff; border: 1pt solid #e5e7eb; border-left: 4pt solid #00718F; border-radius: 6pt; padding: 12pt; margin-bottom: 12pt; box-shadow: 0pt 1pt 3pt rgba(0,0,0,0.05);"> <div style="font-size: 12pt; font-weight: bold; color: #032d42; margin-bottom: 6pt;">4. Keep list views focused</div> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-bottom: 8pt;">Long lists with many columns, large text fields, or millions of rows slow down both the database and the browser. Use filters, related lists, and breakdown boards to keep the data set small. Avoid displaying <code>description</code>, <code>work_notes</code>, or other long text fields as list columns.</div> </div> <div style="background-color: #ffffff; border: 1pt solid #e5e7eb; border-left: 4pt solid #00718F; border-radius: 6pt; padding: 12pt; margin-bottom: 12pt; box-shadow: 0pt 1pt 3pt rgba(0,0,0,0.05);"> <div style="font-size: 12pt; font-weight: bold; color: #032d42; margin-bottom: 6pt;">5. Avoid sorting by text or unindexed fields</div> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-bottom: 8pt;">Sorting by <code>short_description</code>, <code>description</code>, or journal fields often forces the database to read and sort all matching rows in memory. Sort by indexed fields such as <code>number</code>, <code>sys_created_on</code>, or <code>sys_updated_on</code> instead.</div> </div> <div style="background-color: #ffffff; border: 1pt solid #e5e7eb; border-left: 4pt solid #00718F; border-radius: 6pt; padding: 12pt; margin-bottom: 12pt; box-shadow: 0pt 1pt 3pt rgba(0,0,0,0.05);"> <div style="font-size: 12pt; font-weight: bold; color: #032d42; margin-bottom: 6pt;">6. Do not nest GlideRecord queries inside loops</div> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-bottom: 8pt;">A query inside a loop issues one database call per loop iteration. If the outer loop has 1,000 records, the inner query runs 1,000 times. Rewrite this as a single query using <code>addQuery('sys_id', 'IN', ids)</code> or a related-list approach.</div> <div style="background-color: #1e293b; border-radius: 6pt; border-left: 4pt solid #00718F; padding: 12pt; font-family: Consolas, Monaco, monospace; font-size: 10pt; line-height: 15pt; color: #e2e8f0; margin-bottom: 12pt; white-space: pre;">// Avoid: one query per parent record while (parentGR.next()) { var childGR = new GlideRecord('task'); childGR.addQuery('parent', parentGR.sys_id); childGR.query(); while (childGR.next()) { ... } } // Prefer: one query for all related records var childGR = new GlideRecord('task'); childGR.addQuery('parent.sys_id', 'IN', parentIds); childGR.query();</div> </div> <div style="background-color: #ffffff; border: 1pt solid #e5e7eb; border-left: 4pt solid #00718F; border-radius: 6pt; padding: 12pt; margin-bottom: 12pt; box-shadow: 0pt 1pt 3pt rgba(0,0,0,0.05);"> <div style="font-size: 12pt; font-weight: bold; color: #032d42; margin-bottom: 6pt;">7. Use GlideAggregate for counts and summaries</div> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-bottom: 8pt;">Counting or summing by looping through every <code>GlideRecord</code> loads all rows into memory. <code>GlideAggregate</code> asks the database to do the math and return only the result.</div> <div style="background-color: #1e293b; border-radius: 6pt; border-left: 4pt solid #00718F; padding: 12pt; font-family: Consolas, Monaco, monospace; font-size: 10pt; line-height: 15pt; color: #e2e8f0; margin-bottom: 12pt; white-space: pre;">var agg = new GlideAggregate('incident'); agg.addQuery('active', true); agg.addAggregate('COUNT'); agg.query(); if (agg.next()) { gs.info('Active incidents: ' + agg.getAggregate('COUNT')); }</div> </div> <div style="background-color: #ffffff; border: 1pt solid #e5e7eb; border-left: 4pt solid #00718F; border-radius: 6pt; padding: 12pt; margin-bottom: 12pt; box-shadow: 0pt 1pt 3pt rgba(0,0,0,0.05);"> <div style="font-size: 12pt; font-weight: bold; color: #032d42; margin-bottom: 6pt;">8. Use reports and Performance Analytics instead of heavy scripts</div> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-bottom: 8pt;">For dashboards and read-only reporting, prefer out-of-the-box reports, report sources, and Performance Analytics indicators over custom scripts. These features are optimized by the platform and are easier to maintain.</div> </div> <div style="background-color: #ffffff; border: 1pt solid #e5e7eb; border-left: 4pt solid #00718F; border-radius: 6pt; padding: 12pt; margin-bottom: 12pt; box-shadow: 0pt 1pt 3pt rgba(0,0,0,0.05);"> <div style="font-size: 12pt; font-weight: bold; color: #032d42; margin-bottom: 6pt;">9. Batch bulk updates and suppress unnecessary processing</div> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-bottom: 8pt;">Updating thousands of records one at a time fires business rules, workflows, audits, and email notifications for every record. When you perform a bulk update from a background script or fix script, consider disabling workflow and system-field updates if they are not required. Test in a sub-production instance first and document why it is disabled.</div> <div style="background-color: #1e293b; border-radius: 6pt; border-left: 4pt solid #00718F; padding: 12pt; font-family: Consolas, Monaco, monospace; font-size: 10pt; line-height: 15pt; color: #e2e8f0; margin-bottom: 12pt; white-space: pre;">gr.setWorkflow(false); gr.autoSysFields(false); gr.setUseEngineer(false); gr.updateMultiple();</div> </div> <div style="background-color: #ffffff; border: 1pt solid #e5e7eb; border-left: 4pt solid #00718F; border-radius: 6pt; padding: 12pt; margin-bottom: 12pt; box-shadow: 0pt 1pt 3pt rgba(0,0,0,0.05);"> <div style="font-size: 12pt; font-weight: bold; color: #032d42; margin-bottom: 6pt;">10. Avoid synchronous external calls in real-time rules</div> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-bottom: 8pt;">Business rules or UI actions that wait for an external REST or SOAP response hold database transactions open and block the user's page. Move these calls to asynchronous business rules, scheduled jobs, or integrations that use the Import Set or Transform Map flow.</div> </div> <div style="background-color: #ffffff; border: 1pt solid #e5e7eb; border-left: 4pt solid #00718F; border-radius: 6pt; padding: 12pt; margin-bottom: 12pt; box-shadow: 0pt 1pt 3pt rgba(0,0,0,0.05);"> <div style="font-size: 12pt; font-weight: bold; color: #032d42; margin-bottom: 6pt;">11. Be careful with complex OR conditions</div> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-bottom: 8pt;">A long list of OR conditions, especially on different fields, can make it hard for the database to use an index. Break the query into smaller, focused filters or use report sources and database views when the logic becomes complex.</div> </div> <div style="background-color: #ffffff; border: 1pt solid #e5e7eb; border-left: 4pt solid #00718F; border-radius: 6pt; padding: 12pt; margin-bottom: 12pt; box-shadow: 0pt 1pt 3pt rgba(0,0,0,0.05);"> <div style="font-size: 12pt; font-weight: bold; color: #032d42; margin-bottom: 6pt;">12. Keep business rules and workflows lightweight</div> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-bottom: 8pt;">Business rules run on record load, insert, update, or delete. A single heavy query inside a business rule can slow down every form save or list load. Query business rules run for every record displayed in a list, so they should be especially selective. Move expensive logic to asynchronous business rules, scheduled jobs, or flows when real-time processing is not required.</div> </div> <div style="background-color: #ffffff; border: 1pt solid #e5e7eb; border-left: 4pt solid #00718F; border-radius: 6pt; padding: 12pt; box-shadow: 0pt 1pt 3pt rgba(0,0,0,0.05);"> <div style="font-size: 12pt; font-weight: bold; color: #032d42; margin-bottom: 6pt;">13. Separate client-side from server-side slowness</div> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-bottom: 8pt;">Not all slowness comes from the database. If the server response time in Transaction Logs is low but the page still feels slow, the delay is likely in the browser. Common client-side causes include too many related lists, embedded reports, large forms, and client scripts that make many server calls. Use your browser's developer tools to inspect network timings and compare them to the server-side transaction log.</div> </div> </div> <div style="background-color: #ffffff; border: 1pt solid #e5e7eb; border-radius: 8pt; padding: 16pt; margin-bottom: 16pt; border-top: 5pt solid #032D42; box-shadow: 0pt 2pt 6pt rgba(0,0,0,0.05);"> <div style="font-size: 18pt; font-weight: bold; color: #111827; margin-bottom: 12pt;">MariaDB and Postgres on ServiceNow</div> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-bottom: 8pt;">ServiceNow manages the database engine for you. Your instance may run on MariaDB or Postgres (RaptorDB), but the platform best practices above are the same for both. The database engine, index structures, and statistics maintenance happen behind the scenes. If you open a support case for a slow query, ServiceNow support can inspect the engine-specific details and request any needed maintenance.</div> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-bottom: 8pt;">The main differences customers may notice are:</div> <ul style="padding-left: 18pt; margin: 0pt; font-size: 10pt; line-height: 17pt; color: #4b5563;"><li style="margin-bottom: 6pt;"><strong>Case sensitivity:</strong> Some text searches may behave differently. Test filters and reports after an instance move or upgrade if search results change unexpectedly.</li><li style="margin-bottom: 6pt;"><strong>Full-text search:</strong> Both engines support platform full-text search, but the relevance ranking and supported operators can differ slightly.</li><li><strong>JSON fields:</strong> Postgres has stronger native support for JSON data, but most ServiceNow functionality abstracts this away.</li></ul> </div> <div style="background-color: #ffffff; border: 1pt solid #e5e7eb; border-radius: 8pt; padding: 16pt; margin-bottom: 16pt; border-top: 5pt solid #f59e0b; box-shadow: 0pt 2pt 6pt rgba(0,0,0,0.05);"> <div style="font-size: 18pt; font-weight: bold; color: #111827; margin-bottom: 12pt;">Diagnosing Slow Performance</div> <ul style="padding-left: 18pt; margin: 0pt; font-size: 10pt; line-height: 17pt; color: #4b5563;"><li style="margin-bottom: 6pt;">Identify slow lists and reports by reviewing transaction times in <strong>System Diagnostics > Transaction Logs</strong>.</li><li style="margin-bottom: 6pt;">Check whether slow pages have many related lists, embedded reports, or client scripts making server calls.</li><li style="margin-bottom: 6pt;">Review scheduled jobs and business rules that run on the same table; a single expensive script can affect the whole instance.</li><li>If a query was fast before and is now slow after a data import or upgrade, mention that in your support case. The issue may be related to database statistics that support can refresh.</li></ul> <div style="font-size: 12pt; font-weight: bold; color: #032d42; margin-top: 16pt; margin-bottom: 8pt;">Testing and measuring changes</div> <ul style="padding-left: 18pt; margin: 0pt; font-size: 10pt; line-height: 17pt; color: #4b5563;"><li style="margin-bottom: 6pt;">Test filter, script, and business rule changes in a sub-production instance first.</li><li style="margin-bottom: 6pt;">Measure response times before and after the change using the same list, report, or form.</li><li style="margin-bottom: 6pt;">Compare server time in Transaction Logs with browser network timings from developer tools.</li><li>Validate that the change does not break existing functionality, especially for integrations and workflows.</li></ul> <div style="font-size: 12pt; font-weight: bold; color: #032d42; margin-top: 16pt; margin-bottom: 8pt;">When to open a support case</div> <div style="font-size: 10pt; line-height: 17pt; color: #4b5563; margin-bottom: 8pt;">Open a support case when you have ruled out common platform-level causes and the issue persists. Include as much of the following as possible:</div> <ul style="padding-left: 18pt; margin: 0pt; font-size: 10pt; line-height: 17pt; color: #4b5563;"><li style="margin-bottom: 6pt;">The exact list, form, report, or script that is slow.</li><li style="margin-bottom: 6pt;">The table involved and any filters or query conditions being used.</li><li style="margin-bottom: 6pt;">Transaction IDs or screenshots from <strong>System Diagnostics > Transaction Logs</strong>.</li><li style="margin-bottom: 6pt;">Whether the slowness is constant or happens at specific times, and whether it affects all users or only some.</li><li style="margin-bottom: 6pt;">Any recent changes such as upgrades, data imports, new business rules, scheduled jobs, or integrations.</li><li>Whether the issue started after an instance move, upgrade, or database maintenance window.</li></ul> </div> <div style="background-color: #ffffff; border: 1pt solid #e5e7eb; border-radius: 8pt; padding: 16pt; margin-bottom: 16pt; border-top: 5pt solid #10b981; box-shadow: 0pt 2pt 6pt rgba(0,0,0,0.05);"> <div style="font-size: 18pt; font-weight: bold; color: #111827; margin-bottom: 12pt;">Related Resources</div> <ul style="padding-left: 18pt; margin: 0pt; font-size: 10pt; line-height: 17pt; color: #4b5563;"><li style="margin-bottom: 6pt;"><a style="color: #00718f; text-decoration: none; font-weight: 600;" href="/kb?id=kb_article_view&sysparm_article=KB1117320" target="_blank" rel="noopener noreferrer">KB1117320 - Creating Good Database Indexes</a></li><li style="margin-bottom: 6pt;"><a style="color: #00718f; text-decoration: none; font-weight: 600;" href="/kb?id=kb_article_view&sysparm_article=KB0963717" target="_blank" rel="noopener noreferrer">KB0963717 - StatsNow Pattern Dashboards</a></li><li style="margin-bottom: 6pt;"><a style="color: #00718f; text-decoration: none; font-weight: 600;" href="/kb?id=kb_article_view&sysparm_article=KB1431403" target="_blank" rel="noopener noreferrer">KB1431403 - Postgres Training</a></li><li style="margin-bottom: 6pt;"><a style="color: #00718f; text-decoration: none; font-weight: 600;" href="/kb?id=kb_article_view&sysparm_article=KB0859424" target="_blank" rel="noopener noreferrer">KB0859424 - ALERT: Abnormal SQL Response Time</a></li><li><a style="color: #00718f; text-decoration: none; font-weight: 600;" href="https://docs.servicenow.com/" target="_blank" rel="noopener noreferrer">ServiceNow Product Documentation</a></li></ul> <div style="font-size: 12pt; font-weight: bold; color: #032d42; margin-top: 16pt; margin-bottom: 8pt;">Data Management</div> <ul style="padding-left: 18pt; margin: 0pt; font-size: 10pt; line-height: 17pt; color: #4b5563;"><li style="margin-bottom: 6pt;"><a style="color: #00718f; text-decoration: none; font-weight: 600;" href="/kb?id=kb_article_view&sysparm_article=KB2157922" target="_blank" rel="noopener noreferrer">KB2157922 - DM Table Cleaner</a></li><li style="margin-bottom: 6pt;"><a style="color: #00718f; text-decoration: none; font-weight: 600;" href="/kb?id=kb_article_view&sysparm_article=KB2023435" target="_blank" rel="noopener noreferrer">KB2023435 - DB Compaction</a></li><li style="margin-bottom: 6pt;"><a style="color: #00718f; text-decoration: none; font-weight: 600;" href="/kb?id=kb_article_view&sysparm_article=KB1640606" target="_blank" rel="noopener noreferrer">KB1640606 - Table Cleaner</a></li><li style="margin-bottom: 6pt;"><a style="color: #00718f; text-decoration: none; font-weight: 600;" href="/kb?id=kb_article_view&sysparm_article=KB1313254" target="_blank" rel="noopener noreferrer">KB1313254 - Glide List: Array Denormalization</a></li><li style="margin-bottom: 6pt;"><a style="color: #00718f; text-decoration: none; font-weight: 600;" href="/kb?id=kb_article_view&sysparm_article=KB1122144" target="_blank" rel="noopener noreferrer">KB1122144 - Data Archiving</a></li><li><a style="color: #00718f; text-decoration: none; font-weight: 600;" href="/kb?id=kb_article_view&sysparm_article=KB0547695" target="_blank" rel="noopener noreferrer">KB0547695 - Archiving - FAQ</a></li></ul> </div> </div> <span id="ns-kb-css-end-div-identifier" style="display: none; pointer-events: none;"></span></div></div>