TABLESAMPLE: draw a random subset of a table, by rows or by fragments.
Applies to: Embedded ❌, Enterprise ✅Use TABLESAMPLE to explore a subset of a table or estimate aggregate
statistics. The sampling method determines how much data is read and whether
the table’s physical layout influences the sample.
SELECT * FROM documents TABLESAMPLE (10) -- 10 percentSELECT * FROM documents TABLESAMPLE (500 ROWS) -- 500 rows
A bare number is a percentage. Add ROWS for a count instead.
The standard calls these two methods of one clause. They are different
operations, and the difference matters on Lance:
SELECT * FROM documents TABLESAMPLE BERNOULLI (10)SELECT * FROM documents TABLESAMPLE SYSTEM (10)
Method
Aliases
What it picks
BERNOULLI
ROW
rows, each considered independently
SYSTEM
BLOCK
Lance fragments, and takes whatever rows they hold
BERNOULLI gives a genuinely uniform sample and reads across the whole table to
get it. SYSTEM reads far less (it skips entire fragments), but the sample is
only as uniform as the data’s layout. If rows were written in an order that
correlates with what you are measuring, a fragment sample inherits that
correlation.Use SYSTEM for a quick look at the data and BERNOULLI when you need
independent row sampling. Omitting the method gives
BERNOULLI.
Without a seed, every execution resamples: running the same query twice gives
different rows. REPEATABLE fixes the draw:
SELECT * FROM documents TABLESAMPLE (10) REPEATABLE (42)
Use the same seed and table snapshot to reproduce a sampling run. For a fixed
evaluation set, save the selected row IDs or materialize the sample and retain
its version. A seed alone does not preserve membership after source changes
or changes to the physical layout.
It attaches to a table in FROM, including inside a subquery, a CTE, or either
side of a join:
SELECT * FROM (SELECT * FROM documents TABLESAMPLE (10)) dSELECT * FROM a TABLESAMPLE (5 ROWS) JOIN b ON a.id = b.idSELECT * FROM t a TABLESAMPLE (10) JOIN t b TABLESAMPLE (10) ON a.id = b.id
Each side of a join samples independently. Sampling both sides of a join
shrinks the result far more than either fraction suggests, because a row only
survives if both its sides were drawn.
Sampling is semantics, not a hint. A clause that were read and then not applied
would be a wrong answer rather than a missing feature, so anything that cannot
be honoured exactly is an error:
TABLESAMPLE (101)
a percentage outside 0..=100 is refused, not clamped
TABLESAMPLE (1.5 ROWS)
a row count must be whole
TABLESAMPLE (BUCKET 1 OUT OF 4)
bucket sampling is not supported
(SELECT ...) d TABLESAMPLE (10)
a subquery’s result cannot be sampled; sample the table inside it
the SAMPLE spelling
use TABLESAMPLE
the OFFSET modifier
not supported
TABLESAMPLE is also refused on a WAL-backed table, where the rows a sample
would draw from are not all in the fragments yet.
For a training loop rather than a query, the SDKs read a table in a shuffled
order without going through SQL at all. See Training, where a
permutation drives the data loader.
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"LanceDB","colors":{"primary":"#FF6B35","light":"#FF8A5C","dark":"#E55A2B"},"logo":{"light":"https://mintcdn.com/lancedb-bcbb4faf/6L0IRVkfdlgMU1Pw/static/assets/logo/dark-lancedb-logo.svg?fit=max\u0026auto=format\u0026n=6L0IRVkfdlgMU1Pw\u0026q=85\u0026s=d0592e59a29df2477080a857e13e341f","dark":"https://mintcdn.com/lancedb-bcbb4faf/j6_OQyC0TylLjP5i/static/assets/logo/light-lancedb-logo.svg?fit=max\u0026auto=format\u0026n=j6_OQyC0TylLjP5i\u0026q=85\u0026s=234f55d1e5377e709e3092fa01f2808c","href":"https://lancedb.com"},"favicon":"https://mintcdn.com/lancedb-bcbb4faf/0sS6vrpmM3KSVyss/static/favicon.ico?fit=max\u0026auto=format\u0026n=0sS6vrpmM3KSVyss\u0026q=85\u0026s=84b9ea3dfc312b7a4dfc99219e229b33","appearance":{"strict":false},"background":{"color":{"light":"#FAF5F0","dark":"#000000"}},"navbar":{"links":[{"href":"https://www.lancedb.com/contact","label":"Support"}]},"footer":{"socials":{"github":"https://github.com/lancedb","linkedin":"https://www.linkedin.com/company/lancedb","x":"https://x.com/lancedb","discord":"https://discord.gg/AUEWnJ7Txb"},"links":[{"items":[{"label":"Cookie settings","href":"#cookie-settings"}]}]},"fonts":{"family":"Inter"},"styling":{"codeblocks":{"theme":{"light":"vitesse-light","dark":"catppuccin-mocha"}},"latex":true},"integrations":{"ga4":{"measurementId":"G-1TMC2PR69E"}},"banner":{"content":"[Why Multimodal Data Needs a Better Lakehouse? — Download the Research Study](https://lancedb.com/download/)","dismissible":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"lancedb-bcbb4faf","hasAudioNarration":false,"actualSubdomain":"lancedb-bcbb4faf","customDomains":["docs.lancedb.com"],"gitSource":{"type":"github","owner":"lancedb","repo":"docs","deployBranch":"deploy-freeze","contentDirectory":"docs","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6aec5b61ca078695d829edbe","collectionId":"e46894c6-c5b6-448c-84b2-f237cff3a080","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6aec5b61ca078695d829edbe"},"feedback":{"thumbs":true,"edits":false,"issues":false},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6aec6376aceee0d6e0b04ea4","clientVersion":"0.0.4067","searchFilterCounts":[{"language":"default","tag":"Documentation","count":181},{"language":"default","tag":"API Reference","count":55},{"language":"default","tag":"REST API","count":55},{"language":"default","tag":"Feature Engineering","count":45},{"language":"default","tag":"Table","count":44},{"language":"default","tag":"Integrations","count":42},{"language":"default","tag":"SQL Reference","count":40},{"language":"default","tag":"Geneva","count":34},{"language":"default","tag":"Datasets","count":33},{"language":"default","tag":"Tutorials","count":21}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"static/styles/style.css","content":":root{--banner-left: #e4d8f8;--banner-right: #e55a2b}@font-face{font-family:\"LanceDB KaTeX AMS\";src:url(\"https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_AMS-Regular.woff2\") format(\"woff2\");font-display:swap;font-style:normal;font-weight:400}.katex .mathbb,.katex .textbb{font-family:\"LanceDB KaTeX AMS\", \"KaTeX_AMS\", serif!important}#banner,:where(.banner,[data-banner],[class*=\"Banner_banner\"]){background:linear-gradient(90deg, var(--banner-left) 0%, var(--banner-right) 100%)!important;color:#1b0f09!important;border:none!important}#banner a,:where(.banner,[data-banner],[class*=\"Banner_banner\"]) a{color:#1b0f09!important;font-size:0.9rem;font-weight:500;text-decoration-color:rgba(27, 15, 9, 0.35)}#banner button,:where(.banner,[data-banner],[class*=\"Banner_banner\"]) button{color:#1b0f09!important}"}],"page":{"pagePath":"sql/dql/sampling","slug":"/sql/dql/sampling","pageMetadata":{"title":"Random sampling","sidebarTitle":"Sampling","description":"TABLESAMPLE: draw a random subset of a table, by rows or by fragments.","icon":"dice","keywords":["tablesample","sampling","bernoulli","system","repeatable","random"],"href":"/sql/dql/sampling"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"TABLESAMPLE: draw a random subset of a table, by rows or by fragments.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,em:`em`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Heading,Note,Table}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Table)_missingMdxReference(`Table`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Applies to:`}),` Embedded ❌, Enterprise ✅`]}),`\n`,_jsxs(_components.p,{children:[`Use `,_jsx(_components.code,{children:`TABLESAMPLE`}),` to explore a subset of a table or estimate aggregate\nstatistics. The sampling method determines how much data is read and whether\nthe table’s physical layout influences the sample.`]}),`\n`,_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`SQL`,icon:`database`,numberOfLines:`2`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes vitesse-light catppuccin-mocha`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#1e1e2e`,color:`#393a34`,\"--shiki-dark\":`#cdd6f4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#94E2D5`},children:` *`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:` FROM`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` documents TABLESAMPLE (`}),_jsx(_components.span,{style:{color:`#2F798A`,\"--shiki-dark\":`#FAB387`},children:`10`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`) `}),_jsx(_components.span,{style:{color:`#A0ADA0`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:`-- 10 percent`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#94E2D5`},children:` *`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:` FROM`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` documents TABLESAMPLE (`}),_jsx(_components.span,{style:{color:`#2F798A`,\"--shiki-dark\":`#FAB387`},children:`500`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:` ROWS`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`) `}),_jsx(_components.span,{style:{color:`#A0ADA0`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:`-- 500 rows`})]}),`\n`]})})})}),`\n`,_jsxs(_components.p,{children:[`A bare number is a `,_jsx(_components.strong,{children:`percentage`}),`. Add `,_jsx(_components.code,{children:`ROWS`}),` for a count instead.`]}),`\n`,_jsx(Heading,{level:`2`,id:`methods`,children:`Rows or fragments`}),`\n`,_jsx(_components.p,{children:`The standard calls these two methods of one clause. They are different\noperations, and the difference matters on Lance:`}),`\n`,_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`SQL`,icon:`database`,numberOfLines:`2`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes vitesse-light catppuccin-mocha`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#1e1e2e`,color:`#393a34`,\"--shiki-dark\":`#cdd6f4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#94E2D5`},children:` *`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:` FROM`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` documents TABLESAMPLE BERNOULLI (`}),_jsx(_components.span,{style:{color:`#2F798A`,\"--shiki-dark\":`#FAB387`},children:`10`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#94E2D5`},children:` *`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:` FROM`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` documents TABLESAMPLE `}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`SYSTEM`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` (`}),_jsx(_components.span,{style:{color:`#2F798A`,\"--shiki-dark\":`#FAB387`},children:`10`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`)`})]}),`\n`]})})})}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Method`}),_jsx(_components.th,{children:`Aliases`}),_jsx(_components.th,{children:`What it picks`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`BERNOULLI`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`ROW`})}),_jsx(_components.td,{children:`rows, each considered independently`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`SYSTEM`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`BLOCK`})}),_jsxs(_components.td,{children:[_jsx(_components.strong,{children:`Lance fragments`}),`, and takes whatever rows they hold`]})]})]})]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`BERNOULLI`}),` gives a genuinely uniform sample and reads across the whole table to\nget it. `,_jsx(_components.code,{children:`SYSTEM`}),` reads far less (it skips entire fragments), but the sample is\nonly as uniform as the data’s layout. If rows were written in an order that\ncorrelates with what you are measuring, a fragment sample inherits that\ncorrelation.`]}),`\n`,_jsxs(_components.p,{children:[`Use `,_jsx(_components.code,{children:`SYSTEM`}),` for a quick look at the data and `,_jsx(_components.code,{children:`BERNOULLI`}),` when you need\nindependent row sampling. Omitting the method gives\n`,_jsx(_components.code,{children:`BERNOULLI`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`repeatable`,children:`Repeatability`}),`\n`,_jsxs(_components.p,{children:[`Without a seed, every execution resamples: running the same query twice gives\ndifferent rows. `,_jsx(_components.code,{children:`REPEATABLE`}),` fixes the draw:`]}),`\n`,_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`SQL`,icon:`database`,numberOfLines:`1`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes vitesse-light catppuccin-mocha`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#1e1e2e`,color:`#393a34`,\"--shiki-dark\":`#cdd6f4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#94E2D5`},children:` *`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:` FROM`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` documents TABLESAMPLE (`}),_jsx(_components.span,{style:{color:`#2F798A`,\"--shiki-dark\":`#FAB387`},children:`10`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`) `}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`REPEATABLE`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` (`}),_jsx(_components.span,{style:{color:`#2F798A`,\"--shiki-dark\":`#FAB387`},children:`42`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`)`})]}),`\n`]})})})}),`\n`,_jsx(_components.p,{children:`Use the same seed and table snapshot to reproduce a sampling run. For a fixed\nevaluation set, save the selected row IDs or materialize the sample and retain\nits version. A seed alone does not preserve membership after source changes\nor changes to the physical layout.`}),`\n`,_jsx(Heading,{level:`2`,id:`placement`,children:`Where the clause can go`}),`\n`,_jsxs(_components.p,{children:[`It attaches to a table in `,_jsx(_components.code,{children:`FROM`}),`, including inside a subquery, a CTE, or either\nside of a join:`]}),`\n`,_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`SQL`,icon:`database`,numberOfLines:`5`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes vitesse-light catppuccin-mocha`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#1e1e2e`,color:`#393a34`,\"--shiki-dark\":`#cdd6f4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#94E2D5`},children:` *`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:` FROM`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` (`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#94E2D5`},children:` *`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:` FROM`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` documents TABLESAMPLE (`}),_jsx(_components.span,{style:{color:`#2F798A`,\"--shiki-dark\":`#FAB387`},children:`10`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`)) d`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#94E2D5`},children:` *`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:` FROM`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` a TABLESAMPLE (`}),_jsx(_components.span,{style:{color:`#2F798A`,\"--shiki-dark\":`#FAB387`},children:`5`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:` ROWS`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`) `}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`JOIN`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` b `}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`ON`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#CDD6F4`},children:` a`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`.`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#CDD6F4`},children:`id`}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#94E2D5`},children:` =`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#CDD6F4`},children:` b`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`.`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#CDD6F4`},children:`id`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#94E2D5`},children:` *`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:` FROM`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` t a TABLESAMPLE (`}),_jsx(_components.span,{style:{color:`#2F798A`,\"--shiki-dark\":`#FAB387`},children:`10`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`) `}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`JOIN`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` t b TABLESAMPLE (`}),_jsx(_components.span,{style:{color:`#2F798A`,\"--shiki-dark\":`#FAB387`},children:`10`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`) `}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`ON`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#CDD6F4`},children:` a`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`.`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#CDD6F4`},children:`id`}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#94E2D5`},children:` =`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#CDD6F4`},children:` b`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`.`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#CDD6F4`},children:`id`})]}),`\n`]})})})}),`\n`,_jsxs(_components.p,{children:[`Each side of a join samples independently. Sampling both sides of a join\nshrinks the `,_jsx(_components.em,{children:`result`}),` far more than either fraction suggests, because a row only\nsurvives if both its sides were drawn.`]}),`\n`,_jsx(Heading,{level:`2`,id:`refused`,children:`Unsupported sampling forms`}),`\n`,_jsx(_components.p,{children:`Sampling is semantics, not a hint. A clause that were read and then not applied\nwould be a wrong answer rather than a missing feature, so anything that cannot\nbe honoured exactly is an error:`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{}),_jsx(_components.th,{})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`TABLESAMPLE (101)`})}),_jsxs(_components.td,{children:[`a percentage outside `,_jsx(_components.code,{children:`0..=100`}),` is refused, not clamped`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`TABLESAMPLE (1.5 ROWS)`})}),_jsx(_components.td,{children:`a row count must be whole`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`TABLESAMPLE (BUCKET 1 OUT OF 4)`})}),_jsx(_components.td,{children:`bucket sampling is not supported`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`(SELECT ...) d TABLESAMPLE (10)`})}),_jsx(_components.td,{children:`a subquery’s result cannot be sampled; sample the table inside it`})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[`the `,_jsx(_components.code,{children:`SAMPLE`}),` spelling`]}),_jsxs(_components.td,{children:[`use `,_jsx(_components.code,{children:`TABLESAMPLE`})]})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[`the `,_jsx(_components.code,{children:`OFFSET`}),` modifier`]}),_jsx(_components.td,{children:`not supported`})]})]})]}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`TABLESAMPLE`}),` is also refused on a WAL-backed table, where the rows a sample\nwould draw from are not all in the fragments yet.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`sdk`,children:`Sampling outside SQL`}),`\n`,_jsxs(_components.p,{children:[`For a training loop rather than a query, the SDKs read a table in a shuffled\norder without going through SQL at all. See `,_jsx(_components.a,{href:`/training/data-loading`,children:`Training`}),`, where a\npermutation drives the data loader.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"codeStyling":{"theme":{"light":"vitesse-light","dark":"catppuccin-mocha"}},"config":{},"pageMetadata":{"title":"Random sampling","sidebarTitle":"Sampling","description":"TABLESAMPLE: draw a random subset of a table, by rows or by fragments.","icon":"dice","keywords":["tablesample","sampling","bernoulli","system","repeatable","random"],"href":"/sql/dql/sampling"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Rows or fragments","slug":"methods","depth":2,"children":[]},{"title":"Repeatability","slug":"repeatable","depth":2,"children":[]},{"title":"Where the clause can go","slug":"placement","depth":2,"children":[]},{"title":"Unsupported sampling forms","slug":"refused","depth":2,"children":[]},{"title":"Sampling outside SQL","slug":"sdk","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/lancedb-bcbb4faf/71b64c20a8f631b3/static/scripts/cookie-consent.js"],"subdomain":"lancedb-bcbb4faf","siteName":"LanceDB","title":"Random sampling - LanceDB","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-05T10:33:14.720Z","originalFileLocation":"sql/dql/sampling.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"TABLESAMPLE: draw a random subset of a table, by rows or by fragments.\">\u003cmeta data-mint-head name=\"application-name\" content=\"LanceDB\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/lancedb-bcbb4faf/AJCI1CXWoYDPZbb4/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/lancedb-bcbb4faf/AJCI1CXWoYDPZbb4/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/lancedb-bcbb4faf/AJCI1CXWoYDPZbb4/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/lancedb-bcbb4faf/AJCI1CXWoYDPZbb4/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/lancedb-bcbb4faf/AJCI1CXWoYDPZbb4/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/lancedb-bcbb4faf/AJCI1CXWoYDPZbb4/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/lancedb-bcbb4faf/AJCI1CXWoYDPZbb4/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/lancedb-bcbb4faf/AJCI1CXWoYDPZbb4/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/lancedb-bcbb4faf/AJCI1CXWoYDPZbb4/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Random sampling - LanceDB\">\u003cmeta data-mint-head property=\"og:description\" content=\"TABLESAMPLE: draw a random subset of a table, by rows or by fragments.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"LanceDB\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.lancedb.com/sql/dql/sampling\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://lancedb-bcbb4faf.mintlify.app/_mintlify/api/og/v2?division=DQL\u0026amp;title=Random+sampling\u0026amp;description=TABLESAMPLE%3A+draw+a+random+subset+of+a+table%2C+by+rows+or+by+fragments.\u0026amp;theme=a8508e68546a5d446c7b233e\u0026amp;signature=b23899655a6e438dff89e37f417cf2b20fc8accab34a798e6ceb1ddd02ff20ee\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Random sampling - LanceDB\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"TABLESAMPLE: draw a random subset of a table, by rows or by fragments.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://lancedb-bcbb4faf.mintlify.app/_mintlify/api/og/v2?division=DQL\u0026amp;title=Random+sampling\u0026amp;description=TABLESAMPLE%3A+draw+a+random+subset+of+a+table%2C+by+rows+or+by+fragments.\u0026amp;theme=a8508e68546a5d446c7b233e\u0026amp;signature=b23899655a6e438dff89e37f417cf2b20fc8accab34a798e6ceb1ddd02ff20ee\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/lancedb-bcbb4faf/AJCI1CXWoYDPZbb4/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"LanceDB\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#FF6B35\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.lancedb.com/sql/dql/sampling\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/sql/dql/sampling.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.lancedb.com/#organization\",\"name\":\"LanceDB\",\"url\":\"https://docs.lancedb.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/lancedb-bcbb4faf/6L0IRVkfdlgMU1Pw/static/assets/logo/dark-lancedb-logo.svg?fit=max\u0026auto=format\u0026n=6L0IRVkfdlgMU1Pw\u0026q=85\u0026s=d0592e59a29df2477080a857e13e341f\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.lancedb.com#website\",\"name\":\"LanceDB\",\"url\":\"https://docs.lancedb.com\",\"publisher\":{\"@id\":\"https://docs.lancedb.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.lancedb.com/sql/dql/sampling#webpage\",\"url\":\"https://docs.lancedb.com/sql/dql/sampling\",\"name\":\"Random sampling\",\"description\":\"TABLESAMPLE: draw a random subset of a table, by rows or by fragments.\",\"dateModified\":\"2026-11-05T10:33:14.720Z\",\"isPartOf\":{\"@id\":\"https://docs.lancedb.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.lancedb.com/sql/dql/sampling#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.lancedb.com/sql/dql/sampling#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"SQL Reference\",\"item\":\"https://docs.lancedb.com/sql/index\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DQL\",\"item\":\"https://docs.lancedb.com/sql/dql/select\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Random sampling\",\"item\":\"https://docs.lancedb.com/sql/dql/sampling\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.lancedb.com/sql/dql/sampling#article\",\"headline\":\"Random sampling\",\"name\":\"Random sampling\",\"description\":\"TABLESAMPLE: draw a random subset of a table, by rows or by fragments.\",\"url\":\"https://docs.lancedb.com/sql/dql/sampling\",\"mainEntityOfPage\":{\"@id\":\"https://docs.lancedb.com/sql/dql/sampling#webpage\"},\"dateModified\":\"2026-11-05T10:33:14.720Z\",\"keywords\":\"tablesample, sampling, bernoulli, system, repeatable, random\",\"publisher\":{\"@id\":\"https://docs.lancedb.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.lancedb.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"LanceDB\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"LanceDB","nav":{"global":null,"tabs":[{"tab":"Documentation","groups":[{"group":"Introduction","pages":[{"title":"LanceDB","sidebarTitle":"LanceDB","icon":"https://mintlify.s3.us-west-1.amazonaws.com/lancedb-bcbb4faf/static/assets/logo/lancedb-icon-gray.svg","href":""},{"title":"LanceDB Embedded","sidebarTitle":"LanceDB Embedded","icon":"cube","href":"/basics/lancedb-embedded"},{"title":"LanceDB Enterprise","sidebarTitle":"LanceDB Enterprise","icon":"server","href":"/enterprise/index"},{"title":"Embedded vs Enterprise","sidebarTitle":"Embedded vs Enterprise","icon":"scale-balanced","href":"/basics/embedded-vs-enterprise"}]},{"group":"Getting Started","pages":[{"title":"Quickstart","sidebarTitle":"Quickstart","icon":"rocket","href":"/quickstart"},{"title":"SDKs","sidebarTitle":"SDKs","icon":"code-compare","href":"/basics/sdk"},{"title":"SQL","sidebarTitle":"SQL","icon":"table-list","href":"/basics/sql"},{"title":"Console","sidebarTitle":"Console","icon":"window","href":"/enterprise/console"},{"title":"Agentic skills","sidebarTitle":"Agentic Skills","icon":"robot","href":"/basics/agentic-skills"},{"title":"Support","sidebarTitle":"Support","icon":"circle-question","href":"/deployment/support"}]},{"group":"Concepts","pages":[{"title":"Lance format","sidebarTitle":"Lance Format","icon":"https://mintlify.s3.us-west-1.amazonaws.com/lancedb-bcbb4faf/static/assets/logo/lance-logo-gray.png","href":"/basics/lance"},{"title":"LanceDB Lakehouse","sidebarTitle":"LanceDB Lakehouse","icon":"sitemap","href":"/basics/catalog"},{"title":"Job Framework","sidebarTitle":"Job Framework","icon":"hourglass-half","href":"/basics/jobs"},{"title":"Real Time engine (RTE)","sidebarTitle":"Real Time Engine (RTE)","icon":"bolt","href":"/tables/realtime-engine"},{"title":"Consistency","sidebarTitle":"Consistency","icon":"water","href":"/tables/consistency"},{"title":"Guarantees","sidebarTitle":"Guarantees","icon":"shield-check","href":"/basics/guarantees"},{"title":"Limits","sidebarTitle":"Limits","icon":"ruler","href":"/basics/limits"},{"title":"Naming rules","sidebarTitle":"Naming Rules","icon":"signature","href":"/basics/naming"}]},{"group":"Data Ingestion","pages":[{"title":"Ingesting data","sidebarTitle":"Overview","icon":"inbox","href":"/ingestion/index"},{"title":"Creating a table","sidebarTitle":"Create Table","icon":"table","href":"/ingestion/create-table"},{"title":"Insert data","sidebarTitle":"Insert","icon":"plus","href":"/ingestion/insert"},{"title":"Update rows","sidebarTitle":"Update","icon":"pen","href":"/ingestion/update"},{"title":"Delete rows","sidebarTitle":"Delete","icon":"trash","href":"/ingestion/delete"},{"title":"RTE Write (Upsert)","sidebarTitle":"RTE Write (Upsert)","icon":"bolt","href":"/ingestion/realtime-write"},{"title":"Define Storage Integration","sidebarTitle":"Define Storage Integration","icon":"cloud","href":"/ingestion/define-storage-integration"},{"title":"Attach Database","sidebarTitle":"Attach Database","icon":"plug","href":"/ingestion/migrate-from-embedded"},{"title":"Import Datasets","sidebarTitle":"Import Datasets","icon":"file-import","href":"/ingestion/import"},{"title":"Distributed Write","sidebarTitle":"Distributed Write","icon":"upload","href":"/enterprise/distributed-write"},{"title":"Distributed RTE Write","sidebarTitle":"Distributed RTE Write","icon":"bolt","href":"/enterprise/distributed-real-time-write"}]},{"group":"Search","pages":[{"title":"Search","sidebarTitle":"Overview","icon":"list","href":"/search/index"},{"title":"Vector Search","sidebarTitle":"Vector Search","icon":"arrow-up-right-dots","href":"/search/vector-search"},{"title":"Full-Text Search (FTS)","sidebarTitle":"Full-Text Search (FTS)","icon":"book","href":"/search/full-text-search"},{"title":"Hybrid Search","sidebarTitle":"Hybrid Search","icon":"search","href":"/search/hybrid-search"},{"title":"Metadata Filtering in LanceDB","sidebarTitle":"Filtering","icon":"filter","href":"/search/filtering"},{"title":"Reranking Search Results","sidebarTitle":"Reranking","icon":"sort-amount-down","href":"/reranking/index"},{"title":"RTE reads","sidebarTitle":"RTE Read","icon":"magnifying-glass","href":"/search/realtime-read"},{"title":"Distributed RTE Read","sidebarTitle":"Distributed RTE Read","icon":"network-wired","href":"/enterprise/distributed-real-time-read"},{"title":"Distributed Search","sidebarTitle":"Distributed Search","icon":"network-wired","href":"/enterprise/distributed-search"},{"title":"Data Page Cache","sidebarTitle":"Data Page Cache","icon":"database","href":"/enterprise/data-page-cache"},{"title":"Tiered Index Cache","sidebarTitle":"Tiered Index Cache","icon":"layer-group","href":"/enterprise/tiered-index-cache"},{"title":"Cache Prewarm","sidebarTitle":"Cache Prewarm","icon":"fire","href":"/enterprise/cache-prewarm"}]},{"group":"Data Curation","pages":[{"title":"Data curation","sidebarTitle":"Overview","icon":"filter","href":"/curation/index"},{"title":"Inspect Datasets","sidebarTitle":"Inspect Datasets","icon":"database","href":"/curation/inspect-datasets"},{"title":"Create a Function","tag":"Early access","sidebarTitle":"Create Function","icon":"code","href":"/curation/create-function"},{"title":"Chunk records into multiple rows","sidebarTitle":"Chunking","icon":"diagram-subtask","href":"/curation/chunking"},{"title":"Statistical Sampling","sidebarTitle":"Statistical Sampling","icon":"dice","href":"/curation/statistical-sampling"},{"title":"Selective Sampling","sidebarTitle":"Selective Sampling","icon":"crosshairs","href":"/curation/selective-sampling"},{"title":"Profiling a dataset","sidebarTitle":"Aggregate","icon":"chart-column","href":"/curation/aggregate"},{"title":"Joining datasets","sidebarTitle":"Join","icon":"link","href":"/curation/join"},{"title":"Blob Late Materialization","sidebarTitle":"Blob Late Materialization","icon":"clock","href":"/curation/blob-late-materialization"},{"title":"Distributed Shuffle","sidebarTitle":"Distributed Shuffle","icon":"shuffle","href":"/curation/distributed-shuffle"},{"title":"Ranking","sidebarTitle":"Ranking","icon":"chart-simple","href":"/curation/windowing"},{"title":"Cluster records by index partition","sidebarTitle":"Clustering","icon":"circle-nodes","href":"/curation/clustering"},{"title":"Deduplicate near-duplicate records","sidebarTitle":"Dedupe","icon":"clone","href":"/curation/dedupe"},{"title":"Scope curation to what changed","sidebarTitle":"Changes","icon":"clock-rotate-left","href":"/curation/changes"},{"title":"Create a view","sidebarTitle":"Create View","icon":"eye","href":"/feature-engineering/view"},{"title":"Vend a Secret to a Function","tag":"Early access","sidebarTitle":"Vend Secret","icon":"key","href":"/curation/vend-secret"}]},{"group":"Feature Engineering","pages":[{"title":"Feature engineering","sidebarTitle":"Overview","icon":"layer-group","href":"/feature-engineering/index"},{"title":"Create a computed column","sidebarTitle":"Create Computed Column","icon":"table-columns","href":"/feature-engineering/add-computed-column"},{"title":"Refresh a computed column","sidebarTitle":"Refresh Computed Column","icon":"arrows-rotate","href":"/feature-engineering/refresh-column"},{"title":"Create a materialized view","sidebarTitle":"Create Materialized View","icon":"table","href":"/feature-engineering/materialized-views"},{"title":"Refresh a materialized view","sidebarTitle":"Refresh Materialized View","icon":"arrows-rotate","href":"/feature-engineering/refresh-materialized-view"},{"title":"Incremental Refresh","sidebarTitle":"Incremental Refresh","icon":"arrow-rotate-right","href":"/enterprise/incremental-refresh"},{"title":"Auto Refresh","sidebarTitle":"Auto Refresh","icon":"clock-rotate-left","href":"/enterprise/auto-refresh"},{"title":"Function Refresh Checkpointing","tag":"Early access","sidebarTitle":"Checkpointing","icon":"floppy-disk","href":"/enterprise/checkpointing"},{"title":"Adaptive Execution","tag":"Early access","sidebarTitle":"Adaptive Execution","icon":"gauge-high","href":"/enterprise/adaptive-execution"},{"group":"Geneva","icon":"layer-group","pages":[{"title":"Multimodal Feature Engineering with Geneva","sidebarTitle":"Overview","icon":"layer-group","href":"/geneva/index"},{"title":"What is Feature Engineering?","sidebarTitle":"What is feature engineering?","icon":"grip-horizontal","href":"/geneva/overview/index"},{"title":"Getting Started","sidebarTitle":"Getting Started","icon":"rocket","href":"/geneva/getting-started"},{"group":"Transforms","pages":[{"title":"Understanding Transforms","sidebarTitle":"Understanding Transforms","icon":"code-compare","href":"/geneva/udfs/index"},{"title":"User-Defined Functions (UDFs)","sidebarTitle":"UDFs","icon":"function","href":"/geneva/udfs/udfs"},{"title":"Chunkers (Scalar UDTFs)","sidebarTitle":"Chunkers","icon":"diagram-subtask","href":"/geneva/udfs/scalar-udtfs"},{"title":"Batch User-Defined Table Functions (UDTFs)","sidebarTitle":"Batch UDTFs","icon":"layer-group","href":"/geneva/udfs/batch-udtfs"},{"title":"Error Handling in Geneva UDFs","sidebarTitle":"Error Handling","icon":"exclamation","href":"/geneva/udfs/error_handling"},{"title":"Profiling Stateful UDF Memory","sidebarTitle":"Profiling Memory","icon":"chart-line","href":"/geneva/udfs/profiling-memory"},{"title":"Blob Types in Geneva UDFs","sidebarTitle":"Blobs","icon":"splotch","href":"/geneva/udfs/blobs"}]},{"group":"Built-in Transforms","pages":[{"title":"Built-in LLM and Embedding UDFs","sidebarTitle":"Overview","icon":"sparkles","href":"/geneva/udfs/providers/index"},{"title":"OpenAI","sidebarTitle":"OpenAI","icon":"brain","href":"/geneva/udfs/providers/openai"},{"title":"Gemini","sidebarTitle":"Gemini","icon":"google","href":"/geneva/udfs/providers/gemini"},{"title":"Sentence Transformers","sidebarTitle":"Sentence Transformers","icon":"microchip","href":"/geneva/udfs/providers/sentence-transformers"}]},{"group":"Running Jobs","pages":[{"title":"Geneva Jobs","sidebarTitle":"Job execution","href":"/geneva/jobs/index"},{"title":"Backfilling","sidebarTitle":"Backfilling","icon":"fill","href":"/geneva/jobs/backfilling"},{"title":"Bulk Loading \u0026 Updating Columns","sidebarTitle":"Bulk Load / Update Columns","icon":"columns-3","href":"/geneva/jobs/bulk-load-columns"},{"title":"Materialized Views with UDFs","sidebarTitle":"Materialized views","icon":"microscope","href":"/geneva/jobs/materialized-views"},{"title":"Advanced Job Configuration","sidebarTitle":"Advanced job configuration","icon":"sliders","href":"/geneva/jobs/advanced-job-configuration"},{"title":"Job Lifecycle","sidebarTitle":"Job Lifecycle","icon":"arrows-spin","href":"/geneva/jobs/lifecycle"},{"title":"Backfill Conflicts","sidebarTitle":"Backfill Conflicts","icon":"code-merge","href":"/geneva/jobs/conflicts"},{"title":"Distributed Job Performance and Cluster Sizing","sidebarTitle":"Performance and Sizing","icon":"chart-line","href":"/geneva/jobs/performance"},{"title":"Job Metrics (Diagnostics)","sidebarTitle":"Job Metrics","icon":"chart-simple","href":"/geneva/jobs/job_metrics"},{"title":"Geneva Console","sidebarTitle":"Console","icon":"computer","href":"/geneva/jobs/console"},{"title":"Troubleshooting Geneva Jobs","sidebarTitle":"Job troubleshooting","icon":"wrench","href":"/geneva/jobs/troubleshooting"},{"title":"Advanced Execution Contexts","sidebarTitle":"Advanced execution contexts","icon":"circle-nodes","href":"/geneva/jobs/contexts"}]},{"group":"Deployment","pages":[{"title":"Deploy Geneva using Helm","sidebarTitle":"Helm Deployment","icon":"cogs","href":"/geneva/deployment/helm"},{"title":"Job and Session Startup Optimizations","sidebarTitle":"Startup optimizations","icon":"engine","href":"/geneva/jobs/startup"},{"title":"Dependency Verification","sidebarTitle":"Dependency Verification","icon":"magnifying-glass-chart","href":"/geneva/deployment/dependency-verification"},{"title":"Advanced Configuration","sidebarTitle":"Advanced Configuration","icon":"flask-gear","href":"/geneva/udfs/advanced-configuration"},{"title":"Manual Deployment on Kubernetes","sidebarTitle":"Manual Deployment","icon":"cogs","href":"/geneva/deployment/index"},{"title":"Troubleshooting Geneva Deployments","sidebarTitle":"Deployment Troubleshooting","icon":"question-circle","href":"/geneva/deployment/troubleshooting"}]},{"title":"End-to-End Example","sidebarTitle":"End-to-end example","icon":"play","href":"/geneva/end-to-end"},{"title":"Geneva Python SDK","icon":"python","href":"/geneva/reference"}]}]},{"group":"Training","pages":[{"title":"PyTorch Data Loader","sidebarTitle":"PyTorch Data Loader","icon":"boxes-stacked","href":"/training/data-loading"},{"title":"Training Cache","sidebarTitle":"Training Cache","icon":"gauge-high","href":"/training/training-cache"},{"title":"Permutation","sidebarTitle":"Permutation","icon":"shuffle","href":"/training/permutation"},{"title":"Observability","sidebarTitle":"Observability","icon":"gauge","href":"/training/observability"},{"title":"Distributed Training","sidebarTitle":"Distributed Training","icon":"server","href":"/training/distributed-training"},{"title":"Checkpointing","sidebarTitle":"Checkpointing","icon":"floppy-disk","href":"/training/checkpointing"},{"title":"Resuming","sidebarTitle":"Resuming","icon":"rotate-left","href":"/training/resuming"}]},{"group":"Management","pages":[{"title":"Management","sidebarTitle":"Overview","icon":"folder-tree","href":"/management/index"},{"title":"Catalog","sidebarTitle":"Catalog","icon":"sitemap","href":"/management/catalog"},{"title":"Database","sidebarTitle":"Database","icon":"database","href":"/management/database"},{"title":"Namespaces","sidebarTitle":"Namespace","icon":"folder-tree","href":"/management/namespace"},{"title":"Tables","sidebarTitle":"Table","icon":"table","href":"/management/table"},{"title":"Views","sidebarTitle":"View","icon":"eye","href":"/management/view"},{"title":"Materialized view","sidebarTitle":"Materialized View","icon":"table","href":"/management/materialized-view"},{"title":"Secret","tag":"Early access","sidebarTitle":"Secret","icon":"key","href":"/management/secret"},{"title":"Functions","tag":"Early access","sidebarTitle":"Function","icon":"code","href":"/management/function"},{"title":"Storage Integration","sidebarTitle":"Storage Integration","icon":"cloud","href":"/management/storage-integration"}]},{"group":"Maintenance","pages":[{"title":"Indexing Data","sidebarTitle":"Overview","icon":"list","href":"/indexing/index"},{"title":"Intelligent Auto-Maintenance","sidebarTitle":"Intelligent Auto-Maintenance","icon":"brain","href":"/enterprise/intelligent-auto-maintenance"},{"title":"Vector Indexing","sidebarTitle":"Vector Indexing","icon":"arrow-up-right-dots","href":"/indexing/vector-index"},{"title":"Full-Text Search (FTS) Indexing","sidebarTitle":"FTS Indexing","icon":"book","href":"/indexing/fts-index"},{"title":"Scalar Indexing","sidebarTitle":"Scalar Indexing","icon":"tree","href":"/indexing/scalar-index"},{"title":"Incremental Indexing","sidebarTitle":"Incremental Indexing","icon":"refresh","href":"/indexing/incremental-indexing"},{"title":"Distributed Indexing","sidebarTitle":"Distributed Indexing","icon":"layer-group","href":"/enterprise/distributed-indexing"},{"title":"GPU Indexing","sidebarTitle":"GPU Indexing","icon":"microchip","href":"/indexing/gpu-indexing"},{"title":"Compaction and cleanup","sidebarTitle":"Compaction","icon":"broom","href":"/maintenance/compaction"},{"title":"Real Time Engine compaction","sidebarTitle":"RTE Compaction","icon":"compress","href":"/enterprise/realtime-engine-compaction"},{"title":"Distributed Compaction","sidebarTitle":"Distributed Compaction","icon":"compress","href":"/enterprise/distributed-compaction"},{"title":"Advanced Conflict Resolution","sidebarTitle":"Advanced Conflict Resolution","icon":"shuffle","href":"/enterprise/advanced-conflict-resolution"},{"title":"Garbage Collection","sidebarTitle":"Garbage Collection","icon":"broom","href":"/maintenance/cleanup"}]},{"group":"Security","pages":[{"title":"Authentication","sidebarTitle":"Authentication","icon":"key","href":"/enterprise/authentication"},{"title":"Authorization","sidebarTitle":"Authorization","icon":"shield-halved","href":"/governance/authorization"},{"title":"Principals","sidebarTitle":"Principals","icon":"user","href":"/governance/principals"},{"title":"Privileges","sidebarTitle":"Privileges","icon":"key","href":"/governance/privileges"},{"title":"Audit Log","sidebarTitle":"Audit Log","icon":"clipboard-list","href":"/governance/audit-log"},{"title":"Compliance","sidebarTitle":"Compliance","icon":"shield-alt","href":"/enterprise/security"}]},{"group":"Deployment","pages":[{"title":"Horizontal Scaling","sidebarTitle":"Horizontal Scaling","icon":"arrows-left-right","href":"/enterprise/horizontal-scaling"},{"title":"Monitor LanceDB with OpenTelemetry","sidebarTitle":"OpenTelemetry","icon":"chart-line","href":"/deployment/opentelemetry"},{"title":"Kubernetes deployment guide","sidebarTitle":"Kubernetes","icon":"cloud","href":"/enterprise/deployment/kubernetes"},{"title":"Multicloud","sidebarTitle":"Multicloud","icon":"cloud","href":"/deployment/multicloud"},{"title":"Slurm","sidebarTitle":"Slurm","icon":"server","href":"/deployment/slurm"}]},{"group":"SQL Reference","pages":[{"title":"SQL reference","sidebarTitle":"Overview","icon":"table-list","href":"/sql/index"},{"title":"SQL data types","sidebarTitle":"Data Types","icon":"shapes","href":"/sql/data-types"},{"group":"DDL","icon":"sitemap","pages":[{"title":"Database","sidebarTitle":"Database","icon":"database","href":"/sql/ddl/database"},{"title":"Namespace","sidebarTitle":"Namespace","icon":"folder-tree","href":"/sql/ddl/namespace"},{"title":"Table","sidebarTitle":"Table","icon":"table","href":"/sql/ddl/table"},{"title":"View","sidebarTitle":"View","icon":"eye","href":"/sql/ddl/view"},{"title":"Materialized View","sidebarTitle":"Materialized View","icon":"table","href":"/sql/ddl/materialized-view"},{"title":"Secret","tag":"Early access","sidebarTitle":"Secret","icon":"key","href":"/sql/ddl/secret"},{"title":"Function","tag":"Early access","sidebarTitle":"Function","icon":"function","href":"/sql/ddl/function"},{"title":"Storage Integration","sidebarTitle":"Storage Integration","icon":"cloud","href":"/sql/ddl/storage-integration"},{"title":"Index","sidebarTitle":"Index","icon":"bolt","href":"/sql/ddl/index"},{"title":"Job","sidebarTitle":"Job","icon":"hourglass-half","href":"/sql/ddl/job"},{"title":"Grant","sidebarTitle":"Grant","icon":"user-lock","href":"/sql/ddl/grant"}]},{"group":"DML","icon":"database","pages":[{"title":"Insert","sidebarTitle":"Insert","icon":"plus","href":"/sql/dml/insert"},{"title":"Update","sidebarTitle":"Update","icon":"pen","href":"/sql/dml/update"},{"title":"Delete","sidebarTitle":"Delete","icon":"trash","href":"/sql/dml/delete"},{"title":"Copy","sidebarTitle":"Copy","icon":"file-export","href":"/sql/dml/copy"},{"title":"REFRESH COLUMN","sidebarTitle":"REFRESH COLUMN","icon":"arrows-rotate","href":"/sql/dml/refresh-column"},{"title":"REFRESH MATERIALIZED VIEW","sidebarTitle":"REFRESH MATERIALIZED VIEW","icon":"arrows-rotate","href":"/sql/dml/refresh-materialized-view"},{"title":"REFRESH","sidebarTitle":"REFRESH","icon":"arrows-rotate","href":"/sql/dml/refresh"}]},{"group":"DQL","icon":"filter","pages":[{"title":"SELECT","sidebarTitle":"SELECT","icon":"table-columns","href":"/sql/dql/select"},{"title":"Subqueries","sidebarTitle":"Subqueries","icon":"code-branch","href":"/sql/dql/subqueries"},{"title":"Joins","sidebarTitle":"Joins","icon":"link","href":"/sql/dql/join"},{"title":"Operators and literals","sidebarTitle":"Operators","icon":"plus-minus","href":"/sql/dql/operators"},{"title":"Functions","sidebarTitle":"Functions","icon":"function","href":"/sql/dql/functions"},{"title":"Scalar functions","sidebarTitle":"Scalar Functions","icon":"calculator","href":"/sql/dql/scalar-functions"},{"title":"Aggregation","sidebarTitle":"Aggregation","icon":"layer-group","href":"/sql/dql/aggregation"},{"title":"Window functions","sidebarTitle":"Window Functions","description":"Compute over a set of rows related to the current one, without collapsing them.","icon":"chart-simple","href":"/sql/dql/window"},{"title":"Random sampling","sidebarTitle":"Sampling","icon":"dice","href":"/sql/dql/sampling"},{"title":"Changes since a version","sidebarTitle":"Changes","description":"CHANGES: read the rows appended to a table since an earlier version.","icon":"clock-rotate-left","href":"/sql/dql/changes"},{"title":"Full-Text Search","sidebarTitle":"Full-Text Search","icon":"magnifying-glass","href":"/sql/dql/fts"},{"title":"CONTAINS_TOKENS","sidebarTitle":"CONTAINS_TOKENS","icon":"magnifying-glass","href":"/sql/dql/contains-tokens"},{"title":"IVF_PARTITION","sidebarTitle":"IVF_PARTITION","icon":"circle-nodes","href":"/sql/dql/ivf-partition"},{"title":"DEDUPE","sidebarTitle":"DEDUPE","icon":"layer-group","href":"/sql/dql/dedupe"},{"title":"DUPLICATE_PAIRS","sidebarTitle":"DUPLICATE_PAIRS","icon":"clone","href":"/sql/dql/duplicate-pairs"},{"title":"MinHash SQL functions","href":"/enterprise/sql-minhash"},{"title":"Vector distance functions","sidebarTitle":"Vector Distance","icon":"ruler","href":"/sql/dql/vector-distance"},{"title":"BLOB_DESCRIPTOR","sidebarTitle":"BLOB_DESCRIPTOR","icon":"file-binary","href":"/sql/dql/blob-descriptor"},{"title":"GENERATE_SERIES","sidebarTitle":"GENERATE_SERIES","icon":"list-ol","href":"/sql/dql/generate-series"},{"title":"Explain","sidebarTitle":"Explain","icon":"map","href":"/sql/dql/explain"}]}]}]},{"tab":"Integrations","pages":[{"title":"Integrations","href":"/integrations"}]},{"tab":"Tutorials","pages":[{"title":"Tutorials","href":"/tutorials"}]},{"tab":"Demos","pages":[{"title":"Demos","href":"/demos"}]},{"tab":"Datasets","pages":[{"title":"Datasets","href":"/datasets"}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api-reference/rest"}]}]},"basePath":"","title":"Random sampling - LanceDB","buildId":"dpl_9VVk5y1P8k1ATeJguVngy9Q3cmbD","deploymentId":"dpl_9VVk5y1P8k1ATeJguVngy9Q3cmbD","dynamics":["10e4515597"],"chunks":["BannerMarkdown-DicSZcaX.js","dist-CIQkMg3R.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","clsx-ClVdStUn.js","html-void-elements-mCSPHezU.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js"]}