DynamoDB : How to query multiple partition key ordered by sort key on GSIWhich hash key is best for event data in DynamoDB?Is Composite Primary Key in DynamoDB for QueryAWS Dynamodb: Is it possible to make a query only using sort keyOrder in which data is stored for same GSI values in a DynamoDB table which does not have a range key over GSIDynamoDB selecting by date GSI write unitsDynamoDB partition key choice for notes appHow to use GSI in dynamodb?DynamoDB: Best hash/sort keys for my use case [confusion with AppSync/GraphQL]DynamoDB equivalent to find().sort()DynamoDB Not Sorting by Sort Key

How to laser-level close to a surface

Have the writers and actors of GOT responded to its poor reception?

Show that the characteristic polynomial is the same as the minimal polynomial

Why does the U.S military use mercenaries?

Was Tyrion always a poor strategist?

Number Sequence Series-Question 2

Merging two rows with rounding their first elemnts

Does the usage of mathematical symbols work differently in books than in theses?

Why does string strummed with finger sound different from the one strummed with pick?

Would it be fair to use 1d30 (instead of rolling 2d20 and taking the higher die) for advantage rolls?

Parse a C++14 integer literal

At what point can a confirmation be established between words of similar meaning in context?

Managing heat dissipation in a magic wand

Is there any deeper thematic meaning to the white horse that Arya finds in The Bells (S08E05)?

How to customize the pie chart background in PowerPoint?

Pedaling at different gear ratios on flat terrain: what's the point?

How do I balance a campaign consisting of four kobold PCs?

Would a "ring language" be possible?

How to say "that" as in "the cow that ate" in Japanese?

Is it a good idea to teach algorithm courses using pseudocode instead of a real programming language?

how to create an executable file for an AppleScript?

Have GoT's showrunners reacted to the poor reception of the final season?

Windows reverting changes made by Linux to FAT32 partion

Why do academics prefer Mac/Linux?



DynamoDB : How to query multiple partition key ordered by sort key on GSI


Which hash key is best for event data in DynamoDB?Is Composite Primary Key in DynamoDB for QueryAWS Dynamodb: Is it possible to make a query only using sort keyOrder in which data is stored for same GSI values in a DynamoDB table which does not have a range key over GSIDynamoDB selecting by date GSI write unitsDynamoDB partition key choice for notes appHow to use GSI in dynamodb?DynamoDB: Best hash/sort keys for my use case [confusion with AppSync/GraphQL]DynamoDB equivalent to find().sort()DynamoDB Not Sorting by Sort Key






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I'm currently developing an Instagram clone using dynamoDB and appSync as back-end.



Im currently working on the user's feed page. I need to query all posts by the user and the users he follows ordered by timestamp.



I created a GSI with userId as partition key and timestamp as sort key.



I tried:



  • "Query" on GSI, but it allow only one partition key

  • "Scan" on the GSI then filter on userId, but it doesn't order posts by timestamp

  • "BatchGet", but it doesn't order posts by timestamp, and the result is not flatten

Post Attributes:




type:"POST",
id:"post1",
timeStamp:"213213123",
img_url: "https://img.com/img.jpg",
userComment:"nice pic",
userId:"user1",
userName:"kevin",
numberOfComment:"0",
numberOfLike:"0



User attribute:




type:"USER",
id:"user1",
userName:"Kevin",
FollowerCount:0,
FollowCount:0,
PostCount:1,
bio:"bio"



Is there another solution?



edit: my dynamodbTable



my dynamoDb Table










share|improve this question
























  • How many tables you have. 2 ? u probably need to add your table details.

    – syadav
    Mar 23 at 18:41






  • 1





    Worth reading the blog post at aws.amazon.com/blogs/database/…, particularly the chat message app example.

    – jarmod
    Mar 23 at 20:02











  • I have only one Table. I can fetch all posts by userId with by querying the userId-timeStamp-index

    – Riki Chou
    Mar 23 at 20:05

















0















I'm currently developing an Instagram clone using dynamoDB and appSync as back-end.



Im currently working on the user's feed page. I need to query all posts by the user and the users he follows ordered by timestamp.



I created a GSI with userId as partition key and timestamp as sort key.



I tried:



  • "Query" on GSI, but it allow only one partition key

  • "Scan" on the GSI then filter on userId, but it doesn't order posts by timestamp

  • "BatchGet", but it doesn't order posts by timestamp, and the result is not flatten

Post Attributes:




type:"POST",
id:"post1",
timeStamp:"213213123",
img_url: "https://img.com/img.jpg",
userComment:"nice pic",
userId:"user1",
userName:"kevin",
numberOfComment:"0",
numberOfLike:"0



User attribute:




