vivekshah
April 12th, 2006, 02:26 AM
Hello friends
I have oen case that 'n' people access the same database simultaneously.
& as a result the accessing the database becomes slow.
what solution can be provided to slove the problem.
kirants
April 12th, 2006, 02:52 PM
What kind of database is it ?
Normally, in a server setup ( like ORACLE/SQL SERVER), one would offload the querying etc to stored procedures. This is faster than executing individual queries.
Otherwise, it is tough to say what could be done without having more details on the type of database, the kind of application , the threading model etc.
BugHunter
April 24th, 2006, 06:13 PM
I have oen case that 'n' people access the same database simultaneously.
..it depends of 'n' :). And - of course - type of database.
usual practice - limitation of simultaneously connection to database. In SQL Server it can be done after connection. For example, in SQL Server 2000 you need to execute next query
SELECT COUNT(*) AS NumberOfConnections FROM master..sysprocesses
WHERE dbid IN
(
SELECT dbid FROM master..sysdatabases
WHERE name = 'your_database_name'
)
result of this query you can get via ADO, for example. If NumberOfConnections more than previously defined limit - server may close connection (or your client program close connection - it's not impotant)
It's one of simpliest methods.
More advanced method - working via intermediate level, which will controls number of queries, which will simultaneously executed in server. It can be, for example, NT-service, which will put on a waiting list users query and execute them as soon as it can be done.
I guess, my solvation of this problem would be a mixture of these methods.
And, of course - improve your server code ( stored procedures, indexes, triggers etc.) as you can. Also use only stored procedures everywhere, because server can optimize them to maximum (in contrast to single queries like showed earlier), because optimizer can use information about indexes, keys etc.
Very often it's quite enough; I don't think that your task is very striking.