Hi Adam,

Thank you for your response. I would like to go a bit deeper into that
idea. I'm definitely not an expert on CouchDb - I would say very beginner.
:)
If I will have let's say 100 different type of requests in my app and I
will create indexes for all of them. Rather if I will have one JSON object
in CouchDb and I will create in Fauxton for each property Index, cause I
each of my requests related to that object will need that or I will just
feel that is needed  - Can it be some bad implication of doing that ?

Thanks,
Piotr


czw., 4 cze 2020 o 16:06 Adam Kocoloski <[email protected]> napisał(a):

> Hi Piotr,
>
> To first order, yes, I’d try to have every query an application issues be
> satisfied by an index.
>
> If you’ve got some queries that you run infrequently in the background
> those may not warrant an index, as the resources required to keep the index
> up-to-date would be greater than the cost of just scanning the entire
> database.
>
> Cheers, Adam
>
> > On Jun 4, 2020, at 8:53 AM, Piotr Zarzycki <[email protected]>
> wrote:
> >
> > Hello everyone,
> >
> > We are building JS based application which storing data in CouchDb. It
> is a
> > greenfield application in case of front end and database structure. I
> would
> > use some examples at the beginning.
> >
> > I have some selector which gets me data from db:
> >
> > const q = {
> >      selector: {
> >        historyId: document.historyId,
> >      },
> >      sort: [{ version: "desc" }],
> >      limit: 500,
> >    };
> >
> >
> > In the results I will get data along with warning:
> >
> > "warning": "no matching index found, create an index to optimize query
> time"
> >
> >
> > I can easily get rid of that warning by adding using Fauxton index:
> >
> > {
> >   "index": {
> >      "fields": [
> >         "historyId"
> >      ]
> >   },
> >   "name": "historyId-json-index",
> >   "type": "json"
> > }
> >
> >
> > My question is - How do you guys approach to working with indexes ?
> Should
> > I add it to each query which I'm doing ?
> >
> > Thoughts about approaches would be much appreciated. :)
> >
> > Thanks,
> > --
> >
> > Piotr Zarzycki
> >
> > Patreon: *https://www.patreon.com/piotrzarzycki
> > <https://www.patreon.com/piotrzarzycki>*
>
>

-- 

Piotr Zarzycki

Patreon: *https://www.patreon.com/piotrzarzycki
<https://www.patreon.com/piotrzarzycki>*

Reply via email to