CouchDB Document modellingMongoDB or CouchDB - fit for production?Principles for Modeling CouchDB DocumentsAggregating data with CouchDB reduce functionCouchDB - Basic design for joins dataCouchDB map/reduce by any document property at runtime?Using CouchDB and Redis together for transactional dataWhen to use CouchDB over MongoDB and vice versacouchDB: view that returns NOT NULL values, doesn't return NULL valuesWhy do CouchDB Reduce Functions have to be Commutative?Sum values in CouchDB documents

Phonetic distortion when words are borrowed among languages

Creating specific options in `Manipulate[]`

The differences amongst f[x_], f[x__], and f[x___]

How do my husband and I get over our fear of having another difficult baby?

Booting Ubuntu from USB drive on MSI motherboard -- EVERYTHING fails

French license plates

Beyond Futuristic Technology for an Alien Warship?

What is the logical distinction between “the same” and “equal to?”

How important is knowledge of trig identities for use in Calculus

How to stop the death waves in my city?

How to study endgames?

Why isn't there armor to protect from spells in the Potterverse?

What would happen if I build a half bath without permits?

Isn't the detector always measuring, and thus always collapsing the state?

Is the "spacetime" the same thing as the mathematical 4th dimension?

If someone asks a question using “quién”, how can one shortly respond?

Can you cure a Gorgon's Petrifying Breath before it finishes turning a target to stone?

How do we know neutrons have no charge?

Is there an in-universe explanation of how Frodo's arrival in Valinor was recorded in the Red Book?

Can an energy drink or chocolate before an exam be useful ? What sort of other edible goods be helpful?

How to add the real hostname in the beginning of Linux cli command

How does Monks' Improved Unarmored Movement work out of combat?

Avoiding dust scattering when you drill

How to work around players whose backstory goes against the story?



CouchDB Document modelling


MongoDB or CouchDB - fit for production?Principles for Modeling CouchDB DocumentsAggregating data with CouchDB reduce functionCouchDB - Basic design for joins dataCouchDB map/reduce by any document property at runtime?Using CouchDB and Redis together for transactional dataWhen to use CouchDB over MongoDB and vice versacouchDB: view that returns NOT NULL values, doesn't return NULL valuesWhy do CouchDB Reduce Functions have to be Commutative?Sum values in CouchDB documents






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















[TLDR] Does CouchDB cache and reuse the results of map/reduce functions for non-modified documents?



Background info:
In my Point of Sale (POS) application, all the transactions are logged and created separate document.



"_id": "sale_transactions_1234124", "Quanity Added": 0, "Quanity reduced": 10, "Is Discarded": "false", "saleid": "sales_523"



"_id": "Purchaseorder_transactions_1234124", "Quanity Added": 5, "Quanity reduced": 0, "Is Discarded": "false" , "purchaseid": "purchase_2352"



Whenever the inventory is modified, relevant documents are created as transactions it is _id field. So instead of store Total sold, Quantity in hand in Item document, have plan to create map reduce view to retrieve every time.



Every time when I make a sale, Quantity in hand map reduce function should be called, to check whether the quantity is greater than zero. For this approach will I encounter any performance issue, or did you recommend create Total sold, Quantity in hand in Item document



So every time we call map reduce function, is couchdb some how cache non-modified document results and process new and modified documents, or is it process all the documents in every time?










share|improve this question





















  • 1





    Is your question simply: Does CouchDB cache and reuse the results of map/reduce functions for non-modified documents?

    – Flimzy
    Mar 29 at 7:20











  • Yes. If it always cache, instead of storing values, is it good practice to rely map-reduce function.

    – Nest
    Mar 29 at 7:34











  • You could just ask that question, without all the unnecessary background info :)

    – Flimzy
    Mar 29 at 7:36











  • You are right. Shall I edit this question or ask new question?

    – Nest
    Mar 29 at 8:08











  • I would just edit this one.

    – Flimzy
    Mar 29 at 8:10

















0















[TLDR] Does CouchDB cache and reuse the results of map/reduce functions for non-modified documents?



Background info:
In my Point of Sale (POS) application, all the transactions are logged and created separate document.



"_id": "sale_transactions_1234124", "Quanity Added": 0, "Quanity reduced": 10, "Is Discarded": "false", "saleid": "sales_523"



"_id": "Purchaseorder_transactions_1234124", "Quanity Added": 5, "Quanity reduced": 0, "Is Discarded": "false" , "purchaseid": "purchase_2352"



