假设我不是管理员 无法通过dba_tables查询出该表的行数
这个表大概有六亿行左右的数据,我试了下 count(*)和count(主键)
根本跑不出来 还有没有其他的好办法!
这个表大概有六亿行左右的数据,我试了下 count(*)和count(主键)
根本跑不出来 还有没有其他的好办法!
解决方案 »
- 索引扫描的几种类型
- 提示错误ORA00905:select * into A from B,缺少关键字
- 关于P/L SQL的问题
- sql优化
- 如何编写判断2个数据库之间表中内容是否想等的sql脚本
- ****如何将数据从ORACLE上传到FTP?****
- 招聘Oracle9 OCP 北京兼职教师 100元-150元/小时 mail: [email protected]
- 两个库之间,相同的表的数据对拷问题!!
- 在新建OLAP和OWB数据库后http://ip:1158/em页无法显示问题
- 求助!oracle9i里时间比较的函数.急!!
- ORA-12528: TNS: 监听程序错误
- index 查询
我查了下 貌似都说 count(1) 和count(*)的效率差别不大啊~
/*
COUNT returns the number of rows in the query. You can use it as an aggregate or analytic function.If you specify DISTINCT, then you can specify only the query_partition_clause of the analytic_clause. The order_by_clause and windowing_clause are not allowed.If you specify expr, then COUNT returns the number of rows where expr is not null. You can count either all rows, or only distinct values of expr.If you specify the asterisk (*), then this function returns all rows, including duplicates and nulls. COUNT never returns null.
*/
/*
如果你的数据表没有主键,那么count(1)比count(*)快
如果有主键的话,那主键(联合主键)作为count的条件也比count(*)要快
如果你的表只有一个字段的话那count(*)就是最快的啦
count(*) count(1) 两者比较。主要还是要count(1)所相对应的数据字段。
如果count(1)是聚索引,id,那肯定是count(1)快。但是差的很小的。
因为count(*),自动会优化指定到那一个字段。所以没必要去count(?),用count(*),sql会帮你完成优化的
*/
where u.table_name='table_name'
是的啊 dba_tables 和user_tables 这两个表中 都可以通过num rows 查出来
你们的有值么,这个难道和oracle系统参数有关系?
from user_tables u
这个表的行数是不准滴