Syncing Database to Application (polling)












0















I have created a windows application that uses a MS SQL 2008 database server.



There are two types of the application:



1) Client Application
2) Host Application



The client application is able to send commands to the database that the host application polls and performs the command,
e.g. restart host server, restart host appliation, host check for application updates, host show debugs etc.



Once the host application picks up the command from the database the command is removed. The client application has a command task list that shows the outstanding tasks. Currently to keep this task list up-to-date (e.g. to remove tasks that have been completed) I have to query/poll the database every 3 seconds to get a refreshed dataset for the client application.



Is there a better way to poll the database, I am not sure querying the databse every 3 seconds is a good idea even if the query is very small.



Is there a way for the database to tell the application to refresh if a table is updated?



Thanks, Greg










share|improve this question














bumped to the homepage by Community 4 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • Sounds like you might want to look at BizTalk. microsoft.com/en-us/server-cloud/products/biztalk

    – Dave
    Oct 5 '15 at 17:20
















0















I have created a windows application that uses a MS SQL 2008 database server.



There are two types of the application:



1) Client Application
2) Host Application



The client application is able to send commands to the database that the host application polls and performs the command,
e.g. restart host server, restart host appliation, host check for application updates, host show debugs etc.



Once the host application picks up the command from the database the command is removed. The client application has a command task list that shows the outstanding tasks. Currently to keep this task list up-to-date (e.g. to remove tasks that have been completed) I have to query/poll the database every 3 seconds to get a refreshed dataset for the client application.



Is there a better way to poll the database, I am not sure querying the databse every 3 seconds is a good idea even if the query is very small.



Is there a way for the database to tell the application to refresh if a table is updated?



Thanks, Greg










share|improve this question














bumped to the homepage by Community 4 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • Sounds like you might want to look at BizTalk. microsoft.com/en-us/server-cloud/products/biztalk

    – Dave
    Oct 5 '15 at 17:20














0












0








0








I have created a windows application that uses a MS SQL 2008 database server.



There are two types of the application:



1) Client Application
2) Host Application



The client application is able to send commands to the database that the host application polls and performs the command,
e.g. restart host server, restart host appliation, host check for application updates, host show debugs etc.



Once the host application picks up the command from the database the command is removed. The client application has a command task list that shows the outstanding tasks. Currently to keep this task list up-to-date (e.g. to remove tasks that have been completed) I have to query/poll the database every 3 seconds to get a refreshed dataset for the client application.



Is there a better way to poll the database, I am not sure querying the databse every 3 seconds is a good idea even if the query is very small.



Is there a way for the database to tell the application to refresh if a table is updated?



Thanks, Greg










share|improve this question














I have created a windows application that uses a MS SQL 2008 database server.



There are two types of the application:



1) Client Application
2) Host Application



The client application is able to send commands to the database that the host application polls and performs the command,
e.g. restart host server, restart host appliation, host check for application updates, host show debugs etc.



Once the host application picks up the command from the database the command is removed. The client application has a command task list that shows the outstanding tasks. Currently to keep this task list up-to-date (e.g. to remove tasks that have been completed) I have to query/poll the database every 3 seconds to get a refreshed dataset for the client application.



Is there a better way to poll the database, I am not sure querying the databse every 3 seconds is a good idea even if the query is very small.



Is there a way for the database to tell the application to refresh if a table is updated?



Thanks, Greg







sql-server sql-server-2008






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Oct 5 '15 at 16:05









GregGreg

1




1





bumped to the homepage by Community 4 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 4 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Sounds like you might want to look at BizTalk. microsoft.com/en-us/server-cloud/products/biztalk

    – Dave
    Oct 5 '15 at 17:20



















  • Sounds like you might want to look at BizTalk. microsoft.com/en-us/server-cloud/products/biztalk

    – Dave
    Oct 5 '15 at 17:20

















Sounds like you might want to look at BizTalk. microsoft.com/en-us/server-cloud/products/biztalk

– Dave
Oct 5 '15 at 17:20





Sounds like you might want to look at BizTalk. microsoft.com/en-us/server-cloud/products/biztalk

– Dave
Oct 5 '15 at 17:20










1 Answer
1






active

oldest

votes


















0