Whenever the inventory is modified, relevant documents are created as transactions it is _id field. So instead of store Total sold, Quantity in hand in Item document, have plan to create map reduce view to retrieve every time.



Every time when I make a sale, Quantity in hand map reduce function should be called, to check whether the quantity is greater than zero. For this approach will I encounter any performance issue, or did you recommend create Total sold, Quantity in hand in Item document



So every time we call map reduce function, is couchdb some how cache non-modified document results and process new and modified documents, or is it process all the documents in every time?










share|improve this question





















  • 1





    Is your question simply: Does CouchDB cache and reuse the results of map/reduce functions for non-modified documents?

    – Flimzy
    Mar 29 at 7:20











  • Yes. If it always cache, instead of storing values, is it good practice to rely map-reduce function.

    – Nest
    Mar 29 at 7:34











  • You could just ask that question, without all the unnecessary background info :)

    – Flimzy
    Mar 29 at 7:36











  • You are right. Shall I edit this question or ask new question?

    – Nest
    Mar 29 at 8:08











  • I would just edit this one.

    – Flimzy
    Mar 29 at 8:10













0












0








0








[TLDR] Does CouchDB cache and reuse the results of map/reduce functions for non-modified documents?



Background info:
In my Point of Sale (POS) application, all the transactions are logged and created separate document.



"_id": "sale_transactions_1234124", "Quanity Added": 0, "Quanity reduced": 10, "Is Discarded": "false", "saleid": "sales_523"



"_id": "Purchaseorder_transactions_1234124", "Quanity Added": 5, "Quanity reduced": 0, "Is Discarded": "false" , "purchaseid": "purchase_2352"



Whenever the inventory is modified, relevant documents are created as transactions it is _id field. So instead of store Total sold, Quantity in hand in Item document, have plan to create map reduce view to retrieve every time.



Every time when I make a sale, Quantity in hand map reduce function should be called, to check whether the quantity is greater than zero. For this approach will I encounter any performance issue, or did you recommend create Total sold, Quantity in hand in Item document



So every time we call map reduce function, is couchdb some how cache non-modified document results and process new and modified documents, or is it process all the documents in every time?










share|improve this question
















[TLDR] Does CouchDB cache and reuse the results of map/reduce functions for non-modified documents?



Background info:
In my Point of Sale (POS) application, all the transactions are logged and created separate document.



"_id": "sale_transactions_1234124", "Quanity Added": 0, "Quanity reduced": 10, "Is Discarded": "false", "saleid": "sales_523"



"_id": "Purchaseorder_transactions_1234124", "Quanity Added": 5, "Quanity reduced": 0, "Is Discarded": "false" , "purchaseid": "purchase_2352"



Whenever the inventory is modified, relevant documents are created as transactions it is _id field. So instead of store Total sold, Quantity in hand in Item document, have plan to create map reduce view to retrieve every time.



Every time when I make a sale, Quantity in hand map reduce function should be called, to check whether the quantity is greater than zero. For this approach will I encounter any performance issue, or did you recommend create Total sold, Quantity in hand in Item document



So every time we call map reduce function, is couchdb some how cache non-modified document results and process new and modified documents, or is it process all the documents in every time?







couchdb






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 10 at 6:04







Nest

















asked Mar 28 at 20:07









NestNest

882 silver badges17 bronze badges




882 silver badges17 bronze badges










  • 1





    Is your question simply: Does CouchDB cache and reuse the results of map/reduce functions for non-modified documents?

    – Flimzy
    Mar 29 at 7:20











  • Yes. If it always cache, instead of storing values, is it good practice to rely map-reduce function.

    – Nest
    Mar 29 at 7:34











  • You could just ask that question, without all the unnecessary background info :)

    – Flimzy
    Mar 29 at 7:36











  • You are right. Shall I edit this question or ask new question?

    – Nest
    Mar 29 at 8:08











  • I would just edit this one.

    – Flimzy
    Mar 29 at 8:10












  • 1





    Is your question simply: Does CouchDB cache and reuse the results of map/reduce functions for non-modified documents?

    – Flimzy
    Mar 29 at 7:20











  • Yes. If it always cache, instead of storing values, is it good practice to rely map-reduce function.

    – Nest
    Mar 29 at 7:34











  • You could just ask that question, without all the unnecessary background info :)

    – Flimzy
    Mar 29 at 7:36











  • You are right. Shall I edit this question or ask new question?

    – Nest
    Mar 29 at 8:08











  • I would just edit this one.

    – Flimzy
    Mar 29 at 8:10







1




