Giter Site home page Giter Site logo

Comments (4)

avhz avatar avhz commented on September 28, 2024 1

Thanks for the comment @eitsupi :) Yes it's the same query, getting the full table.

from polars.

eitsupi avatar eitsupi commented on September 28, 2024

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.

alexander-beedie avatar alexander-beedie commented on September 28, 2024

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.

avhz avatar avhz commented on September 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.