Azure CosmosDb create partition only












0















And probably I already know the answer, yet I would love some feedback.



I have a Azure CosmosDb without partition key (empty), I want to create one because the RUs are too high so the performance improves.



My would-be partition is Date (20181005).



My question is if I don't send the Date as part of the queries (most of the times we request the object by ID), will the partition help on the performance?



I believe that it will since physically will organize documents better, however, I would love some feedback.



Thanks










share|improve this question























  • Not exactly sure what you're asking but... you can't query without partition key, unless you specify a header enabling cross-partition query (which will query every single partition), and that might not be what you have in mind. But if you know the ID, you can do a direct document-read via the SDK and bypass the entire query engine.

    – David Makogon
    Nov 20 '18 at 23:37













  • @DavidMakogon The document id is only unique within it's own logical partition which means it's not enough. The resource id can do what you are saying but it's not something you can have without reading it from the document.

    – Nick Chapsas
    Nov 20 '18 at 23:46











  • @NickChapsas you're right. My point was about query vs point-read, but correct - still need partition key.

    – David Makogon
    Nov 21 '18 at 0:00
















0















And probably I already know the answer, yet I would love some feedback.



I have a Azure CosmosDb without partition key (empty), I want to create one because the RUs are too high so the performance improves.



My would-be partition is Date (20181005).



My question is if I don't send the Date as part of the queries (most of the times we request the object by ID), will the partition help on the performance?



I believe that it will since physically will organize documents better, however, I would love some feedback.



Thanks










share|improve this question























  • Not exactly sure what you're asking but... you can't query without partition key, unless you specify a header enabling cross-partition query (which will query every single partition), and that might not be what you have in mind. But if you know the ID, you can do a direct document-read via the SDK and bypass the entire query engine.

    – David Makogon
    Nov 20 '18 at 23:37













  • @DavidMakogon The document id is only unique within it's own logical partition which means it's not enough. The resource id can do what you are saying but it's not something you can have without reading it from the document.

    – Nick Chapsas
    Nov 20 '18 at 23:46











  • @NickChapsas you're right. My point was about query vs point-read, but correct - still need partition key.

    – David Makogon
    Nov 21 '18 at 0:00














0












0








0








And probably I already know the answer, yet I would love some feedback.



I have a Azure CosmosDb without partition key (empty), I want to create one because the RUs are too high so the performance improves.



My would-be partition is Date (20181005).



My question is if I don't send the Date as part of the queries (most of the times we request the object by ID), will the partition help on the performance?



I believe that it will since physically will organize documents better, however, I would love some feedback.



Thanks










share|improve this question














And probably I already know the answer, yet I would love some feedback.



I have a Azure CosmosDb without partition key (empty), I want to create one because the RUs are too high so the performance improves.



My would-be partition is Date (20181005).



My question is if I don't send the Date as part of the queries (most of the times we request the object by ID), will the partition help on the performance?



I believe that it will since physically will organize documents better, however, I would love some feedback.



Thanks







azure azure-cosmosdb






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 20 '18 at 23:29









Kat Lim RuizKat Lim Ruiz

1,29611323




1,29611323













  • Not exactly sure what you're asking but... you can't query without partition key, unless you specify a header enabling cross-partition query (which will query every single partition), and that might not be what you have in mind. But if you know the ID, you can do a direct document-read via the SDK and bypass the entire query engine.

    – David Makogon
    Nov 20 '18 at 23:37













  • @DavidMakogon The document id is only unique within it's own logical partition which means it's not enough. The resource id can do what you are saying but it's not something you can have without reading it from the document.

    – Nick Chapsas
    Nov 20 '18 at 23:46











  • @NickChapsas you're right. My point was about query vs point-read, but correct - still need partition key.

    – David Makogon
    Nov 21 '18 at 0:00



















  • Not exactly sure what you're asking but... you can't query without partition key, unless you specify a header enabling cross-partition query (which will query every single partition), and that might not be what you have in mind. But if you know the ID, you can do a direct document-read via the SDK and bypass the entire query engine.

    – David Makogon
    Nov 20 '18 at 23:37













  • @DavidMakogon The document id is only unique within it's own logical partition which means it's not enough. The resource id can do what you are saying but it's not something you can have without reading it from the document.

    – Nick Chapsas
    Nov 20 '18 at 23:46











  • @NickChapsas you're right. My point was about query vs point-read, but correct - still need partition key.

    – David Makogon
    Nov 21 '18 at 0:00

