Polling might be an appropriate design for what you're doing here. It lets you control and tell the user exactly how fresh/stale the state is though 3 seconds is probably too frequent. 15 seconds seems to be a common threshold used by a lot of commercial applications and with Microsoft's tools (E.g. performance monitor). Some of SQL Server's system threads waked up every 15 seconds also.



That said, you can consider using query notifications (https://technet.microsoft.com/en-us/library/ms175110(v=sql.100).aspx) if you want a way to notify the app when the data you care about has changed. Essentially, you tell SQL Server the query you want to track and when the results for that query changes, your app gets a message. It is a bit of work to implement but the concept and coding are relatively simple.






share|improve this answer
























  • Would this also allow me to update other clients applications that are connected to the database? For example if Client A sends an update to Host A, I would like: - Host A to collect the update - Connected Client A, B and C to see the update on their screen

    – Greg
    Oct 13 '15 at 11:25













  • That's up to your app. QN provides notification to the app that the data set you care about has changed. You can then decide to auto-refresh what users see or wait till the next request/refresh before showing new/changed data. Both have pros/cons. Auto-refresh always shows latest without user action but can end up being unusable if the data is volatile. Waiting for next request/refresh from user can result in using stale data. A very common compromise is to notify the user data has changed and provide a "click here to refresh" button.

    – SQLmojoe
    Oct 20 '15 at 3:30











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "182"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f117046%2fsyncing-database-to-application-polling%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Polling might be an appropriate design for what you're doing here. It lets you control and tell the user exactly how fresh/stale the state is though 3 seconds is probably too frequent. 15 seconds seems to be a common threshold used by a lot of commercial applications and with Microsoft's tools (E.g. performance monitor). Some of SQL Server's system threads waked up every 15 seconds also.



That said, you can consider using query notifications (https://technet.microsoft.com/en-us/library/ms175110(v=sql.100).aspx) if you want a way to notify the app when the data you care about has changed. Essentially, you tell SQL Server the query you want to track and when the results for that query changes, your app gets a message. It is a bit of work to implement but the concept and coding are relatively simple.






share|improve this answer
























  • Would this also allow me to update other clients applications that are connected to the database? For example if Client A sends an update to Host A, I would like: - Host A to collect the update - Connected Client A, B and C to see the update on their screen

    – Greg
    Oct 13 '15 at 11:25













  • That's up to your app. QN provides notification to the app that the data set you care about has changed. You can then decide to auto-refresh what users see or wait till the next request/refresh before showing new/changed data. Both have pros/cons. Auto-refresh always shows latest without user action but can end up being unusable if the data is volatile. Waiting for next request/refresh from user can result in using stale data. A very common compromise is to notify the user data has changed and provide a "click here to refresh" button.

    – SQLmojoe
    Oct 20 '15 at 3:30
















0














Polling might be an appropriate design for what you're doing here. It lets you control and tell the user exactly how fresh/stale the state is though 3 seconds is probably too frequent. 15 seconds seems to be a common threshold used by a lot of commercial applications and with Microsoft's tools (E.g. performance monitor). Some of SQL Server's system threads waked up every 15 seconds also.



That said, you can consider using query notifications (https://technet.microsoft.com/en-us/library/ms175110(v=sql.100).aspx) if you want a way to notify the app when the data you care about has changed. Essentially, you tell SQL Server the query you want to track and when the results for that query changes, your app gets a message. It is a bit of work to implement but the concept and coding are relatively simple.






share|improve this answer
























  • Would this also allow me to update other clients applications that are connected to the database? For example if Client A sends an update to Host A, I would like: - Host A to collect the update - Connected Client A, B and C to see the update on their screen

    – Greg
    Oct 13 '15 at 11:25













  • That's up to your app. QN provides notification to the app that the data set you care about has changed. You can then decide to auto-refresh what users see or wait till the next request/refresh before showing new/changed data. Both have pros/cons. Auto-refresh always shows latest without user action but can end up being unusable if the data is volatile. Waiting for next request/refresh from user can result in using stale data. A very common compromise is to notify the user data has changed and provide a "click here to refresh" button.

    – SQLmojoe
    Oct 20 '15 at 3:30














0












0








0







Polling might be an appropriate design for what you're doing here. It lets you control and tell the user exactly how fresh/stale the state is though 3 seconds is probably too frequent. 15 seconds seems to be a common threshold used by a lot of commercial applications and with Microsoft's tools (E.g. performance monitor). Some of SQL Server's system threads waked up every 15 seconds also.



That said, you can consider using query notifications (https://technet.microsoft.com/en-us/library/ms175110(v=sql.100).aspx) if you want a way to notify the app when the data you care about has changed. Essentially, you tell SQL Server the query you want to track and when the results for that query changes, your app gets a message. It is a bit of work to implement but the concept and coding are relatively simple.






share|improve this answer













Polling might be an appropriate design for what you're doing here. It lets you control and tell the user exactly how fresh/stale the state is though 3 seconds is probably too frequent. 15 seconds seems to be a common threshold used by a lot of commercial applications and with Microsoft's tools (E.g. performance monitor). Some of SQL Server's system threads waked up every 15 seconds also.



That said, you can consider using query notifications (https://technet.microsoft.com/en-us/library/ms175110(v=sql.100).aspx) if you want a way to notify the app when the data you care about has changed. Essentially, you tell SQL Server the query you want to track and when the results for that query changes, your app gets a message. It is a bit of work to implement but the concept and coding are relatively simple.







share|improve this answer












share|improve this answer



share|improve this answer










answered Oct 5 '15 at 17:35









SQLmojoeSQLmojoe

1,32037




1,32037













  • Would this also allow me to update other clients applications that are connected to the database? For example if Client A sends an update to Host A, I would like: - Host A to collect the update - Connected Client A, B and C to see the update on their screen

    – Greg
    Oct 13 '15 at 11:25













  • That's up to your app. QN provides notification to the app that the data set you care about has changed. You can then decide to auto-refresh what users see or wait till the next request/refresh before showing new/changed data. Both have pros/cons. Auto-refresh always shows latest without user action but can end up being unusable if the data is volatile. Waiting for next request/refresh from user can result in using stale data. A very common compromise is to notify the user data has changed and provide a "click here to refresh" button.

    – SQLmojoe
    Oct 20 '15 at 3:30



















  • Would this also allow me to update other clients applications that are connected to the database? For example if Client A sends an update to Host A, I would like: - Host A to collect the update - Connected Client A, B and C to see the update on their screen

    – Greg
    Oct 13 '15 at 11:25













  • That's up to your app. QN provides notification to the app that the data set you care about has changed. You can then decide to auto-refresh what users see or wait till the next request/refresh before showing new/changed data. Both have pros/cons. Auto-refresh always shows latest without user action but can end up being unusable if the data is volatile. Waiting for next request/refresh from user can result in using stale data. A very common compromise is to notify the user data has changed and provide a "click here to refresh" button.

    – SQLmojoe
    Oct 20 '15 at 3:30

















Would this also allow me to update other clients applications that are connected to the database? For example if Client A sends an update to Host A, I would like: - Host A to collect the update - Connected Client A, B and C to see the update on their screen

– Greg
Oct 13 '15 at 11:25







Would this also allow me to update other clients applications that are connected to the database? For example if Client A sends an update to Host A, I would like: - Host A to collect the update - Connected Client A, B and C to see the update on their screen

– Greg
Oct 13 '15 at 11:25















That's up to your app. QN provides notification to the app that the data set you care about has changed. You can then decide to auto-refresh what users see or wait till the next request/refresh before showing new/changed data. Both have pros/cons. Auto-refresh always shows latest without user action but can end up being unusable if the data is volatile. Waiting for next request/refresh from user can result in using stale data. A very common compromise is to notify the user data has changed and provide a "click here to refresh" button.

– SQLmojoe
Oct 20 '15 at 3:30





That's up to your app. QN provides notification to the app that the data set you care about has changed. You can then decide to auto-refresh what users see or wait till the next request/refresh before showing new/changed data. Both have pros/cons. Auto-refresh always shows latest without user action but can end up being unusable if the data is volatile. Waiting for next request/refresh from user can result in using stale data. A very common compromise is to notify the user data has changed and provide a "click here to refresh" button.

– SQLmojoe
Oct 20 '15 at 3:30


















draft saved

draft discarded




















































Thanks for contributing an answer to Database Administrators Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f117046%2fsyncing-database-to-application-polling%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Liste der Baudenkmale in Friedland (Mecklenburg)

Single-Malt-Whisky

Czorneboh