Data Retrieval Performance Boosts

Data retrieval performance directly impacts your site's loading times and responsiveness. When your site handles large amounts of data, common operations like displaying products, filtering blog posts, or loading member information can become slower.

By implementing the right performance techniques, you can maintain fast page loading and response times even as your data grows. Below are key approaches to optimize data retrieval:

You can also upgrade your plan to receive more resources. Read about premium plans to understand the limitations that exist and which plans increase which limits.

Indexes

Add indexes to your data collection to optimize database query performance and improve data retrieval speed. Without indexes, queries run filter and sort operations that iterate through every item in the collection. For small collections, query time might be negligible. But as data quantity increases, each query takes longer to process.

When you add an index, you provide a map of the collection's data based on specific database fields. The database uses this map to quickly identify and retrieve the rows that match a particular value, reducing query response times.

You can also improve sorting operation performance with indexes. When you create an index on the column being sorted, the database can arrange data in the desired order without scanning the entire collection, reducing sort times and improving query performance.

Note: While indexes enhance data retrieval speeds, they can slightly slow down write operations because the system must update indexes for each change in addition to making the actual change.

Router pages

Router pages let you optimize page performance by retrieving data before the page renders. You can control how your site handles incoming requests, queries site data, and determines what data to pass to your page.

You can further improve performance with routers by caching the retrieved data. For example, when the first visitor accesses a product category page, the router loads and caches the data. Then subsequent visitors to that category page see it faster because they access the cached data.

For more information about implementing routers and optimizing their performance with caching, see About Router Caching.

Dynamic pages

Use dynamic pages instead of regular pages with datasets for better site performance. While you can use a regular page with a dataset to display collection data, dynamic pages are often faster.

Dynamic pages retrieve data during the page rendering process because the system knows the page expects data. Regular pages retrieve data much later in the loading process, which can slow down loading time.

Delayed loading

If you have a lot of data to retrieve on your site, first download a small number of items, which will load quickly, and present those items to site visitors. You can then download the rest of the data at a later time.

For example, suppose you want to display items from a collection in a repeater. Instead of showing all the items from your collection when the page loads, you can start by showing only the items site visitors see immediately. Load just enough data to fill the initial view, then download additional items in the background as needed.

To implement delayed loading with datasets:

  1. Set the Number of items to display in your dataset settings to 5 to control how many items load initially
  2. Add code to incrementally load remaining items by checking the total number of pages and loading each additional page:
Copy

To implement delayed loading using a repeater:

  1. Set up the initial query with a limit of 5 items to control the first batch of data that loads and displays in the repeater
  2. Incrementally load and append the remaining items in batches using next()
Copy

See also

Did this help?