If I have let say 500 000 records and needs to search for a specific playerId in a json document using soda and REST is there a difference in performance and resource usage between how complex a json document is? ...what should I think about when designing this?
Here is two examples of json documents that I would like to compare searching for the playerId. If I use #1 I do not need to create #2 but I worry of performance and resource usage. I currently test on Always Free ORDS.
#1:
{
"totClicks": 12,
"playerCreationDate": "2024-06-22 10:23:40",
"playerId": "bIEkjklaiUxxxxkHNX6Uq6g86J4N",
"isSignedIn": true,
"nrOfMultiplayerMatches": 0,
"nrNotCompletedMultiplayerMatches": 0,
"totSwappedTriplets": 0,
"totMultiMatchTimeSec": 0,
"totSwappedQuadruplets": 0,
"playerNameHash": "Maria K#2631",
"nrNotCompletedSingleplayerMatches": 0,
"singleMatchesScore": 0,
"lastLogin": "2024-06-22 10:23:40",
"speedPlayerLvl": 0,
"scoreSpeedSinglePlayerMatch": 0,
"nrOfSpeedSinglePlayerMatches": 0,
"isLinked": true,
"singleMatchStats_List": [
"(0)S_0(1)bIEkjklaiUxxxxkHNX6Uq6g86J4N(2)0(3)0(4)0(5)0(6)8(7)6/22/2024 10:24:37 AM(8)60(9)34.35301(10)True(11)False(12)False(13)True(14)12(15)4(16)0(17)0(18)False(19)0(20)0"
],
"dbJsonId": "D10F90144EE54864AABEBC1F6E0FA3D8",
"totSingleMatchTime": "00:00:34.3530000",
"isOpenForAnonymousMatches": false,
"playerLvl": 0,
"nrEvenMultiplayerMatches": 0,
"isUpdated2Db": true,
"nrLostMultiplayerMatches": 0,
"playerName": "Maria K",
"hasDoneTutorial": true,
"playerNameFacebook": null,
"isOfflineLogin": false,
"nrWonMultiplayerMatches": 0,
"nrOfLogins": 2,
"isAnonymousLogin": false,
"nrOfflineLogins": 0,
"multiplayerMatchStats_List": null,
"totSwappedPairs": 4,
"nrOfSingleMatches": 1,
"isFacebookLogin": false,
"isUnityLogin": true
}
#2:
{
"playerId": "bIEQZDEqKb6fDs7HNX6Uq6g86J4N",
"playerName": "Mexitegel",
"startTime": "2024-07-03T10:22:32.5349026Z"
}
Your SODA or JSON requests should be treated as SQL statements - heavily used attributes, like table columns, should probably be indexed.
You can use the SQL tools for gathering execution plans to see the total cost and plan steps involved for returning your JSON objects and documents.
Adding an idea could reduce things like, logical reads.
Scenario and example ddl here
https://www.thatjeffsmith.com/archive/2021/07/json-creating-indexes-in-database-actions/