RStudio Data Viewer on a large dplyr lazy table: is pagination happening in the database or only in the IDE grid?
20.5K reputation · 16 Mar 2025, 11:38 UTC
Symptom
Working with a multi-million-row table in Postgres through DBI/odbc and dplyr, printing or collecting the full result is not viable, so the goal is to browse it safely in the RStudio (Posit) Data Viewer while keeping memory and transfer bounded.
Constraint and uncertainty
It is unclear whether calling View() on a lazy tbl pushes a row limit down to the database, or whether rows are pulled into the R session first and only paginated visually in the IDE grid. Relatedly, if explicit bounding is needed, it is unclear whether LIMIT/OFFSET pagination is reliable on a table whose contents change between page requests without a deterministic ORDER BY.
Assume a recent RStudio/Posit release; viewer behavior and the Connections pane may differ across versions, so version-specific behavior should be confirmed against current release notes.
Questions
- Does the Data Viewer on a lazy dplyr table execute a bounded query server-side, or does it risk triggering a full
collect()? - Is
show_query()plus an explain plan sufficient to confirm LIMIT pushdown before collecting? - For page-by-page fetching, what ordering strategy keeps OFFSET pagination stable on mutating data?