0

I have data conversion and caching service running as self-hosted WCF service. Now it uses database polling in constant short intervals to update its data.

I think it's unnecessary. The data can be changed only if one of the tables is changed, and when the data is changed depends on system users actions.

There is no problem in setting a trigger for specific tables, however I would need an action outside SQL-Server to update my cache. My WCF service could perform update when receiving specific URI via HTTP. So all I need is a command in table trigger which would send a request. Is it even possible?

I think about a hack I used back in the days with HTTP requests. I halted HTTP request response at server until data packet from somewhere else arrived. There was no delay between polling requests. I achieved fully asynchronous, "real-time" updates.

Maybe this approach is possible to apply with SQL? I think about a query which blocks termination until receives a signal. Well, it eventually times out, but it's good enough to try. Then - how to signal and wait in SQL? By locking and unlocking shared resource, like cursor or dummy table?

Any other options?

I need the cache update done at lowest possible frequency (because it's pretty expensive, so once per minute is great), but I need immediate update when the data is changed.

2

1 Answer 1

1

To answer your question, have you looked at xp_cmdshell?

https://msdn.microsoft.com/en-us/library/ms175046.aspx

However, the security/performance implications of such a decision could be non-trivial depending on your use case.

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

Comments

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.