Home >Database >Mysql Tutorial >谁来帮帮我啊,oracle查询好慢呢

谁来帮帮我啊,oracle查询好慢呢

WBOY
WBOYOriginal
2016-06-07 14:57:101188browse

求高手不惜赐教,问题是这样的,做一个oracle分页查询,news_data是新闻表,news_type新闻类型,news_image是个新闻图片表,一条新闻可能有多张图片,要求只取一张图片对应一条新闻,然后分页 现在情况是新闻类型多,数据多 这样查询比较慢的,在线等

求高手不惜赐教,问题是这样的,做一个oracle分页查询,news_data是新闻表,news_type新闻类型,news_image是个新闻图片表,一条新闻可能有多张图片,要求只取一张图片对应一条新闻,然后分页 现在情况是新闻类型多,数据多 这样查询比较慢的,在线等啊~~急急急
select *from (select rownum rn,a.* from (select i.img_id,i.img_url,t.news_id,t.news_title,t.news_detail,t.news_date,t.match_type from news_data t left join (select x.img_id,x.news_id,x.img_url from news_image x where not exists(select 1 from news_image y where x.news_id = y.news_id and x.img_id > y.img_id)) i on t.news_id = i.news_id where t.news_type = 3 order by t.news_date desc) a where rownum <= 10 ) where rn > 0
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:子查询以及sql练习Next article:ETL调度系统