Slow Query Performance in PouchDB with Synced CouchDB Index

Aperta
#8,995 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
javascript
Ambito
databases

Direzione di ricerca

La issue non fornisce alcun file del repository, test o punto di ingresso da cui iniziare. Riproduci la query in un browser con l’adattatore IndexedDB, confronta l’indice sincronizzato con un indice creato tramite createIndex() e ispeziona getIndexes(); l’attività è completata quando è stato identificato se viene utilizzato l’indice sincronizzato e il comportamento supportato è stato documentato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I am experiencing slow query performance in PouchDB despite using an index synced from CouchDB. Below are the details of my setup and the issue:

setup
This is my index in CouchDB

{
"_id": "_design/employee-index",
"_rev": "9-853ffb68171b1e78206646d0a63c22bc",
"language": "query",
"views": {
"residents-index": {
"map": {
"fields": {
"firstName": "asc",
"projectId": "asc"
},
"partial_filter_selector": {}
},
"reduce": "_count",
"options": {
"def": {
"fields": [
"firstName",
"projectId"
]
}
}
}
}
}

PouchDB sync

I have synced the above index from CouchDB to PouchDB.
The index appears in IndexedDB as pouch_employee_mrview. It has records.

Query

db.find({
selector: {
projectId: 'specificProjectId',
firstName: { $gte: null }
},
use_index: '_design/employee-index'
}).then(function (result) {
console.log(result.docs);
}).catch(function (err) {
console.error(err);
});

Issue

Despite using the use_index field in my query, the performance is still slow

Info
  • Environment: browser (using pouchdb-browser)
  • Platform: (Chrome/FF/Safari/Edge/iOS/Android/etc.)
  • Adapter: indexeddb
  • Server: CouchDB
My questions
  1. Since I have created the Index at CouchDB and synced with PouchDB, Is it not using the Index properly?
  2. Do I need to recreate the index using createIndex() from Pouch side? I queried the PouchDB index using getIndexes(). The index is available.
  3. If I edit any field on PouchDB, Will that warm up the Index automatically.

Hi @maintainer, I would greatly appreciate it if you could take a look at this issue at your earliest convenience. The slow query performance is significantly impacting our application’s performance, and any guidance or suggestions would be immensely helpful. Thank you!

Lingua principale
JavaScript
Stelle
17.6k
Fork
1.5k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/pouchdb

Tutte le issue di apache/pouchdb

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.