Why is my mean much more bigger than my Execution Time using hyperfine to benchmark my query performance?

                                           QUERY PLAN                                                                                        

GroupAggregate (cost=21267.11..21286.98 rows=461 width=31) (actual time=1.711..1.712 rows=1 loops=1)
Group Key: (date_trunc(‘month’::text, timezone(‘Europe/Berlin’::text, m.”timestamp”))), d.sub_type
-> Sort (cost=21267.11..21268.91 rows=719 width=35) (actual time=1.564..1.591 rows=719 loops=1)
Sort Key: (date_trunc(‘month’::text, timezone(‘Europe/Berlin’::text, m.”timestamp”))), d.sub_type
Sort Method: quicksort Memory: 69kB
-> Nested Loop (cost=70.03..21233.00 rows=719 width=35) (actual time=0.483..1.454 rows=719 loops=1)
-> Index Scan using idx_devices_id on devices d (cost=0.28..8.30 rows=1 width=27) (actual time=0.017..0.018 rows=1 loops=1)
Index Cond: (id = ‘c28ace1e-cf28-4d2f-a7d3-9bc8631cd379’::uuid)
-> Bitmap Heap Scan on measurements m (cost=69.75..21213.91 rows=719 width=32) (actual time=0.240..0.994 rows=719 loops=1)
Recheck Cond: (device_id = ‘c28ace1e-cf28-4d2f-a7d3-9bc8631cd379’::uuid)
Filter: ((“timestamp” >= ‘2024-01-01 11:00:00+00’::timestamp with time zone) AND (“timestamp” < ‘2024-01-31 11:00:00+00’::timestamp with time zone) AND (type = 4))
Rows Removed by Filter: 5241
Heap Blocks: exact=50
-> Bitmap Index Scan on idx_measurements_device_id (cost=0.00..69.57 rows=6018 width=0) (actual time=0.224..0.224 rows=5960 loops=1)
Index Cond: (device_id = ‘c28ace1e-cf28-4d2f-a7d3-9bc8631cd379’::uuid)
Planning Time: 0.697 ms
Execution Time: 1.766 ms
(17 rows)

                                          QUERY PLAN                                                                                        

GroupAggregate (cost=21267.11..21286.98 rows=461 width=31) (actual time=0.897..0.898 rows=1 loops=1)
Group Key: (date_trunc(‘month’::text, timezone(‘Europe/Berlin’::text, m.”timestamp”))), d.sub_type
-> Sort (cost=21267.11..21268.91 rows=719 width=35) (actual time=0.795..0.831 rows=719 loops=1)
Sort Key: (date_trunc(‘month’::text, timezone(‘Europe/Berlin’::text, m.”timestamp”))), d.sub_type
Sort Method: quicksort Memory: 69kB
-> Nested Loop (cost=70.03..21233.00 rows=719 width=35) (actual time=0.178..0.718 rows=719 loops=1)
-> Index Scan using idx_devices_id on devices d (cost=0.28..8.30 rows=1 width=27) (actual time=0.004..0.005 rows=1 loops=1)
Index Cond: (id = ‘c28ace1e-cf28-4d2f-a7d3-9bc8631cd379’::uuid)
-> Bitmap Heap Scan on measurements m (cost=69.75..21213.91 rows=719 width=32) (actual time=0.081..0.457 rows=719 loops=1)
Recheck Cond: (device_id = ‘c28ace1e-cf28-4d2f-a7d3-9bc8631cd379’::uuid)
Filter: ((“timestamp” >= ‘2024-01-01 11:00:00+00’::timestamp with time zone) AND (“timestamp” < ‘2024-01-31 11:00:00+00’::timestamp with time zone) AND (type = 4))
Rows Removed by Filter: 5241
Heap Blocks: exact=50
-> Bitmap Index Scan on idx_measurements_device_id (cost=0.00..69.57 rows=6018 width=0) (actual time=0.073..0.073 rows=5960 loops=1)
Index Cond: (device_id = ‘c28ace1e-cf28-4d2f-a7d3-9bc8631cd379’::uuid)
Planning Time: 0.336 ms
Execution Time: 0.929 ms
(17 rows)

                                          QUERY PLAN                                                                                        

GroupAggregate (cost=21267.11..21286.98 rows=461 width=31) (actual time=0.873..0.873 rows=1 loops=1)
Group Key: (date_trunc(‘month’::text, timezone(‘Europe/Berlin’::text, m.”timestamp”))), d.sub_type
-> Sort (cost=21267.11..21268.91 rows=719 width=35) (actual time=0.794..0.813 rows=719 loops=1)
Sort Key: (date_trunc(‘month’::text, timezone(‘Europe/Berlin’::text, m.”timestamp”))), d.sub_type
Sort Method: quicksort Memory: 69kB
-> Nested Loop (cost=70.03..21233.00 rows=719 width=35) (actual time=0.168..0.717 rows=719 loops=1)
-> Index Scan using idx_devices_id on devices d (cost=0.28..8.30 rows=1 width=27) (actual time=0.004..0.004 rows=1 loops=1)
Index Cond: (id = ‘c28ace1e-cf28-4d2f-a7d3-9bc8631cd379’::uuid)
-> Bitmap Heap Scan on measurements m (cost=69.75..21213.91 rows=719 width=32) (actual time=0.071..0.457 rows=719 loops=1)
Recheck Cond: (device_id = ‘c28ace1e-cf28-4d2f-a7d3-9bc8631cd379’::uuid)
Filter: ((“timestamp” >= ‘2024-01-01 11:00:00+00’::timestamp with time zone) AND (“timestamp” < ‘2024-01-31 11:00:00+00’::timestamp with time zone) AND (type = 4))
Rows Removed by Filter: 5241
Heap Blocks: exact=50
-> Bitmap Index Scan on idx_measurements_device_id (cost=0.00..69.57 rows=6018 width=0) (actual time=0.063..0.063 rows=5960 loops=1)
Index Cond: (device_id = ‘c28ace1e-cf28-4d2f-a7d3-9bc8631cd379’::uuid)
Planning Time: 0.304 ms
Execution Time: 0.903 ms
(17 rows)

—————————————————————————————————————

Time (mean ± σ): 98.1 ms ± 28.1 ms [User: 30.7 ms, System: 11.1 ms]Range (min … max): 75.6 ms … 129.5 ms 3 runs

—————————————————————————————————————

I’m using hyperfine to benchmark the performance of my query in PostgreSQL. I used --runs 3 option to run it three times. As you can see, the execution time for all the three times I’m running the query takes 1.766, 0.929 and 0.903 ms respectively. My question is, why is the mean = 98,1 ms? What does this mean represent? Because it does not make any sense that the execution time is between 0,9 ms – 1,7 ms, while the mean of them is 98.1 ms. I tested to execute this same query in Postico and it took 0.903 ms. Im just curious what the mean represent if it does not represent the execution average time.

New contributor

Nuh Jama is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật