dynamo local - Whats the best way to query dynamodb based on date range? -


as part of migrating sql dynamodb trying create dynamodb table. ui allows users search based on 4 attributes start date, end date, name of event , source of event. table has 6 attributes , above 4 subset of other attributes being priority , location. query described above makes mandatory search based on above 4 values. whats best way store information in dynamodb me in querying based on start date , end date easy. thought of creating gsi hashkey startdate, rangekey end date , gsi on rest 2 attrributes ?

inshort: table in dynamodb have 6 attributes eventname, location, startdate, end date, priority , source.

query have 4 mandatory attributes startdate, enddate, source , event name.

thanks help.

you can use greater than/less comparison operators part of query http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/queryandscan.html

so try build table schema: (eventname (hashkey), "startdate-enddate" (sortkey), other attributes)

in case sort-key combination of start , end date allowing use >= (on first part) , <= (on second part)... dynamodb uses ascii based alphabetical ordering... lets assume sortkey looks following: "73644-75223" use >= "73000-" , <= "73000-76000" given event.

additionally, create gsi on table each of remaining attributes need read via query. project data index want fetch query. in contrast lsi, queries gsi not fetch attributes not projected. aware of additional costs (read/write) involved using gsi (and lsi)... , additional memory required data projections...

hope helps.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -