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