zoukankan      html  css  js  c++  java
  • 数据库查询数据行数

    oracle数据库

    select t.table_name,t.num_rows from all_tables t;  查询所有表的行数

    mysql数据库

    use information_schema; 进入information_schema数据库名
    select table_name,table_rows from tables where TABLE_SCHEMA = 'sjzx' order by table_rows desc;  查询所有表的行数

    问题:oracles数据库存在不准的情况,需要刷新数据表

    https://blog.csdn.net/red_sky_blue/article/details/68138845    参考

    DXXY  数据库名

    select COUNT(*) from xxx ;  查询xxx表的总数
    select t.table_name,t.num_rows from all_tables t 查询所有表的总行数

    select t.table_name,t.num_rows from all_tables t where table_name ='xxx';  在所有表中,查询xxx表的总数

    select 'analyze table '|| A.TABLE_NAME ||' compute statistics;' from all_tables A where A.OWNER='DXXY';   将查到的sql,复制出来执行

    select 'analyze table ' || A.TABLE_NAME ||' compute statistics for all indexes;' from all_tables A where A.OWNER='DXXY';  将查到的sql,复制出来执行

    select 'analyze table ' || A.TABLE_NAME || ' delete statistics ;' from all_tables A where A.OWNER='DXXY';  将查到的sql,复制出来执行

    例如:analyze 表名 compute statistics;   
    analyze table KS_GR_MONTH_11_2019 compute statistics;  刷新行数信息

    select TABLE_NAME,NUM_ROWS from all_tables A where A.OWNER='DXXY' AND TABLE_NAME ='xxx';   再次查询  “在所有表中,查询xxx表的总数”

  • 相关阅读:
    HDU_3127 WHUgirls(DP)
    ibatits
    jqGrid怎么设定水平滚动条
    poi导出EXcel
    jqGrid资料总结
    jqgrid横向滚动条
    开源网http://www.openopen.com/ajax/2_Charts.htm
    struts2国际化
    struts2结合poi导出excel
    Struts2 Action读取资源文件
  • 原文地址:https://www.cnblogs.com/Dreamsoft/p/13644644.html
Copyright © 2011-2022 走看看