From 5755ab800f18997b2c367cf3f1efcde7be261ae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20R=C3=BCegg?= Date: Thu, 12 Feb 2015 21:36:19 +0100 Subject: [PATCH] speed optimization as count(`fieldname`) does check for NULL values (as they will be excluded) it is faster to use count(*) as the date will never be NULL anyway (NULLs are not allowed at all :smile: ) --- db/smsmapper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/smsmapper.php b/db/smsmapper.php index 94288f4..0c88963 100644 --- a/db/smsmapper.php +++ b/db/smsmapper.php @@ -153,7 +153,7 @@ class SmsMapper extends Mapper { $cnt = 0; $phlst = $this->getAllPhoneNumbersForFPN ($userId, $phoneNumber, $country); - $query = \OCP\DB::prepare('SELECT count(sms_date) as ct FROM ' . + $query = \OCP\DB::prepare('SELECT count(*) as ct FROM ' . '*PREFIX*ocsms_smsdatas WHERE user_id = ? AND sms_address = ? ' . 'AND sms_mailbox IN (?,?)');