database - performance issue while querying with comparison operator with limit on dynamodb -


i querying table has both hash , range key. while querying, putting limit on limit restricts number of returning items. understand, using comparison operators range_key__lt=12345 scans items less given range key , returns first n items of specified limit argument. in case have problem query performance not want scan items less range key. not exist there index on range keys? seems retrieves items on bucket belongs hash key. scans items less or greater value , returns of it. not understand how filter/search mechanism works on range keys.

is not question clear? think basic question related databases or dynamodb specifically. try explain in detail. when try retrieve item database, without indices created on specific column scans rows , compare if satisfies given condition. however, if there exist index on column b+ tree faster retrieve item since find direct address of row index table. problem that, have table on dynamodb has hash key (type not matter) , range key type of number. range key timestamp , query such row has nearest timestamp(date) current time. here querying this. r = test_table.query(hashkey__eq="abc", date__lt=1398099600, limit=1) . in table, 1000 items has "abc" hash key. first go bucket query , make range key search on these 1000 items. have 990 items has timestamp value lower 1398099600 . query sentence above written in python using boto module. however, works slow. have make same query on aws console , tooks time (there no limit condition on aws console retrieves items lower given timestamp normally). so, open log file in debug mode using logging module in python. in mode can see how many rows did dynamodb server scan result. saw scans items has timestamp lower given timestamp on dynamodb server. limit=1 restricts number of rows returned remote client, is, sends first row of scanned rows client. since scans many rows, gives throughput provision error also.

note: instead using less than, if use between comparator query runs faster. hence, can solve problem using datetime , avarage lower limit , use between operator query. don't know proper solution.

question that, there way retrieve item nearest date more efficient way, instead retrieving items less item?


Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -