[MDEV-4835] Add Median Function Created: 2013-08-01 Updated: 2017-12-18 Resolved: 2017-12-18 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer - Window functions |
| Fix Version/s: | 10.3.3 |
| Type: | Task | Priority: | Major |
| Reporter: | Ben Hiles (Inactive) | Assignee: | Varun Gupta (Inactive) |
| Resolution: | Fixed | Votes: | 3 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Description |
|
When analyzing skewed data, median can be a better measure than mean. Currently this can be implemented with a User Defined Function (e.g. http://www.mooreds.com/wordpress/archives/376), however this requires more overhead when upgrading and deploying database. This can also be handled with a query (e.g. http://stackoverflow.com/questions/1291152/simple-way-to-calculate-median-with-mysql), however that has a performance hit. Would adding a new aggregate function be possible? |
| Comments |
| Comment by Sergei Golubchik [ 2013-08-08 ] |
|
Yes, possible. But it's unlikely that we will have resources to do that anytime soon. On the other hand, we'd be happy to apply a patch that implements this function, if someone would provide it to us. |
| Comment by roberto spadim [ 2014-08-03 ] |
|
There's many aleeady implemented udf functions, for example |
| Comment by roberto spadim [ 2015-05-16 ] |
|
there's more functions here, very interesting: |
| Comment by Ján Regeš [ 2015-09-25 ] |
|
Hi, we use UDF function "MEDIAN" from https://github.com/megastep/mysql-udf in our projects and it works well! I think, that it could be a built-in part of MariaDB |
| Comment by Sergei Golubchik [ 2015-11-11 ] |
|
When we'll be implementing it, it should probably be not MEDIAN(), but a more generic PERCENTILE(). |
| Comment by Dipti Joshi (Inactive) [ 2017-06-06 ] |
|
This is duplicate of |
| Comment by Marc [ 2017-12-18 ] |
|
@Sergei: why would you want to name it "PERCENTILE". Everybody know the mathematic function name median, so everybody will search it by that name. |
| Comment by Sergei Golubchik [ 2017-12-18 ] |
|
Done. Both PERCENTILE and MEDIAN. See |
| Comment by Ján Regeš [ 2017-12-18 ] |
|
Thank you Sergei! It's like a Christmas present |