Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up download statistics #274

Merged
merged 1 commit into from
Sep 19, 2024

Conversation

guusdk
Copy link
Member

@guusdk guusdk commented Sep 19, 2024

Hardcodes the download statistics for all projects prior to 2024-09-18 00:00:00. The database query will now only count all downloads since that timestamp.

This saves ~30 seconds on some page loads, as we're asking the database to count 32 million records less.

Hardcodes the download statistics for all projects prior to 2024-09-18 00:00:00. The database query will now only count all downloads since that timestamp.

This saves ~30 seconds on some page loads, as we're asking the database to count 32 million records less.
@@ -40,7 +40,7 @@ public class DownloadStats extends HttpServlet {
private static final String ADD_UPDATE_INFO = "insert into checkUpdateInfo (ipAddress, os, type, time, country, region, city, currentVersion, latestVersion) values (INET_ATON(?),?,?,NOW(),?,?,?,?,?)";

// SQL for counting the total number of downloads by type.
private static String COUNT_TOTAL_DOWNLOADS_BY_TYPE = "SELECT type, count(type) FROM downloadInfo GROUP BY type";
private static String COUNT_TOTAL_DOWNLOADS_BY_TYPE_SINCE = "SELECT type, count(type) FROM downloadInfo WHERE time > '2024-09-18 00:00:00' GROUP BY type;";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meh on the semi-colon

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ignored by the driver, but I'll remove it :)

@guusdk guusdk merged commit 839c608 into igniterealtime:main Sep 19, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants