views:

46

answers:

1

This is a followup/post question to another question; as I have discovered a solution that has led me to a new problem.

http://stackoverflow.com/questions/2802902/classes-to-entities-like-class-inheritence-problems

We're building this game system, so to speak; and I am using Table Per Concrete Type concept to perform inheritance modeling.

My concern is scalability and performance. I believe I have used a similar technique before and it came out pretty sluggish, but I am not a good DBA, I am a programmer. So I'm very foreign to how this will translate to SQL. But basically it seems to me that it would be slow and weak to have so many 'linked' queries running together. I've posted my schema and entity model for reference. If I can give clearer information, please ask, as I am really not certain what is relevant to 'tuning' this approach.

alt text

alt text

Sample use would be typical as follows;

static void Main(string[] args)
{
    DataContext db = new DataContext();

    Character character = new Character()
    {
        Name = "First",
        Ring = new Mapping.Ring()
    };


    character.Ring.Keys.Add(
        new Random()
        {
            Dice = 2,
            Sides = 30,
        });

    character.Ring.Keys.Add(
        new Measure()
        {
            Maximum = 100,
            Minimum = 0
        });
    character.Ring.Keys.Add(
        new Measure()
        {
            Maximum = 100,
            Minimum = 0
        });

    db.Characters.AddObject(character);
    db.SaveChanges();

    foreach (Character c in db.Characters)
    {
        Console.WriteLine(c.Name);

        Console.WriteLine(new string('-', 80));

        foreach (Measure k in c.Ring.Keys.OfType<Measure>())
            Console.WriteLine(String.Format("{0}/{1}", k.Minimum, k.Maximum));

        foreach (Random k in c.Ring.Keys.OfType<Random>())
            Console.WriteLine(String.Format("{0}d{1}", k.Dice, k.Sides));
    }

    Console.ReadLine();
}
+1  A: 

I think a lot of this is going to come down to how the database is tuned, the indexes you have on the tables and the scope of the data.

To truly "prove" a data model, I'm a big fan of filling the tables with a bunch of data, and query it, see what happens, that is the only real way for you to validate the performance, or lack thereof for an application.

Mitchel Sellers
Are there any good tools for measuring this sort of thing?
Stacey
SQL Profiler that is part of SQL Server is a good tool to start with.
Mitchel Sellers