mysql - 分析的不准确啊

访问量: 112

Loading development environment (Rails 4.2.10)
irb(main):001:0> Order.where('created_at > ? and created_at < ? and state = 0', "2019-09-02 00:00:00", "2019-09-02 12:00:00").count
=> 94907
irb(main):002:0> Order.where('created_at > ? and created_at < ? and state = 0', "2019-09-02 00:00:00", "2019-09-02 11:00:00").count
=> 23364
irb(main):003:0> Order.where('created_at > ? and created_at < ? and state = 0', "2019-09-02 10:00:00", "2019-09-02 11:00:00").count
=> 23364
irb(main):004:0> Order.where('created_at > ? and created_at < ? and state = 0', "2019-09-02 10:00:00", "2019-09-02 10:30:00").count
=> 145
irb(main):005:0> Order.where('created_at > ? and created_at < ? and state = 0', "2019-09-02 10:00:00", "2019-09-02 10:30:00").delete_all
=> 0
irb(main):006:0> Order.where('created_at > ? and created_at < ? and state = 0', "2019-09-02 10:00:00", "2019-09-02 10:30:00").count
=> 0
irb(main):007:0> Order.where('created_at > ? and created_at < ? and state = 0', "2019-09-02 10:00:00", "2019-09-02 10:40:00").count
=> 0
irb(main):008:0> Order.where('created_at > ? and created_at < ? and state = 0', "2019-09-02 10:00:00", "2019-09-02 10:50:00").count
=> 0
irb(main):009:0> Order.where('created_at > ? and created_at < ? and state = 0', "2019-09-02 10:00:00", "2019-09-02 11:00:00").count
=> 0
irb(main):010:0> Order.where('created_at > ? and created_at < ? and state = 0', "2019-09-02 10:00:00", "2019-09-02 12:00:00").count
=> 0
irb(main):011:0> 
root@coiex2:/opt/app/admin.coiex.io/current# bundle exec rails c 
Loading development environment (Rails 4.2.10)
irb(main):001:0> Order.where('created_at > ? and created_at < ? and state = 0', "2019-09-02 10:00:00", "2019-09-02 10:30:00").count
=> 0
irb(main):002:0> Order.where('created_at > ? and created_at < ? and state = 0', "2019-09-02 10:00:00", "2019-09-03 10:30:00").count
=> 1517236
irb(main):003:0> Order.where('created_at > ? and created_at < ? and state = 0', "2019-09-02 10:00:00", "2019-09-02 11:30:00").count
=> 0
irb(main):004:0> Order.where('created_at > ? and created_at < ? and state = 0', "2019-09-02 10:00:00", "2019-09-02 12:00:00").count
=> 0
irb(main):005:0> Order.where('created_at > ? and created_at < ? and state = 0', "2019-09-02 10:00:00", "2019-09-02 18:00:00").count
=> 335188
irb(main):006:0> Order.where('created_at > ? and created_at < ? and state = 0', "2019-09-02 10:00:00", "2019-09-02 12:00:00").count
=> 0
irb(main):007:0> Order.where('created_at > ? and created_at < ? and state = 0', "2019-09-02 10:00:00", "2019-09-02 12:00:00").count

订阅/RSS Feed

Subscribe

分类/category