mirror of
https://github.com/lancedb/lancedb.git
synced 2026-10-15 16:22:27 +00:00
56 lines
2.5 KiB
Plaintext
56 lines
2.5 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"]
|
|
---
|
|
|
|
## Querying tables {#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.
|
|
|
|
## SDK searches and SQL queries {#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.
|
|
|
|
## Collect or stream results {#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.
|
|
Reading batches avoids loading the entire result into application memory.
|
|
It does not guarantee that the query can return its first batch immediately.
|
|
|
|
### Asynchronous clients {#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.
|
|
|
|
### Query handles and background jobs {#jobs}
|
|
|
|
An Enterprise SQL query handle lets you inspect query execution and request
|
|
cancellation. Background operations such as index builds return a
|
|
[job](/basics/jobs) handle instead. Use the API for the returned handle to
|
|
check status and retrieve results.
|
|
|
|
## 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.
|