Comments (4)
Thanks for the comment @eitsupi :) Yes it's the same query, getting the full table.
from polars.
Is it the exact same query being run against the DB between R and Python?
Since dbplyr
converts dplyr
queries to SQL and executes them on the DB, it is likely to be faster than something like SELECT * FROM foo
, which transfers all data locally.
from polars.
I don't see anything Polars-specific there? It seems that all you're observing is that different Oracle drivers have different performance 🤔
There may be ways to optimise your connection/driver settings though, but our only overhead vs executing the query natively on the given connection comes from the final "and then load the results into a DataFrame" step (if not using an Arrow-aware driver).
from polars.
Hi @alexander-beedie :)
I realized this after creating my issue, so tried the following:
start = time.time()
cursor = self._connection_oracle.cursor()
cursor.execute(f"SELECT * FROM {table_name}")
data = cursor.fetchall()
print(f"Got data in {time.time() - start} (seconds)")
start = time.time()
names = [desc[0] for desc in cursor.description]
table = polars.DataFrame(data, schema=names, infer_schema_length=None, orient="row")
print(f"Created DataFrame in {time.time() - start} (seconds)")
The resulting times were:
- Fetching data: 9.76s
DataFrame
creation: 9.98s
So fetching the data itself is relatively quick, albeit in list[tuple]
form, then creating a DataFrame
takes roughly the same time.
I have not timed the ROracle
method in a similar fashion (the package does not provide the same interface, and is more an extension of DBI
from what I can tell). But since both oracledb
and ROracle
use the same Oracle client library under the hood, I expect the data fetch time to be very similar between the two.
So my assumption is that the creation of the DataFrame
itself is the bottleneck.
from polars.
Related Issues (20)
- Explain that the trig returns and arguments are all in radians
- Support serializing to json in a format similar to pandas "split" orientation
- Use of `sorting_columns` parquet metadata
- SQL query with WHERE clause that evaluates to true/false gives ShapeError on DataFrame with null columns
- `.struct.field` + `.filter` PanicException instead of ColumnNotFoundError
- `reshape` in group_by context PanicException
- docs: to_datetime: document that %Y zero-pads years HOT 2
- Python - Add support to the invert operator `~` to negate expressions and columns HOT 2
- `.arr.to_struct` PanicException for non-Array column
- list.set_intersection operates on the wrong columns when multiple columns are selected with pl.col HOT 1
- Parse large floats in CSVs that have periods as the thousands separator
- Parsing to `Decimal` ignores `decimal_comma` when reading from csv
- Issue when header dtype differ from the rest of the rows' dtype HOT 2
- from_any_values_and_dtype converts AnyValue::Struct to null
- Reading from S3 compatible storage HOT 1
- pl.datetime does not respect leftmost-argument naming rule HOT 1
- loading pickled `pl.Series` of `dtype=pl.Array(pl.Enum(...), ...)` fails
- `read_csv` PanicException when `pl.Decimal` used in schema with invalid precision
- `rows_by_key` works with pl.Array
- Categorical revmaps are not merged when concatenated inside a struct
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from polars.