How do I run SQL queries over thousands of similar PDFs, such as reports or forms that follow one template?

We recommend defining a table over the documents and extracting only the fields a query needs, using the shared template to find them. Our ZenDB system (ICDE 2025) detects the common section structure of templatized documents, such as civic agenda reports, as a tree for each document. You then query the collection with SQL, and ZenDB sends the LLM only the sections that matter.

Sources: Querying Templatized Document Collections with Large Language Models (ICDE 2025)

Guide: How to Process Documents with LLMs Cheaply

More questions on this topic

All questions about using AI for data and knowledge work