VB.Net live data to database


How would I go about making a live data stream to my database?
What I mean is something that keeps view on the database to monitor any changes immediately.
Im using VB.Net with MySQL server on an external database.

I know about doing the connections and commands, and parts of data reader.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Imran Javed ZiaConsultant Software Engineer - .NET ArchitectCommented:
There can be many ways, but two of then are:
1. Store the Stream on File in file system. And Add a entry in database to that path.
2. Store the Stream on temp File in file system. And when stream is completed save the file in database and delete the temp file.

I wouldn't do it that way. I'd store a record for each (user,notification) and mark each record as read or unread. You can then record when they read it, which might be important depending on your application (eg if you needed an audit trail of some kind).

100k records is not very big. Don't worry about size until you get to at least 10 million records. If necessary archive them at some point. But you should do some estimates on how quickly you'll generate 10 million records. If it's 3 days, then yeah you have a problem. If it's 3 years then you don't.

This option of course has the notification text in a separate table.

This should also scale extremely well with even higher number of messages as you select the unread messages for a user (indexed) and can either join to get the notification text (if your table is in the tens of millions of records size) or select them and then separately select the messages.

Partitioning the (user,notification) table is easy: you base it on user ranges.

And when users delete messages, generally you should just mark it as deleted rather than actually deleting it. Most of the time there's not much reason to delete anything in a database.



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Alternatively, you could store a set of references to the notes which have yet to be read on a per-user-profile basis, and then remove them when they're displayed (general use case is probably read all notes at once). This way you only have a tiny query when you pull an individual user, and your cost is in the insertion time for the global message, rather than filtering a big unread message table.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.