1
インデックスクエリを初めて使用すると時間がかかりすぎます。indexedDb objectStore.openCursor so slow
使用シナリオ:モバイル使用ウェブビュー。
データがindexedDbに保存された後、初めてページクエリを開くと非常に遅くなります。
クエリコード:
var startTime = new Date().getTime();
var request = indexedDB.open("yfg");
request.onerror = function(event) {
\t alert("Why didn't you allow my web app to use IndexedDB?!");
};
request.onsuccess = function(event) {
\t var table = [];
\t var db = request.result;
\t var objectStore = db.transaction("table").objectStore("table");
\t //objectStore.openCursor().onsuccess = function(event) {
\t objectStore.openCursor(null,IDBCursor.NEXT).onsuccess = function(event) {
\t \t var cursor = event.target.result;
\t \t if (cursor) {
\t \t \t table.push(cursor.value);
\t \t \t cursor.continue();
\t \t }else {
\t \t \t //alert("No more entries!");
\t \t \t console.log(table);
\t \t \t var endTime = new Date().getTime();
\t \t \t console.log("总耗时:",(endTime-startTime)/1000);
\t \t }
\t };
};
コンソールで実行し
各データの具体的な内容は:
どのくらいのデータが転送されていますか? –
テーブルシート1200枚以上のバー – fan
バー?それが測定データの新しい単位ですか?バーのバイト数は?問題を適切に再読し、IndexedDBを使用していることを認識してください –