27,579
社区成员
发帖
与我相关
我的任务
分享
;with tabtemp as
(
select ROW_NUMBER() over (order by time desc) as rows,
(select COUNT(*)
from from mytable
where time > '2013-10-10 00:00:00'
and description like '%描述%') as count_rows, --记录条数
*
from mytable
where time > '2013-10-10 00:00:00' and description like '%描述%'
)
select * from tabtemp
where rows between 220000 and 230000 ;
[/quote]
刚才试了,如果不带查询条件很快,3秒内,但是带上条件,效率就慢了,平均需要6秒左右,达不到5秒内呀,不过,谢谢![/quote]
哦,不带哪个查询条件呢?;with tabtemp as
(
select ROW_NUMBER() over (order by time desc) as rows,
(select COUNT(*)
from from mytable
where time > '2013-10-10 00:00:00'
and description like '%描述%') as count_rows, --记录条数
*
from mytable
where time > '2013-10-10 00:00:00' and description like '%描述%'
)
select * from tabtemp
where rows between 220000 and 230000 ;
[/quote]
刚才试了,如果不带查询条件很快,3秒内,但是带上条件,效率就慢了,平均需要6秒左右,达不到5秒内呀,不过,谢谢!;with tabtemp as
(
select ROW_NUMBER() over (order by time desc) as rows,
(select COUNT(*)
from from mytable
where time > '2013-10-10 00:00:00'
and description like '%描述%') as count_rows, --记录条数
*
from mytable
where time > '2013-10-10 00:00:00' and description like '%描述%'
)
select * from tabtemp
where rows between 220000 and 230000 ;
;with tabtemp as
(
select ROW_NUMBER() over (order by time desc) as rows,
COUNT(*) over(partition by 1) as count_rows, --记录条数
*
from mytable
where time > '2013-10-10 00:00:00' and description like '%描述%'
)
select * from tabtemp
where rows between 220000 and 230000 ;
[/quote]
这个我试过了,平均需要6-7秒,效率低!;with tabtemp as
(
select ROW_NUMBER() over (order by time desc) as rows,
COUNT(*) over(partition by 1) as count_rows, --记录条数
*
from mytable
where time > '2013-10-10 00:00:00' and description like '%描述%'
)
select * from tabtemp
where rows between 220000 and 230000 ;