Back

Explore Courses Blog Tutorials Interview Questions
0 votes
5 views
in SQL by (20.3k points)

I want to compare the time of execution Post.all and SELECT * FROM posts (or some other statements) How can I get the execution time of Post .all?

1 Answer

0 votes
by (40.7k points)

Try using the code given below:

timing = Benchmark.measure { Post.all }

The various attributes of the object returned (Benchmark::Tms) are mentioned here:

https://ruby-doc.org/stdlib-2.0.0/libdoc/benchmark/rdoc/Benchmark/Tms.html

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jul 9, 2019 in SQL by Tech4ever (20.3k points)

Browse Categories

...