Issue
I try to measure query speed in my jupyter notbook
%time
a10= pd.read_sql('SELECT t.id, t.order_id FROM transactions.t', con=db_connection)
Whatever my query is the output always
Wall time: 0 ns
I assume %time
is not related with previous cell, this cell requires more than 10s to execute, why Wall time: 0 ns
?
Solution
Have a look at the introduction to IPython's magics; this is a IPython feature, not a Jupyter one.
There is a significant difference between a magic with One leading percent sign and a magic with Two leading percent signs. The first one applies only to the rest of the line it is on – in your case literally nothing —while the latter applies to the rest of the cell.
So you likely want to add a percent in front of your code.
You also most likely want to have a look at %timeit/%%timeit
which differs from %time
.
Answered By - Matt
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.