mirror of
https://github.com/lancedb/lancedb.git
synced 2026-01-10 05:42:58 +00:00
These operations have existed in lance for a long while and many users need to drop down to lance for this capability. This PR adds the API and implements it using filters (e.g. `_rowid IN (...)`) so that in doesn't currently add any load to `BaseTable`. I'm not sure that is sustainable as base table implementations may want to specialize how they handle this method. However, I figure it is a good starting point. In addition, unlike Lance, this API does not currently guarantee anything about the order of the take results. This is necessary for the fallback filter approach to work (SQL filters cannot guarantee result order)
1.6 KiB
1.6 KiB
@lancedb/lancedb • Docs
@lancedb/lancedb / Session
Class: Session
A session for managing caches and object stores across LanceDB operations.
Sessions allow you to configure cache sizes for index and metadata caches, which can significantly impact memory use and performance. They can also be re-used across multiple connections to share the same cache state.
Constructors
new Session()
new Session(indexCacheSizeBytes?, metadataCacheSizeBytes?): Session
Create a new session with custom cache sizes.
Parameters
index_cache_size_bytes: The size of the index cache in bytes. Index data is stored in memory in this cache to speed up queries. Defaults to 6GB if not specified.metadata_cache_size_bytes: The size of the metadata cache in bytes. The metadata cache stores file metadata and schema information in memory. This cache improves scan and write performance. Defaults to 1GB if not specified.
Parameters
-
indexCacheSizeBytes?:
null|bigint -
metadataCacheSizeBytes?:
null|bigint
Returns
Methods
approxNumItems()
approxNumItems(): number
Get the approximate number of items cached in the session.
Returns
number
sizeBytes()
sizeBytes(): bigint
Get the current size of the session caches in bytes.
Returns
bigint
default()
static default(): Session
Create a session with default cache sizes.
This is equivalent to creating a session with 6GB index cache and 1GB metadata cache.