Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Old 01-18-2005, 07:43 PM   PM User | #1
marek_mar
Sensei


 
Join Date: Aug 2003
Location: One step ahead of you.
Posts: 2,815
Thanks: 0
Thanked 3 Times in 3 Posts
marek_mar is on a distinguished road
Aggregate functions

Are aggregate functions fast when used with large sets of rows?
marek_mar is offline   Reply With Quote
Old 01-18-2005, 11:05 PM   PM User | #2
raf
Master Coder


 
Join Date: Jul 2002
Posts: 6,589
Thanks: 0
Thanked 0 Times in 0 Posts
raf is on a distinguished road
depends ...
some agregationfunctions (like count()) are optimised to return very fast. if the columns you aply an agregationfunction on, are indexed, then functions like min() and max() will also be real fast.
but you usually use agregationfunctios because they are the most efficient way to agregate the data and have MySQL do the filtering and computing, so that you only need to return a very small recordset.
Using agregationfunctions will allways be more efficient then returning large recordsets, and then do the filtering and computations in your aplicationlayer (PHP or whatever).
__________________
Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html
raf is offline   Reply With Quote
Old 01-19-2005, 08:57 PM   PM User | #3
marek_mar
Sensei


 
Join Date: Aug 2003
Location: One step ahead of you.
Posts: 2,815
Thanks: 0
Thanked 3 Times in 3 Posts
marek_mar is on a distinguished road
Thank you raf!
marek_mar is offline   Reply With Quote
Old 01-19-2005, 09:09 PM   PM User | #4
raf
Master Coder


 
Join Date: Jul 2002
Posts: 6,589
Thanks: 0
Thanked 0 Times in 0 Posts
raf is on a distinguished road
you're welcome
Hope you'll enjoy using them!
__________________
Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html
raf is offline   Reply With Quote
Old 01-19-2005, 09:48 PM   PM User | #5
marek_mar
Sensei


 
Join Date: Aug 2003
Location: One step ahead of you.
Posts: 2,815
Thanks: 0
Thanked 3 Times in 3 Posts
marek_mar is on a distinguished road
NMow I figured it is the only sane way to do it. Indexing reduced the execution time of my test query from +0.03 to 0.003!
marek_mar is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:43 PM.

Home - Contact Us - Archives - Link to CF - Resources - Top 

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.