1





Is your question simply: Does CouchDB cache and reuse the results of map/reduce functions for non-modified documents?

– Flimzy
Mar 29 at 7:20





Is your question simply: Does CouchDB cache and reuse the results of map/reduce functions for non-modified documents?

– Flimzy
Mar 29 at 7:20













Yes. If it always cache, instead of storing values, is it good practice to rely map-reduce function.

– Nest
Mar 29 at 7:34





Yes. If it always cache, instead of storing values, is it good practice to rely map-reduce function.

– Nest
Mar 29 at 7:34













You could just ask that question, without all the unnecessary background info :)

– Flimzy
Mar 29 at 7:36





You could just ask that question, without all the unnecessary background info :)

– Flimzy
Mar 29 at 7:36













You are right. Shall I edit this question or ask new question?

– Nest
Mar 29 at 8:08





You are right. Shall I edit this question or ask new question?

– Nest
Mar 29 at 8:08













I would just edit this one.

– Flimzy
Mar 29 at 8:10





I would just edit this one.

– Flimzy
Mar 29 at 8:10












1 Answer
1






active

oldest

votes


















0
















Yes CouchdDB caches your map/reduce documents. So if you query the same view multiple times Couch will give you the cached version. If additional datasets are added to the database Couch will update the view.



To see that Couch caches the views you can try to create a new view on a database with a lot of documents:



  1. Call the view for the first time and you will see that it takes some time to get your result.

  2. Call your view again and it will be ready immediately.

  3. Add a few new documents to your database

  4. Call your view and it will be ready very fast if not immediately.

  5. Add a lot of new documents to your database

  6. Call your view again and it will take more time than when you just added a few new documents. But will be ready immediately after it is build up.





share|improve this answer



























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );














    draft saved

    draft discarded
















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55406041%2fcouchdb-document-modelling%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0
















    Yes CouchdDB caches your map/reduce documents. So if you query the same view multiple times Couch will give you the cached version. If additional datasets are added to the database Couch will update the view.



    To see that Couch caches the views you can try to create a new view on a database with a lot of documents:



    1. Call the view for the first time and you will see that it takes some time to get your result.

    2. Call your view again and it will be ready immediately.

    3. Add a few new documents to your database

    4. Call your view and it will be ready very fast if not immediately.

    5. Add a lot of new documents to your database

    6. Call your view again and it will take more time than when you just added a few new documents. But will be ready immediately after it is build up.





    share|improve this answer





























      0
















      Yes CouchdDB caches your map/reduce documents. So if you query the same view multiple times Couch will give you the cached version. If additional datasets are added to the database Couch will update the view.



      To see that Couch caches the views you can try to create a new view on a database with a lot of documents:



      1. Call the view for the first time and you will see that it takes some time to get your result.

      2. Call your view again and it will be ready immediately.

      3. Add a few new documents to your database

      4. Call your view and it will be ready very fast if not immediately.

      5. Add a lot of new documents to your database

      6. Call your view again and it will take more time than when you just added a few new documents. But will be ready immediately after it is build up.





      share|improve this answer



























        0














        0










        0









        Yes CouchdDB caches your map/reduce documents. So if you query the same view multiple times Couch will give you the cached version. If additional datasets are added to the database Couch will update the view.



        To see that Couch caches the views you can try to create a new view on a database with a lot of documents:



        1. Call the view for the first time and you will see that it takes some time to get your result.

        2. Call your view again and it will be ready immediately.

        3. Add a few new documents to your database

        4. Call your view and it will be ready very fast if not immediately.

        5. Add a lot of new documents to your database

        6. Call your view again and it will take more time than when you just added a few new documents. But will be ready immediately after it is build up.





        share|improve this answer













        Yes CouchdDB caches your map/reduce documents. So if you query the same view multiple times Couch will give you the cached version. If additional datasets are added to the database Couch will update the view.



        To see that Couch caches the views you can try to create a new view on a database with a lot of documents:



        1. Call the view for the first time and you will see that it takes some time to get your result.

        2. Call your view again and it will be ready immediately.

        3. Add a few new documents to your database

        4. Call your view and it will be ready very fast if not immediately.

        5. Add a lot of new documents to your database

        6. Call your view again and it will take more time than when you just added a few new documents. But will be ready immediately after it is build up.






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 11 at 10:52









        Jay BeeJay Bee

        761 silver badge7 bronze badges




        761 silver badge7 bronze badges

































            draft saved

            draft discarded















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55406041%2fcouchdb-document-modelling%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript