Basically, he reported, this query doesn't return any results, despite there being plenty of valid records:
select * from injections where DATE(created_at) = DATE('2008-03-11');
And this query returns the expected records:
select * from injections where DATE(created_at) = DATE('2008-02-18');
The only difference between the two queries is the date provided. Crazy.
But wait, it's gets worse!
This query yields 293 rows (distinct days):
select distinct DATE(created_at) from injections;
While this one only returns 277 rows (days):
select distinct DATE(created_at) from injections where DATE(created_at) = DATE(created_at);
Josh provided some interesting links to MySQL documentation with tidbits like:
"MySQL automatically converts a date to a number if the date is used in a numeric context"and
"However, this conversion is subject to the following exceptions: ... For these exceptional cases, the comparison is done by converting the objects to strings and performing a string comparison."and this one, which I suspect is the culprit:
"A microseconds part is allowable in temporal values in some contexts, such as in literal values, and in the arguments to or return values from some temporal functions."I emphasized the use of the word "some" in that quote. When an API is sometimes consistent - an oxymoron if I've ever heard one - it should set off the klaxons in your noggin.
We didn't solve the puzzle, but Jack did find a clever resolution:
...it turns out that "created_at LIKE '2008-03-11%'" is about 10% faster.
40 comments:
台灣情kiss色網a片下載xxx383美女寫真go2av免費影片18jack主入口視訊美女mybankxx369色女人專用米克綜合論壇85cc免費聊天室台中酒店S援交彩虹馬子免費影片視訊情人後宮電影主入口視訊交友av1688視訊甜心寶貝av貼片區a片免費試看avdvd85cc免費影片視訊聊天bt成人網85cc免費影片線上觀賞百分百貼影片區成人視訊一葉晴貼片免費影片線上直播
Man proposes, God disposes...................................................
女優大奶性交性愛淫蕩淫慾淫亂淫婦淫妹淫叫淫水淫女情慾情色做愛限制級波霸口交18禁貼圖寫真視訊援交露點爆乳潮吹裸體裸照裸女愛愛無碼尋夢視訊聊天a漫
thank for share, it is very important . ̄︿ ̄..................................................
I do like ur article~!!!...................................................
海鷗要高飛,必先遠退。花蜜要香醇,必先久釀。......................................................
長見識了,謝謝你! ........................................
心中有愛,才會人見人愛。 ..................................................
sex女,ut,貼影,av,高潮,女優,做愛,手機成人影片,色遊戲,成人動漫,百分百貼圖區,85cc影片,成人影音,av色情影片,A片線上,a片,sex,777,三級線上看,美女的照片,視訊做愛,78論壇,打飛機,免費視訊,成人影院,辣妹視訊,視訊聊天,影片網,kiss911,a片,交友,聊天,做愛,免費影片,性交,線上成人,網路色情,聊天,美女自慰,免費a分享,免費短片,裸照,一夜情,女優,85cc成人片,美女寫真,偷拍a,情人視訊聊天室
Nice post ~ 3Q..............................................................
keep update, please..bless you!!.........................
欣賞是一種美德~回應是最大的支持^^.............................................
死亡是悲哀的,但活得不快樂更悲哀。 ..................................................
優質的好部落格,需要大家的支持! ........................................
亞洲成人文成人dvd影城線上免費看成人卡通成人色情電影院色情卡通貼圖新中部聊天室新免費成人影片新性愛影片暗黑破壞神程式暗黑程式豦美鳳豦美鳳光碟圖片台灣論壇圖片區85論壇彰化人留言板彰化人聊天事彰化交友聊天室彰化聊天是熊熊貼圖區熊貓[情色貼圖熊貓av貼圖熊貓人貼圖熊貓人圖片熊貓人影片熊貓天堂圖片85論壇嘟嘟線上影片觀賞嘟嘟網線上免費a片豦美鳳性愛光碟嘟ㄉ成人網視訊聊天室 免費視訊 聊天免費視訊
世間是非,要如水泥地般水過則乾。..................................................
一沙一世界,一花一天堂,掌中握無限,剎那即永恆......................................................................
要持續更新下去喲!!祝你心情愉快.................................................................
要照顧身體歐~保重......................................................................
一棵樹除非在春天開了花,否則難望在秋天結果。....................................................................
成熟,就是有能力適應生活中的模糊。.................................................................
走過路過~不能錯過~哈哈............................................................
Thank you very much for such useful informaion ● 3●..................................................................
憤怒,是片刻的瘋狂。..................................................
蛛絲馬跡皆學問、落花水面皆文章............................................................
Practice makes perfect.............................................................
真有內容的部落格~推推!.................................[/url]...............
回應是最大的支持^^y~~~甘吧嗲..................................................................
天氣涼了~要注意身體喔@~@............................................................
大肚能容,了卻人間多少事,滿腔歡喜,笑開天下古今愁。..................................................
Learning makes life sweet.......................................................................
工作,是愛的具體化~~~~努力吧!........................................
Necessity is the mother of invention..................................................................
做好事,不需要給人知道,雖然只是一件微不足道的事,但我相信,這會帶給我快樂。..................................................
愛情不是慈善事業,不能隨便施捨。......................................................................
生命如夏花洵爛;死如秋葉之靜美。......................................... ........................
期待你的下次更新喔^____^..................................................
很棒的分享~希望不會打擾您..................................................................
變天了~~注意身體,別感冒囉!............................................................
人生最重要的一件事,就是從生活中認識你自己。................. ................................................
Post a Comment