1

I use RPostgresql to connect to a local Postgres DB. Usually we send the query as a string using dbGetQuery. Is there any way to print the execution time of the query ?

In postgres \timing prints the query execution time for all the queries. Is there anyway to get the execution timings in R/RPostgresql

psteelk
  • 1,305
  • 3
  • 16
  • 24

1 Answers1

0

In psql \timing just checks the system time before and after the query. I think this is not a libpq function. It is just general matter of system math (note I haven't double checked the source here but this is what I think first and I am not familiar with any timing functionality in libpq).

Since we are not talking about libpq functionality, then you need to look at the way you would go about doing timing checks otherwise. As Roman put it, use system.time to get the info and calculate the timing yourself.

Chris Travers
  • 25,424
  • 6
  • 65
  • 182