-
-
Save chucai/28d11cd89bc30fffcfec1791fcad4353 to your computer and use it in GitHub Desktop.
Hacker News 排名算法的MYSQL函数实现
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- (p - 1) / (t + 2)^1.5 | |
CREATE FUNCTION SP_POINTS(P SMALLINT(5), CREATED TIMESTAMP) | |
RETURNS TINYINT(3) | |
RETURN (P - 1) / POW(TIMESTAMPDIFF(HOUR, CREATED, NOW()) + 2, 1.5); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment