1
在我们的项目中,我们有很大的no。数据(其属性列表网站),我将这些数据存储到Barkeley DB(XML DB)。问题是当我搜索一个房产时,它会很快列出前10个房产(100%的速度)。然后我要去2dn,第3页它以相同的速度工作。但是如果我要以10秒(30%速度)或100秒或1500秒(15%速度)的速度运行,速度非常缓慢。XQuery select查询无法正常工作
以下是我的查询:
let $property_ids:=
(
for $property in collection('bdb/properties.dbxml')/properties/property
[ (sale_price >=60000 and sale_price <=500000) and (building_square_footage >=300 and building_square_footage <=3000) and (bedrooms >=2 and bedrooms <=6) and (mls_agent_id = '505199') ]
order by $property/sale_price/number() descending
return $property/@property_id,
for $property in collection('bdb/properties.dbxml')/properties/property
[ (sale_price >=60000 and sale_price <=500000) and (building_square_footage >=300 and building_square_footage <=3000) and (bedrooms >=2 and bedrooms <=6) and (starts-with(mls_office_id, 'CBRR') and not(mls_agent_id = '505199')) ]
order by $property/sale_price/number() descending
return $property/@property_id,
for $property in collection('bdb/properties.dbxml')/properties/property
[ (sale_price >=60000 and sale_price <=500000) and (building_square_footage >=300 and building_square_footage <=3000) and (bedrooms >=2 and bedrooms <=6) and not(starts-with(mls_office_id, 'CBRR')) ]
order by $property/sale_price/number() descending
return $property/@property_id
)
return <properties>{
for $id in subsequence($property_ids, 1, 10) return
collection('bdb/properties.dbxml')/properties/property[@property_id = $id]
}</properties>
而且有时查询将改变像基于在我的网页过滤选项下面的方式(仅SALE_PRICE场排序指):
let $property_ids:=
(
for $property in collection('bdb/properties.dbxml')/properties/property
order by $property/sale_price/number() descending
return $property/@property_id
)
return <properties>{
for $id in subsequence($property_ids, 1, 10) return
collection('bdb/properties.dbxml')/properties/property[@property_id = $id]
}</properties>
那么从第一页起,它的表现就会很慢(15%)。
能否请你检查我的查询,并帮我解决这个问题...
谢谢 Vijesh