우리 프로젝트에는 큰 번호가 있습니다. 데이터 (자사의 부동산 리스팅 사이트)와 그 데이터를 Barkeley DB (XML DB)에 저장하고 있습니다. 문제는 내가 속성을 검색 할 때 처음 10 개의 속성을 빠르게 (100 % 속도) 나열합니다. 그런 다음 2dn으로 이동하여 3 번째 페이지가 같은 속도로 작동합니다. 그러나 10 번째 (30 % 속도) 또는 100 번째 또는 1500 번째 (15 % 속도) 페이지로 이동하는 경우 매우 느리게 작동합니다. XQuery 선택 쿼리가 적절한 속도로 작동하지 않습니다.
다음
내 쿼리입니다 :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