Massive pruning of database queries

This list will change and grow by the time we release our version of Kliqqi 3 to you, but we wanted to share with you our progress of slimming down the bloated duplicate, redundant, and unnecessary database queries that were packed inside of Pligg over the years. Kliqqi will utilize less sever resources than Pligg, load faster, and require less overhead.

 

File Removed Queries Count
/admin/admin_backup.php Get kliqqi_version 1
admin/admin_categories.php Get kliqqi_version 1
admin/admin_comments.php Get kliqqi_version 1
admin/admin_config.php Get kliqqi_version 2
admin/admin_delete_comments.php In delete_comment function 3 times the number of comments to delete
admin/admin_editor.php Get kliqqi_version 1
admin/admin_group.php Get kliqqi_version 1
admin/admin_index.php Query table_widgets 1
Query to get total members. Called twice from this file and the sidebar stats module 1 Replaced with only 1 query in smartyvariables. and now we get all statuses: admin, modrator, normal, disabled, spammer
Query the groups total; called twice from this file and the statistics widget 1 Replaced with only 1 query in smartyvariables. and now we get all statuses: enabled, disabled
Query to get total published stories. Called twice from this file and the sidebar stats module 1 replaced with only 1 query and now we get all statuses: ‘discard’,’new’,’published’,’abuse’,’duplicate’,’page’,’spam’,’moderated’
Query to get total new stories. Called twice from this file and the sidebar stats module 1
Query to get total comments. Called twice from this file and the sidebar stats module 1 Replaced with only 1 query in smartyvariables. and now we get all statuses: published, moderated, discarded, spam
Obsolete query to get the link_date ago 1
Obsolete query to get the comment_date ago 1
query to get all votes count 1 Replaced with only 1 query in smartyvariables. and now we get all votes by: Story upvoted/downvoted and comments upvoted/downvoted
Query to get the last user 1
Get kliqqi_version 1
admin_links.php Get kliqqi_version 1
admin_modules.php Get kliqqi_version 1
admin_page.php Get kliqqi_version 1
admin_update_module_widgets.php Get kliqqi_version 1
admin_users.php Get kliqqi_version 1
admin_widgets.php Get kliqqi_version 1
domain_management.php Get kliqqi_version 1
edit_page.php Get kliqqi_version 1
submit_page.php Get kliqqi_version 1
comment.php Save a comment store() query by adding anif statement so that if the comment was flagged as spam by the spam trigger module, we don’t have to worry about recalc commetns 1
smartyvariables.php removed 3 queries to get the new, published and moderated stories 3 replaced with only 1 query and now we get all statuses: ‘discard’,’new’,’published’,’abuse’,’duplicate’,’page’,’spam’,’moderated’
removed moderated comments count 1 Replaced with only 1 query in smartyvariables. and now we get all statuses: published, moderated, discarded, spam
removed moderated users count 1 Replaced with only 1 query in smartyvariables. and now we get all statuses: admin, modrator, normal, disabled, spammer
/libs/user.php removed query to select the spammer votes 1 Created 1 UNION query to get both. Note that in the query to get the comments, there was another query to update the comment status to spam. That’s really way too much strain on the server if the spammer had tens of comments. In addition, we don’t really need the spammers comments. So I deleted the query from inside the iteration and created one to delete all the spammers comments outside the iteration.

Same thing for the votes, removed the delete vote query from inside the iteraation to outside.

removed query to select the spammer comments 1
/modules/sidebar_stats/sidebar_stats_settings.php removed all queries in it which are redundant and pulled all the varibales from the smartyvariables 12
/widgets/spam_trigger/init.php Get the moderated links to display in the widget 1
Get the moderated comments to display in the widget 1
/widgets/spam_trigger/templates/widget.tpl Get the moderated links to display in the widget 1
Get the moderated comments to display in the widget 1
/widgets/statistics/init.php removed all 12 unused queries to get_misc_data 12
removed all 12 unused queries to misc_data_update 12
Total removed queries 78 NOTE: not counting the queries that I removed from inside iterations to outside and that may amount to N number depending on how many links, comments, votes the spammer has.

Leave a Reply