Files
lancedb/docs/web/basics/query.mdx
T

55 lines
2.4 KiB
Plaintext

---
title: "Queries"
sidebarTitle: "Query"
description: "Choose how to query your data and read the results."
icon: magnifying-glass
keywords: ["query", "search", "SQL", "async", "streaming", "results"]
---
## What is a query? {#queries}
A query selects data from your tables. You can filter rows, choose columns,
search for similar content or combine those operations. For example, a video
application might find clips similar to a sample and return only those recorded
in the last month.
## How can you query? {#searches}
| Interface | When to use it |
| --- | --- |
| **SDK query builders** | Build vector, full-text and hybrid searches, apply filters and choose the fields to return. Available in OSS and Enterprise. |
| **Enterprise SQL** | Write SQL queries for filtering, aggregation, joins and other data curation tasks. Connect through Python or a Flight SQL client. |
Both interfaces work with LanceDB tables. Choose the one that supports your
operation and fits your application. See [SQL](/basics/sql) for connection
instructions and SQL search support, and [Search](/search) for the query builders.
## How do results arrive? {#results}
- **Collect the results** when you want a list, Arrow table or DataFrame that
fits in memory. Use a result limit and select only the columns you need.
- **Read batches** when you want to process a large result incrementally.
Streaming avoids collecting the entire result in application memory, although
some query operations still need to do substantial work before producing rows.
<span id="async-client" />
An async client lets your application do other work while a request is waiting.
That is separate from whether you collect results or read them in batches.
Python offers synchronous and asynchronous clients; TypeScript uses async APIs.
Check the SDK reference for the methods available in your client.
<span id="jobs" />
Enterprise SQL can also return a query handle for inspecting execution and
requesting cancellation. A [job](/basics/jobs) tracks an operation such as an
index build. Use the result API for the operation you submitted.
## Learn more {#next}
- [Quickstart](/quickstart): run a complete create, insert and search example.
- [Search](/search): choose vector, full-text or hybrid retrieval.
- [Filtering](/search/filtering): narrow results with predicates.
- [SQL](/basics/sql): connect a client and run SQL queries.
- [SDKs](/basics/sdk): choose a language and find its API reference.