When submitting a feed via Amazon MWS API it returns a feed submission ID which is typed as string, while all the figures it returns seem to be of type int.
Question: is there a reason they have it as string and is it safe to always convert this value to int (I mean may I be sure they won’t add a letter to that ID like “123abc”).
Reason for the question: how to store the value in the database: char(), varchar() or int? I suppose we can expect this ID to have more length eventually, since the ID is incremented. Thus char() won’t work. Next, varchar(how_long?) – currently the ID is 10 chars long – add some extra room to it (say varchar(15))? Or maybe just use int – will be faster in search and accommodate the ID until it grows to a bigint (if ever), or just make it bigint and final?
This is the dilemma.
I would not convert this value to an
intunless you plan on using it mathematically.You can never be sure of this. This is an identifier and it is completely possible that they will start adding non-numeric characters to it in the future.
I am not a database expert so I can not really advise you as to what the best types are for certain scenarios. One thing that will hold true is that you will not be able to tell which is faster or more efficient until you benchmark your application.
My recommendation is to store the value as a
varchar(25)which will give you plenty of space for the future. I would also advise you to focus more on the maintainability of your application than on the performance or efficiency.