IT lexicon › Web › DataLoader

DataLoader

Web På svenska → Updated: 2026-05-24

A JS library from Facebook that solves GraphQL's N+1 problem — batches and caches individual requests within a single tick.

Lee Byron (Facebook). API: new DataLoader(keys => fetchByIds(keys)). A per-request instance collects all the .load(id) calls made during a single event-loop tick → a single call to the database with all IDs. Eliminates N database calls for N nested resolvers. The standard pattern in every serious GraphQL server (Apollo, Mercurius, Yoga). Also useful outside GraphQL as a general "batch + cache" pattern.

← Back to the lexicon