Best way to achieve this use case?


#1

Hi All, I’m wondering what the best way to achieve this use case is:

So we currently have a relational MySQL DB which we want to migrate to Aerospike. So let’s say I have the following tables (for example):

Items, Devices, Countries, Users

What I want to do is now compact this if you like, so in Aerospike I have a record which contains a few bins of the Items data, and then the Devices, Countries and Users. At the moment I am considering writing those (which will be arrays) as JSON in bins in the record, so I will have something like this:

PK    Bin1    Bin2    Devices    Countries    Users
1     this    that    ["1","2"]  ["GB","US"]  ["1", "8"]

Now I’m wondering a couple of things really…

  1. Is there a limit to the amount of JSON (or the length of a string I guess) that a single bin can hold in Aerospike?
  2. Is JSON the best way to go about this?
  3. Would this be better done using LLIST format for the Devices, Countries etc?
  4. If I use LLIST - is there a way in the PHP client to be able to run a query to return $records … WHERE $myDevice IS IN LLIST 'Devices' kind of thing?
  5. Is LUA the best way to achieve this? In that should I be writing something which says ‘get all items for $thisDevice in $thisGeo’ - I’m not overly familiar with LUA but my initial thought is that this may be the best option.

Any other advice to try and achieve what I’m looking for?

Maybe this is one for @rbotzer and his vast knowledge of PHP / Aerospike :wink:

Thanks all…