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"))
  • 相关阅读:
    模态框+Tab切换显示Json/Xml格式,提交Json/Xml字符串到后台
    jeDate时间插件
    ECharts柱状图+BootstrapTable联动
    ES6新增的一些常用特性
    Array数组遍历的几种方法以及Object对象的遍历
    Arguments 对象
    数组去重几种方法
    原型链图解
    切换镜像小工具
    AppID
  • 原文地址:https://www.cnblogs.com/littlehb/p/8010508.html
Copyright © 2011-2022 走看看