Oracle order by 查询速度非常慢
我在桌子上进行排序时遇到问题。
我的选择查询工作正常,但是当我按顺序排序(即使在主键上)时,它只会继续下去,没有结果。最后我需要终止会话。该表有20K 条记录。 对此有什么建议吗? 查询如下:
SELECT * FROM Users ORDER BY ID;
我不知道查询计划,因为我是 Oracle 新手
I am facing a problem when doing order by on a table.
My select query is working fine, but when i do order by (even on the primary key) it just goes on and on with no results. Finally i need to kill the session. The table has20K records.
Any suggestion for the this?
Query is as:
SELECT * FROM Users ORDER BY ID;
I do not about know about the query plan as i am new to oracle
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
select bytes/1024/1024 MB from user_segments where segment_name = 'USERS';
我见过很多情况,几兆字节的数据使用了许多千兆字节的存储空间。也许数据之前非常大,有人刚刚删除了它(这不会删除空间)。或者也许有人使用 APPEND 提示一次插入这些行 1,并且每行占用整个块。select bytes/1024/1024 MB from user_segments where segment_name = 'USERS';
I've seen many cases where a few megabytes of data use many gigabytes of storage. Maybe the data was very large before and somebody just deleted it (this doesn't remove the space). Or maybe somebody inserted those rows 1 at a time with an APPEND hint, and each row is taking an entire block.