• 数据库查询数据行数


    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表的总数”

  • 相关阅读:
    android蓝牙技术
    startActivityForResult 页面跳转回调
    android提示框
    二级列表展示数据库查询
    字符串着色
    ActionBar窗口应用
    android 补间动画帧动画
    ExpandableListView二级列表
    解析json数组——TypeToken
    Scrapy中的Callback如何传递多个参数
  • 原文地址:https://www.cnblogs.com/Dreamsoft/p/13644644.html
Copyright © 2020-2023  润新知