database performance question

This is a discussion on database performance question within the C# Programming forums, part of the General Programming Boards category; Hi all, I have a question as to whether a database will be able to 'handle' a piece of code ...

  1. #1
    Registered User
    Join Date
    Nov 2007
    Location
    Brisbane, Australia
    Posts
    7

    database performance question

    Hi all,

    I have a question as to whether a database will be able to 'handle' a piece of code (it is a MySQL database i.e. client-server model). The pseudocode:

    Code:
        foreach client
            update database with client details;
    So, as it iterates through the clients, a simple UPDATE command is executed for each client. My question is, will there be any performance issue with this? Does the database need any kind of break in time between each UPDATE command, or can it handle being bombarded with the UPDATE statements at the high speed of the foreach loop?

    My guess is that it can handle it, but I need to be sure and I don't have enough sample data to really test it. I am hoping this is an obvious question which someone can easily confirm, based on their experience.

  2. #2
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,236
    I am new to database. But as I understood there is copy of database in memory that can be updated rapidly but this image should be saved evently. Read MSDN.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  3. #3
    Registered User
    Join Date
    Nov 2007
    Location
    Brisbane, Australia
    Posts
    7
    Sorry, I should have mentioned, I am using the disconnected architecture (i.e. IDBCommand). That being the case, there is no DataTable in memory.

    It is just a rapid-fire update of the database with a fresh connection and command established in each iteration of the loop.

  4. #4
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    All database operations are synchronous unless explicitly told to be asynchronous in the connection string, so you should have no problems with that code. The first UPDATE will finish before the next is done. Sure, some caching stuff can prevent the data from being physically written immediately but as far as the user (you) is concerned the semantics will remain the same.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  5. #5
    Registered User
    Join Date
    Nov 2007
    Location
    Brisbane, Australia
    Posts
    7
    Great. That is exactly the answer that I was looking (and hoping) for. I did not want to have to put the thread to sleep each time to give the database time to update, and I don't know anything about caching (yet).

    Thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Creating a database
    By Shamino in forum Game Programming
    Replies: 19
    Last Post: 06-10-2007, 02:09 PM
  2. I need help to compile this code...
    By wise_ron in forum C Programming
    Replies: 17
    Last Post: 05-07-2006, 01:22 PM
  3. Database Application VC++ or vb6..?
    By gardenair in forum C Programming
    Replies: 0
    Last Post: 04-13-2003, 11:06 PM
  4. Making a Simple Database System
    By Speedy5 in forum C++ Programming
    Replies: 1
    Last Post: 03-14-2003, 10:17 PM
  5. File Database & Data Structure :: C++
    By kuphryn in forum C++ Programming
    Replies: 0
    Last Post: 02-24-2002, 11:47 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21