type:"USER",
id:"user1",
userName:"Kevin",
FollowerCount:0,
FollowCount:0,
PostCount:1,
bio:"bio"



Is there another solution?



edit: my dynamodbTable



my dynamoDb Table










share|improve this question
























  • How many tables you have. 2 ? u probably need to add your table details.

    – syadav
    Mar 23 at 18:41






  • 1





    Worth reading the blog post at aws.amazon.com/blogs/database/…, particularly the chat message app example.

    – jarmod
    Mar 23 at 20:02











  • I have only one Table. I can fetch all posts by userId with by querying the userId-timeStamp-index

    – Riki Chou
    Mar 23 at 20:05













0












0








0








I'm currently developing an Instagram clone using dynamoDB and appSync as back-end.



Im currently working on the user's feed page. I need to query all posts by the user and the users he follows ordered by timestamp.



I created a GSI with userId as partition key and timestamp as sort key.



I tried:



  • "Query" on GSI, but it allow only one partition key

  • "Scan" on the GSI then filter on userId, but it doesn't order posts by timestamp

  • "BatchGet", but it doesn't order posts by timestamp, and the result is not flatten

Post Attributes:




type:"POST",
id:"post1",
timeStamp:"213213123",
img_url: "https://img.com/img.jpg",
userComment:"nice pic",
userId:"user1",
userName:"kevin",
numberOfComment:"0",
numberOfLike:"0



User attribute:




type:"USER",
id:"user1",
userName:"Kevin",
FollowerCount:0,
FollowCount:0,
PostCount:1,
bio:"bio"



Is there another solution?



edit: my dynamodbTable



my dynamoDb Table










share|improve this question
















I'm currently developing an Instagram clone using dynamoDB and appSync as back-end.



Im currently working on the user's feed page. I need to query all posts by the user and the users he follows ordered by timestamp.



I created a GSI with userId as partition key and timestamp as sort key.



I tried:



  • "Query" on GSI, but it allow only one partition key

  • "Scan" on the GSI then filter on userId, but it doesn't order posts by timestamp

  • "BatchGet", but it doesn't order posts by timestamp, and the result is not flatten

Post Attributes:




type:"POST",
id:"post1",
timeStamp:"213213123",
img_url: "https://img.com/img.jpg",
userComment:"nice pic",
userId:"user1",
userName:"kevin",
numberOfComment:"0",
numberOfLike:"0



User attribute:




type:"USER",
id:"user1",
userName:"Kevin",
FollowerCount:0,
FollowCount:0,
PostCount:1,
bio:"bio"



Is there another solution?



edit: my dynamodbTable



my dynamoDb Table







amazon-web-services nosql amazon-dynamodb graphql aws-appsync






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 23 at 19:56







Riki Chou

















asked Mar 23 at 17:35









Riki ChouRiki Chou

868




868












  • How many tables you have. 2 ? u probably need to add your table details.

    – syadav
    Mar 23 at 18:41






  • 1





    Worth reading the blog post at aws.amazon.com/blogs/database/…, particularly the chat message app example.

    – jarmod
    Mar 23 at 20:02











  • I have only one Table. I can fetch all posts by userId with by querying the userId-timeStamp-index

    – Riki Chou
    Mar 23 at 20:05

















  • How many tables you have. 2 ? u probably need to add your table details.

    – syadav
    Mar 23 at 18:41






  • 1





    Worth reading the blog post at aws.amazon.com/blogs/database/…, particularly the chat message app example.

    – jarmod
    Mar 23 at 20:02











  • I have only one Table. I can fetch all posts by userId with by querying the userId-timeStamp-index

    – Riki Chou
    Mar 23 at 20:05
















How many tables you have. 2 ? u probably need to add your table details.

– syadav
Mar 23 at 18:41





How many tables you have. 2 ? u probably need to add your table details.

– syadav
Mar 23 at 18:41




1




1





Worth reading the blog post at aws.amazon.com/blogs/database/…, particularly the chat message app example.

– jarmod
Mar 23 at 20:02





Worth reading the blog post at aws.amazon.com/blogs/database/…, particularly the chat message app example.

– jarmod
Mar 23 at 20:02













I have only one Table. I can fetch all posts by userId with by querying the userId-timeStamp-index

– Riki Chou
Mar 23 at 20:05





I have only one Table. I can fetch all posts by userId with by querying the userId-timeStamp-index

– Riki Chou
Mar 23 at 20:05












0






active

oldest

votes












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%2f55316529%2fdynamodb-how-to-query-multiple-partition-key-ordered-by-sort-key-on-gsi%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















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%2f55316529%2fdynamodb-how-to-query-multiple-partition-key-ordered-by-sort-key-on-gsi%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