Ndijongane nale ngxaki yokusebenza ilandelayo yedatha ye-SQL: Kwitheyibhile ye-SQL ebizwa ngokuba "ngabasebenzisi" enamagama angama- ~ 1,000,000, kuthathe imizuzwana engama-28 engamkelekanga ukumisela inani lobhaliso namhlanje. Amaxesha obhaliso agcinwa kwifomathi "Ymd H: i: s" kwikholamu "eyenziwe".
Umbuzo osetyenzisiweyo
SELECT COUNT(ID) FROM users WHERE DATE(created) = '2014-12-21';
kukhokelele kweli xesha lokulayisha, nangona bekukho isalathiso kwikholamu "eyenziweyo" yefomathi ye-DATETIME
ALTER TABLE `users` ADD INDEX `created` (`created`);
sele ibekiwe. Isizathu sokusebenza gwenxa ngumnxeba womsebenzi WOMHLA: Ikholamu yesalathiso "yenziwe" ithunyelwe ngumsebenzi UMHLA kwaye yenza isalathiso singasebenzi. Isikhangeli sombuzo siyazi kuphela "senziwe", kodwa hayi sisiphumo somhla (owenziwe). Umbuzo olungiselelwe
SELECT COUNT(ID) FROM users WHERE created BETWEEN '2014-12-21' AND '2014-12-21 23:59:59';
kukhokelela kwisiphumo esifunekayo ngexesha lemizuzwana eyi-0.4.