Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / General DB Topics / General DB Topics / November 2004

Tip: Looking for answers? Try searching our database.

Simultaneously running processes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
AK - 19 Nov 2004 02:28 GMT
I have to come up a block that prevents ceratin tasks from running
simultaneously, for instance:

- if latest sales data is being loaded, no reports involving recent
sales should run, but it is OK to run any reports against historic
data.
- if the big boss needs some report ASAP, we are gonna let the
already running tasks finish up, but no new tasks should start until
thi big boss's task is completed

and so on

I also need a "what's going on" view, which tasks are running, which
could be started, which task are being prevented from starting and
why.

I'm thinking of something like this:

CREATE TABLE POSSIBLE_TASK(
TASK_PK NOT NULL PRIMARY KEY,
TASK_DESCRIPTION
);

CREATE TABLE RUNNING_OR_BLOCKED_TASK(
TASK_PK NOT NULL PRIMARY KEY,
IS_RUNNING NOT NULL, /* 1 - RUNNING, 0 - BLOCKED FROM RUNNING*/
BLOCKED_BY NOT NULL FOREIGN KEY REFERENCES POSSIBLE_TASK(TASK_PK),
INSERTED_TIME DATE,
PROCESS_ID
);

then I would be inserting one or more rows, for example, starting to
load recent sales:

INSERT INTO RUNNING_OR_BLOCKED_TASK
SELECT
TASK_PK,
CASE WHEN TASK_PK = 'LOAD RECENT SALES' THEN 1 ELSE 0 END,
'LOAD RECENT SALES'
FROM POSSIBLE_TASK WHERE TASK_ID LIKE '%RECENT SALES%'

or for CEO's report:

INSERT INTO RUNNING_OR_BLOCKED_TASK
SELECT
TASK_PK,
CASE WHEN TASK_PK = 'REPORT FOR CEO' THEN 1 ELSE 0 END,
'REPORT FOR CEO'
FROM POSSIBLE_TASK WHERE TASK_ID NOT IN(SELECT TASK_ID FROM
RUNNING_OR_BLOCKED_TASK)

I don't care about concurrency related issues here, only one process
is ever modifying RUNNING_OR_BLOCKED_TASK

I'd appreciate any suggestions
Alan - 19 Nov 2004 05:31 GMT
> I have to come up a block that prevents ceratin tasks from running
> simultaneously, for instance:
[quoted text clipped - 51 lines]
>
> I'd appreciate any suggestions

You must provide the RDBMS that you are using. In Oracle, for example, there
is no problem at all.
AK - 19 Nov 2004 19:37 GMT
> You must provide the RDBMS that you are using. In Oracle, for example, there
> is no problem at all.

Oracle 9i. I know my implementation works, but I'm not quite sure the
suggested design is optimal. My question is about database design
rather than implementation, that's why it's posted in this group.
Thug Passion - 20 Nov 2004 01:26 GMT
> I also need a "what's going on" view, which tasks are running, which
> could be started, which task are being prevented from starting and
> why.

Why is a more involved question, and there are a lot of ways to answer
it, so I'll leave that to you.

It's not clear what database system you're using, but from the code it
looks more like SQL Server than Access.  ( Could be Oracle, Interbase,
DB/2, or whatever else, too. )  It also sounds like you're very
compotent, SQL-wise.

Your system might come with some of the functionality you need.  SQL
Server gives you a list of the running tasks, locks in the system, and
so on.  Access 2000+ will at least give you a list of connected users
and their lock ID ( usually machine ID ), which you might be able to
associate with physical locks if you dig deep enough.

Anyway, what I'm getting at is that if you develop a system to
authorize certain uses of the database, and to put other parts off
limits for bossman or routine maintanence ... will users respect a
"No!" message?  If your RDBMS software has these features already, you
can save yourself some time, and they might be more secure.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.