Intellipaat 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
+12 votes
5 answers
asked May 26, 2019 in Java by tara92 (920 points)

1.2k questions

2.7k answers

501 comments

693 users

Browse Categories

...