zoukankan      html  css  js  c++  java
  • 为预热准备更新时间列的查询办法,解决原表中没有索引的问题

    drop table t_resource_info_temp;
    -- 约30秒
    create table  t_resource_info_temp select id,create_time from t_resource_info;  
    --     约8秒
    alter  table  t_resource_info_temp  add  index  index_create_time(create_time) ;

    -- 联合查询
    select * from t_resource_info where id in (select id from t_resource_info_temp where create_time between '2016-09-01' and '2016-09-02')


    drop table t_resource_structure_temp;
    -- 约30秒
    create table  t_resource_structure_temp select structure_id,last_updated_time from t_resource_structure;  
    --     约8秒
    alter  table  t_resource_structure_temp  add  index  index_last_updated_time(last_updated_time) ;

    -- 联合查询
    select * from t_resource_structure where structure_id in (select structure_id from t_resource_structure_temp where last_updated_time between '2016-09-01' and '2016-09-02')

    -- 开始时间
    select date_format(min(last_updated_time),'%Y-%m-%d') as start_day from t_resource_structure;

    -- 结束时间
    select date_format(date_add(now(), interval 1 day),'%Y-%m-%d')  as stop_day;

    python脚本的循环日期

    begin = datetime.date(2010, 1, 1)
    end = datetime.date.today()
    d = begin
    delta = datetime.timedelta(days=1)
    while d <= end:
        print(d.strftime("%Y-%m-%d"))
        d += delta

     N天前的日期

    d = datetime.datetime.now() - datetime.timedelta(days=7)
    print(d.strftime("%Y-%m-%d"))
  • 相关阅读:
    【HDOJ】4347 The Closest M Points
    【HDOJ】4341 Gold miner
    【HDOJ】4333 Revolving Digits
    【HDOJ】4336 Card Collector
    【HDOJ】4328 Cut the cake
    【HDOJ】4322 Candy
    【HDOJ】4317 Unfair Nim
    串口接收线程退出与优先级问题
    EVC编程与调试过程出现的问题
    Windows CE创建桌面快捷方式
  • 原文地址:https://www.cnblogs.com/littlehb/p/8010508.html
Copyright © 2011-2022 走看看