We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b9211db commit c40f4e8Copy full SHA for c40f4e8
README.md
@@ -1,2 +1,14 @@
1
# mysql-percentile
2
-user-defined function to calculate percentiles in a MySQL query
+user-defined aggregate function to calculate percentiles in a MySQL query, similar to min/max/avg.
3
+
4
+Compile with:
5
+gcc -fPIC -Wall -I /usr/include/mysql51/mysql/ -shared -o udf_percentile.so udf_percentile.cc
6
7
+Copy to the plugin directory of MySQL (SHOW VARIABLES LIKE 'plugin_dir')
8
+cp udf_percentile.so /usr/lib64/mysql/plugin
9
10
+Register the function:
11
+CREATE AGGREGATE FUNCTION percentile RETURNS REAL SONAME 'udf_percentile.so'
12
13
+Use the function:
14
+SELECT percentile(loadTime, 99) FROM user_data GROUP BY WEEK(`timestamp`)
0 commit comments