Not exactly sure what you're asking but... you can't query without partition key, unless you specify a header enabling cross-partition query (which will query every single partition), and that might not be what you have in mind. But if you know the ID, you can do a direct document-read via the SDK and bypass the entire query engine.

– David Makogon
Nov 20 '18 at 23:37







Not exactly sure what you're asking but... you can't query without partition key, unless you specify a header enabling cross-partition query (which will query every single partition), and that might not be what you have in mind. But if you know the ID, you can do a direct document-read via the SDK and bypass the entire query engine.

– David Makogon
Nov 20 '18 at 23:37















@DavidMakogon The document id is only unique within it's own logical partition which means it's not enough. The resource id can do what you are saying but it's not something you can have without reading it from the document.

– Nick Chapsas
Nov 20 '18 at 23:46





@DavidMakogon The document id is only unique within it's own logical partition which means it's not enough. The resource id can do what you are saying but it's not something you can have without reading it from the document.

– Nick Chapsas
Nov 20 '18 at 23:46













@NickChapsas you're right. My point was about query vs point-read, but correct - still need partition key.

– David Makogon
Nov 21 '18 at 0:00





@NickChapsas you're right. My point was about query vs point-read, but correct - still need partition key.

– David Makogon
Nov 21 '18 at 0:00












1 Answer
1






active

oldest

votes


















1














The document id is only unique within it's own logical partiton. You can have multiple documents with the exact same id property as long as they are in different logical partitions.



If you partition your collection you have to deal with 2 (of many) realities.




  • The logical partition size cannot exceed 10GB

  • In order to have efficient queries and reads you have to provide the partition key value alongside your operations.


You can still do any querying operation using a cross partition query but this is something that should be avoided if possible. If you see yourself needing to use a cross partition query frequently then there is a problem with your partitioning strategy.



Bottomline is that your querying performance will be way worse without a partition key provided during the querying process.






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/3.0/"u003ecc by-sa 3.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%2f53403164%2fazure-cosmosdb-create-partition-only%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









    1














    The document id is only unique within it's own logical partiton. You can have multiple documents with the exact same id property as long as they are in different logical partitions.



    If you partition your collection you have to deal with 2 (of many) realities.




    • The logical partition size cannot exceed 10GB

    • In order to have efficient queries and reads you have to provide the partition key value alongside your operations.


    You can still do any querying operation using a cross partition query but this is something that should be avoided if possible. If you see yourself needing to use a cross partition query frequently then there is a problem with your partitioning strategy.



    Bottomline is that your querying performance will be way worse without a partition key provided during the querying process.






    share|improve this answer




























      1














      The document id is only unique within it's own logical partiton. You can have multiple documents with the exact same id property as long as they are in different logical partitions.



      If you partition your collection you have to deal with 2 (of many) realities.




      • The logical partition size cannot exceed 10GB

      • In order to have efficient queries and reads you have to provide the partition key value alongside your operations.


      You can still do any querying operation using a cross partition query but this is something that should be avoided if possible. If you see yourself needing to use a cross partition query frequently then there is a problem with your partitioning strategy.



      Bottomline is that your querying performance will be way worse without a partition key provided during the querying process.






      share|improve this answer


























        1












        1








        1







        The document id is only unique within it's own logical partiton. You can have multiple documents with the exact same id property as long as they are in different logical partitions.



        If you partition your collection you have to deal with 2 (of many) realities.




        • The logical partition size cannot exceed 10GB

        • In order to have efficient queries and reads you have to provide the partition key value alongside your operations.


        You can still do any querying operation using a cross partition query but this is something that should be avoided if possible. If you see yourself needing to use a cross partition query frequently then there is a problem with your partitioning strategy.



        Bottomline is that your querying performance will be way worse without a partition key provided during the querying process.






        share|improve this answer













        The document id is only unique within it's own logical partiton. You can have multiple documents with the exact same id property as long as they are in different logical partitions.



        If you partition your collection you have to deal with 2 (of many) realities.




        • The logical partition size cannot exceed 10GB

        • In order to have efficient queries and reads you have to provide the partition key value alongside your operations.


        You can still do any querying operation using a cross partition query but this is something that should be avoided if possible. If you see yourself needing to use a cross partition query frequently then there is a problem with your partitioning strategy.



        Bottomline is that your querying performance will be way worse without a partition key provided during the querying process.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 20 '18 at 23:51









        Nick ChapsasNick Chapsas

        2,9961515




        2,9961515
































            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%2f53403164%2fazure-cosmosdb-create-partition-only%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

            How to change which sound is reproduced for terminal bell?

            Can I use Tabulator js library in my java Spring + Thymeleaf project?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents