Check the Database Before You Ask AI to Guess
HubSpot co-founder Dharmesh Shah says a direct lookup beats AI inference for facts you already store.

The a16z Show · HubSpot’s Co-Founder on Finding Your Next Startup IdeaDharmesh Shah, the co-founder of HubSpot, has a blunt rule for working with artificial intelligence: if a simple lookup can answer the question, do the lookup.
His rule, in his words, is "anything that can be solved with a structured query deterministically" should be solved that way. A structured query is a precise request to a database, like asking for a total in a spreadsheet, while inference is the AI piecing together an answer by guessing from clues.
His example is revenue from Ireland. If you want to know how much revenue is coming from Ireland, pull it from the database. Do not ask the AI to reconstruct the number by hunting through huge piles of chats and emails.
His point is that the data is probably in those messages somewhere, but digging it out by inference is the wrong tool. That job should be a database query, not a task for what he jokingly called a 300 IQ model.
The rule leaves plenty of room for AI, just in the right place. Use the database for settled facts like customers and revenue, and save inference for messy questions that no query can answer.
To try it, start with your next AI question and ask where the answer lives. If one database field holds it, write the query first.
Questions people ask
What exactly is a structured query?
A structured query is a precise instruction to a database, such as asking for sales where the country equals Ireland. It returns exactly what matches, without guessing. If the data is recorded cleanly, it is usually faster and more reliable than interpretation.
When should I still use AI inference?
Inference means the AI reads scattered clues and produces its best answer. That is useful for summaries, drafts, and judgment calls across messy text. It is a poor fit for an exact number that already exists in a database.
How do I tell which method fits my question?
Check whether one system already stores the fact, and whether you know its field names and definitions. If you can name the table and filters, write the query. If the answer only exists as opinions or hints across documents, then bring in AI.



