求各位兄弟姐妹帮我优化一下查询速度,有酬谢!(表有300百多万条记录)

fanzs007 2012-03-19 01:52:38
开发环境:PB9.0+ORACLE8i

涉及四个张
我自己做了一个查询,在PL/sql执行同一个语句,以下记录,只要0.969秒

在PB执行查询,只要3秒

select count(*) from resa_sa_doc ------销售流水表73173条记录
select count(*) from resa_sa_dtl ------销售明细表143772条记录
select count(*) from pub_goods_price ------商品价格表393310条记录
select count(*) from pub_goods ------商品信息表21845条记录
-------------------------------------------------------------------------------

执行同一个语句,以下记录,长达两分钟
在PB执行查询,长达十分钟

select count(*) from resa_sa_doc ------销售流水表1662304条记录
select count(*) from resa_sa_dtl ------销售明细表3348437条记录
select count(*) from pub_goods_price ------商品价格表387370条记录
select count(*) from pub_goods ------商品信息表21515条记录
-------------------------------------------------------------------------------------
我是菜鸟,而且三年多不碰编程了,不懂得怎么做。


各位兄弟姐妹如果有兴趣,可以帮我一下,不胜感激。


我的QQ:286016189
...全文
140 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
fanzs007 2012-03-20
  • 打赏
  • 举报
回复
重建索引试试 -------还是一样的。

select count(1) from resa_sa_doc --------56秒 1662304条记录
select count(1) from resa_sa_dtl --------64秒 3348437条记录
select count(1) from pub_goods_price --------3.5秒 387370条记录
select count(1) from pub_goods --------3秒 21515条记录
kenshu 2012-03-20
  • 打赏
  • 举报
回复
一定是数据库有问题,没有索引的情况下,单独SELECT count(1) from 表,ACCESS都比它快.
buzhidao945 2012-03-19
  • 打赏
  • 举报
回复
select count(1) from resa_sa_doc
select count(1) from resa_sa_dtl
select count(1) from pub_goods_price
select count(1) from pub_goods
ribut9225 2012-03-19
  • 打赏
  • 举报
回复
应该跟PB无关,检查一下表的索引吧
fdzxm 2012-03-19
  • 打赏
  • 举报
回复
重建索引试试
kenshu 2012-03-19
  • 打赏
  • 举报
回复
要找ORACLE管理员解决.

--------------------

但可以试试

select count(1) from resa_sa_doc

如果还快不了,就不是查询语句可以优化的了.

1,108

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