私たちのプロジェクトでは、データ(そのプロパティリストサイト)とそのデータを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