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

getCustomersOnline(): fix SQL clauses to be able to use index #2

Merged
merged 1 commit into from Dec 13, 2018

Conversation

Projects
None yet
2 participants
@Kioob
Copy link

Kioob commented Aug 18, 2016

Just a small patch to fix some SQL perfs problems on dashboard.

@eternoendless eternoendless changed the title getCustomersOnline(): fix SQL clauses to be able to use … getCustomersOnline(): fix SQL clauses to be able to use index Dec 13, 2018

@eternoendless

This comment has been minimized.

Copy link
Member

eternoendless commented Dec 13, 2018

Thank you @Kioob

@eternoendless eternoendless merged commit 737c002 into PrestaShop:dev Dec 13, 2018

@@ -72,7 +72,7 @@ private function getCustomersOnline()
INNER JOIN `'._DB_PREFIX_.'customer` u ON u.id_customer = g.id_customer
WHERE cp.`time_end` IS NULL
'.Shop::addSqlRestriction(false, 'c').'
AND TIME_TO_SEC(TIMEDIFF(\''.pSQL(date('Y-m-d H:i:00', time())).'\', cp.`time_start`)) < 900
AND `cp.time_start` > NOW() - interval 900 second

This comment has been minimized.

@eternoendless

eternoendless Dec 13, 2018

Member

Just for history's sake, there's a small SQL error with backticks on both modified lines.

This will be fixed shortly in a follow-up PR

This comment has been minimized.

@eternoendless
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment