Inserting and viewing data simultaneously from a s

2019-09-11 12:54发布

I want that as a user is inserting data into a table, he is also viewing it simultaneously.

For this if I use a single table, then will it take more time & processing load because the 2 processes: INSERT and SELECT, both would occur on the same table?

So I want that both the processes are executed separately on two different database objects.

Like INSERT should be done on one database object and SELECT should be done from the other but the data which in inserted, would be seen by the Select query.

What's the solution for this? Should I use a temporary table, a view, or two separate tables, but if I use two separate tables then there would be replication of data.

so what shall i do? please help.

My Winform Application would run on 3 PCs on LAN and SQL Server only on one PC.

In this case, every minute all 3 users would insert data . So I would display data immediately to the user at pc1 if data is updated by another user on pc2

1条回答
Rolldiameter
2楼-- · 2019-09-11 13:22

Have you actually tried just reading and writing on the same table? RDBMS are designed for concurrency. We have millions of rows written per minute and dozens of complex aggregates on the same data in the same minute. We havn't noticed any issue.

Data has to get from tablewrite to tableread: this means a read on tablewrite at some point. Now, you can maintain this in a trigger (or some such means) which means extra processing for every write.

Note: you can use the OUTPUT clause to read data that has just been inserted.

You can also try snapshot isolation but given you don't have a problem why not keep it simple and just use the one table

查看更多
登录 后发表回答