1

I'm new to databases. I've been saving a financials table from a website in JSON format on a daily basis, accumulating new files in my directory every day. I simply parse the contents into a C# collection for use in my program and compare data via Linq.

Obviously I'm looking for a more efficient solution especially as my file collection will grow over time.

An example of a row of the table is:

    {"strike":"5500","type":"Call","open":"-","high":"9.19B","low":"8.17A","last":"9.03B","change":"+.33","settle":"8.93","volume":"0","openInterest":"1,231"}

I'd prefer to keep a 'compact file' per stock that I can access individually as opposed to a large database with many stocks. What would be an 'advisable' solution to use? I know that's a bit of an open ended question but some suggestions would be great.

I don't mind slower writing into the DB but a fast read would be beneficial.

What would be the best way to store the data? Strings or numerical values?

I found this link to help with the conversion How to Save JSON data to SQL server database in C#?

Thank you.

1 Answer 1

0

For a faster reading in a DB, I would suggest denormalization of the data.

Read "Normalization vs Denormalization"

Judging from your JSON file, it doesn't seems like you have any table joins. Keeping that structure should be fine.

For the comparison between varchar(string) and int(numeric), int are faster than varchar, for the simple fact that ints take up much less space than varchars. int takes up 2-8 bytes where varchar takes up 4 bytes plus the actual characters.

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you Charlie. Do you think SQLite would suit my purpose?
Yes, SQLite would have a better performance. But then there are some limitiation on it compared to SQL server.
@CharlieAngriawan why did you mention the bit about table joins when using sqlite?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.