Skip to main content

How to Index a Column in a SharePoint List

· 8 min read
Jagdish Kumawat
Founder @ Dewiride

A SharePoint list can hold millions of items, but SharePoint blocks any single query that has to work through more than about 5,000 of them at once. An index on the column you filter by lets SharePoint jump straight to the matching items instead. It takes a minute to add, and the best time to add it is while the list is still small.

What You Will Build​

In this guide you'll index the JobTitle column of a list called RoleCompetencies. The Career Development Plan app always looks up competencies by job title, so that's the column its queries filter on. The app's other list, CompetencyResponses, gets an index on EmployeeId the same way.

The steps work for any list and any column you filter on.

When a List Needs an Index​

The list view threshold. SharePoint limits how many items one database operation, such as a query, can process at a time. By default that limit, the list view threshold, is about 5,000 items, and in SharePoint in Microsoft 365 it can't be changed. Operations that go past it are blocked. Lists themselves can hold up to 30 million items. The limit is on what a single query looks through, not on how many items the list holds.

What an index changes. Without an index, filtering a 20,000-item list for one job title means looking through all 20,000. With an index on that column, SharePoint finds the matching items directly. Microsoft's guidance for SharePoint Online is to filter on indexed columns, so that each view or query returns 5,000 items or fewer.

Index early. In SharePoint Online, you can only add or remove an index while the list has 20,000 items or fewer. Indexing a list that's still empty, or small, avoids that wall altogether.

Index only what you filter on. A list can have up to 20 indexes, but each one adds some overhead whenever items change. Index the columns your views and apps actually filter or sort by.

Which columns can be indexed:

Can be indexedCan't be indexed
Single line of textMultiple lines of text
Choice (single value)Choice (multiple values)
Number, CurrencyCalculated
Date and TimeHyperlink or Picture
Yes/NoPerson or Group (multiple values)
Person or Group (single value)Custom columns
Lookup, Managed MetadataExternal data

Indexing a Lookup column doesn't stop a lookup from exceeding the threshold, so filter on a different kind of column where you can.

Apps benefit too. Microsoft's Power Apps guidance on query performance says the columns an app filters or sorts on should be indexed in the data source.

Prerequisites​

Step 1: Open Indexed Columns​

Open the list and select Settings (the gear) → List settings. On the settings page, scroll to the Columns section. Below the column table, select Indexed columns.

The Columns section of the RoleCompetencies list settings, listing Title, JobTitle, Level, IsActive and Competency with their types and required ticks, and the Indexed columns link outlined in red below Create column, Add from existing site columns and Column ordering

Step 2: Create a New Index​

The Indexed Columns page lists the indexes you've created: 0 of maximum 20 for a new list. Select Create a new index.

The Indexed Columns page saying You have created 0 of maximum 20 indices on this list, with the Create a new index link outlined in red

Step 3: Pick the Column​

On Edit index, open Primary column for this index and choose JobTitle. The list starts on Color Tag, a built-in column, so make sure you change it.

The Edit index page with Primary column for this index set to JobTitle and outlined in red, and the Secondary column for this index greyed out

Leave Secondary column for this index empty. It stays greyed out unless the primary column is one that can start a compound index, an index over two columns that SharePoint builds from a Lookup column. A single-column index is what you need to filter by one column.

Select Create.

Step 4: Check the Index​

You're back on Indexed Columns, which now reads 1 of maximum 20 and lists JobTitle.

The Indexed Columns page saying You have created 1 of maximum 20 indices on this list, with JobTitle listed and outlined in red

On an empty or small list, the index is ready straight away. To index another column, select Create a new index again. To remove an index, select its name and choose Delete; that removes only the index, not the column or its data.

Automatic Index Management​

SharePoint can also create indexes by itself. On the list's Advanced settings page, Allow automatic management of indices? is set to Yes for new lists.

The Automatic Index Management section of Advanced settings, explaining that SharePoint maintains column indices to give views the best query performance, with Allow automatic management of indices set to Yes and outlined in red

With it on, SharePoint can add indexes for the list's views that sort or filter, while the list has fewer than 20,000 items. Leave it on, but don't rely on it for an app. Microsoft describes it in terms of the list's views, and an app's queries aren't views. Create the indexes your app needs yourself, as above.

Common Mistakes​

MistakeWhat happensDo this instead
Waiting until the list is bigPast 20,000 items, you can't add or remove an indexIndex while the list is small
Leaving Color Tag as the primary columnYou index the wrong columnPick the column you filter on
Indexing every columnEach index adds work whenever items changeIndex only the columns you filter or sort by
Relying on automatic indexing for an appIt's built around the list's views, not an app's queriesCreate the app's indexes yourself
Filtering a large list on a column that can't be indexedThe query hits the thresholdFilter first on an indexed column, such as a single-line text or number column

Troubleshooting​

SymptomLikely causeFix
Indexed columns isn't on the settings pageYou don't have permission to manage listsAsk an owner for Edit or higher
The column isn't in Primary column for this indexIts type can't be indexedCheck the table above, or filter on a different column
A view or query fails once the list growsIt filters on a column without an indexIndex that column, while the list has 20,000 items or fewer
You can't add an index to a big listThe list is over 20,000 itemsSee Microsoft's article on the filter error in Additional Resources, and add indexes to new lists while they're small

FAQ​

Does an index change my data?​

No. An index only helps SharePoint find items. Adding or removing one doesn't change any item.

Is the 5,000 limit a limit on the list's size?​

No. It limits how many items one query works through. A list can hold up to 30 million items, as long as its views and queries stay under the threshold.

Can I raise the list view threshold?​

Not in SharePoint in Microsoft 365. It's fixed at about 5,000 items.

How many indexes should a list have?​

As many as the columns you filter or sort on, and no more. Many lists need one or two.

Conclusion​

Index the columns your views and apps filter on, and do it early. SharePoint blocks a query that has to work through more than about 5,000 items, and an index is what lets it find the right items without that. List settings → Indexed columns → Create a new index → pick the column → Create: a minute's work, and it can only be done while the list has 20,000 items or fewer.

Additional Resources​

Stay Updated

Subscribe to our newsletter for the latest tutorials, tech insights, and developer news.

By subscribing, you agree to our privacy policy. Unsubscribe at any time.