At what point is data access overhead too high? RRS feed

  • Question

  • This is a performance/design topic. I have a table tracking Web Directory listings. The table has 40 fields. I've created a custom Class in VBA to represent it and am wondering how I should best use the Get Properties now that I'm adding new functionality to the class.

    Currently, the class does not persist the data back to the SQL Server. I now need it to. When the class is Initialized, it accepts a single primary key, opens the database, and sets all the 40 values from the database in member variables in the class. This is a problem now, because the class stays in memory for a while and is going to now persist changes to these fields back to the database at different times in its life, which means that the original values gathered during initialization will be wrong.

    I'm debating 2 different ways to keep the values correct in the class. 1 is have the Get properties just ask the database each time the code calls the property, or 2 have the Set Properties that will now persist the data also change the member variables holding the original data gathered during initialization.

    The second sounds like alot of code to maintain. The first sounds like it could be a performance hit to the client app. I've never done this before, so just wondering what people think. I am leaning towards the first option, but wonder when does calling the database for a single value become too taxing?

    Thanks for the input!
    Thursday, March 17, 2016 2:17 PM