php - looping through json from mysql or xcode -
my app asks customers features of car want rent goes database , search , come findings , number of available cars based on loop.
i'm wondering method right implement in ios app. in api created there index
function return cars in database in json style.
the question is: should create function in api takes parameters app , loop in database , return result customers?
or
should app index json , loop swift?
the json index
[ { "id": 1, "created_at": "2016-11-13 12:06:02", "updated_at": "2016-11-13 12:06:02", "name": “r”, "age": “12y”, “plate#”: “43ytr”, "status": "request", "appearance": "ok", “made”: “usa” }, { "id": 1, "created_at": "2016-11-13 12:06:02", "updated_at": "2016-11-13 12:06:02", "name": “h_y”, "age": “4yt", “plate#”: “11112jk”, "status": “coming”, "appearance": "ok", “made”: “korea” }, ]
your question is:
should create function in api takes parameters app , loop in database , return result customers or should app index json , loop swift?
there no 1 answer depends on expected size of complete data set (json), expected size of result, number of concurrent users, , how database designed in terms of indexes.
if json relatively small, or average result size significant percentage of whole dataset, second options seems fine. once overall data size becomes important while result size expected limited, become more beneficial let database work, , go first option.
this lead less client-server traffic, , also, database engines @ responding data queries use of indexes , caching mechanisms. hard beat second option.
Comments
Post a Comment