azure - Is reading whole object from DocumentDb faster and more efficient? -


i'm trying understand if more efficient read entire document azure documentdb read property may have multiple objects in it?

let's use basketball team object example:

{    id: 123,    name: "los angeles lakers",    coach: "byron scott",    players: [       { id: 24, name: "kobe bryant" },       { id: 3, name: "anthony brown" },       { id: 4, name: "ryan kelly" },    ] } 

if want list of players, more efficient/faster me read entire team document can extract players or better send sql statement , try read players document?

returning players more efficient on network, you're returning less data. and, should able @ request units burned query.

for example, put document 1 of collections , ran 2 queries in portal (and if same, , @ bottom of portal, you'll see resulting request unit cost). modified document unique id , quotes around everything, load via portal:

{    "id": "basketball123",    "name": "los angeles lakers",    "coach": "byron scott",    "players": [       { "id": 24, "name": "kobe bryant" },       { "id": 3, "name": "anthony brown" },       { "id": 4, "name": "ryan kelly" }    ] } 

i first selected player data:

select c.players c c.id="basketball123" 

with ru cost of 2.2:

ru of player data

i asked entire document:

select * c c.id="basketball123" 

with ru cost of 2.24:

ru of data

note: document size small, there's not difference here. @ least can see returning subset costs less returning entire document.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -