0 votes
1 view
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.4k 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
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...