Click here to Skip to main content
15,901,505 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
GeneralRe: Unrelated data layer question. Pin
dojohansen11-Feb-08 8:10
dojohansen11-Feb-08 8:10 
GeneralRe: Unrelated data layer question. Pin
dojohansen11-Feb-08 8:04
dojohansen11-Feb-08 8:04 
GeneralDAL Design Question Pin
Waleed Eissa24-Jan-08 2:42
Waleed Eissa24-Jan-08 2:42 
GeneralRe: DAL Design Question Pin
Mark Churchill25-Jan-08 4:24
Mark Churchill25-Jan-08 4:24 
GeneralRe: DAL Design Question Pin
led mike25-Jan-08 4:40
led mike25-Jan-08 4:40 
GeneralRe: DAL Design Question Pin
Mark Churchill25-Jan-08 4:55
Mark Churchill25-Jan-08 4:55 
GeneralRe: DAL Design Question Pin
Waleed Eissa27-Jan-08 3:16
Waleed Eissa27-Jan-08 3:16 
GeneralRe: DAL Design Question Pin
Mark Churchill27-Jan-08 5:19
Mark Churchill27-Jan-08 5:19 
I wrote:
You can send multiple queries and get multiple responses in one round trip.


This was in reference to "...which I'm highly considering but a little concerned about how to execute multiple SQL statements..." - this isn't anything to worry about. A query isn't restricted to multiple statements - so you can send "select foo; select baz" in one ExecuteDataSet() and get back a DataSet containing multiple DataTables.

I wrote:
The stored procedures aren't giving you any benefit here - its just creating noise.


The stored procedures were just performing basic CRUD operations. SQL server will cache the execution plan for your ad-hoc queries anyway. For a simplistic view, stored procedures are for providing abstraction/code reuse rather than performance (some would also say they help with security).

Waleed Eissa wrote:
I'm a little lost here, what exactly do you mean by inheritance here?


A thread is basically a post that also has some extra information, like a title, a group it belongs in, etc. Say your database structure has a table, Product (Id, Description) and ServiceProduct(Id, CostPerHour) with ServiceProduct.Id being a foreign key to Product.Id. This defines that for every set of ServiceProduct data there is Product data, meaning ServiceProduct inherits Product, which is pretty analogous to how inheritance relationships work in code. This can be handy.

Using a ParentPostId field makes it difficult to pull a whole thread out the database. Given a parent post I would have to do an index scan to get the 2nd post, then again to get the 3rd, etc.

Say you have this setup:
Post (Id, Author, BodyText, TimePosted, ParentThreadId) and Thread (Id, Title, GroupId)
Thread.Id is a fk to Post.Id (inheritance)
Post.ParentThreadId is a fk to Thread.Id (reference)

This means that I can easily select threads in a group (Thread by GroupId), Posts in a Thread (Post by ParentThread).

If you are feeling uncomfortable with the inheritance relationship, then you could just have a Thread table that acts as a bit of a stub to group posts.

It might be worth having a look at how forums like phpbb handle their database structure (considering I'm coming up with this on the fly).

I'm not comfortable with the LastUsedId. It seems incredibly unlikely you would approach the 4 billion odd posts that just an int would provide. SQL Server could handle that kind of indexing using the processor in my phone - you'd be out of disk before you ran out of primary keys - and if you need to partition, just move everything out by GroupId - having holes in your index isn't an issue.

Insert performance isn't an issue for you - your users are reading and searching much more than they are posting. The more indexes the better - every millisecond you spend updating an index is going to save you a hundred of net lookup time Wink | ;)


GeneralRe: DAL Design Question Pin
Waleed Eissa1-Feb-08 18:58
Waleed Eissa1-Feb-08 18:58 
GeneralRe: DAL Design Question Pin
Ashfield30-Jan-08 4:24
Ashfield30-Jan-08 4:24 
QuestionBeta Testing? Develop Tech? Pin
Chrispie12323-Jan-08 19:00
Chrispie12323-Jan-08 19:00 
AnswerRe: Beta Testing? Develop Tech? Pin
Paul Conrad25-Jan-08 15:56
professionalPaul Conrad25-Jan-08 15:56 
GeneralVisual Studio 2005 collaboration Pin
Mike Nelson22-Jan-08 1:47
Mike Nelson22-Jan-08 1:47 
GeneralRe: Visual Studio 2005 collaboration Pin
led mike22-Jan-08 4:59
led mike22-Jan-08 4:59 
GeneralRe: Visual Studio 2005 collaboration Pin
Mike Nelson22-Jan-08 7:49
Mike Nelson22-Jan-08 7:49 
GeneralRe: Visual Studio 2005 collaboration Pin
led mike22-Jan-08 7:58
led mike22-Jan-08 7:58 
GeneralRe: Visual Studio 2005 collaboration Pin
Mike Nelson28-Jan-08 2:55
Mike Nelson28-Jan-08 2:55 
GeneralRe: Visual Studio 2005 collaboration Pin
led mike28-Jan-08 5:58
led mike28-Jan-08 5:58 
GeneralRe: Visual Studio 2005 collaboration Pin
Mike Nelson28-Jan-08 7:41
Mike Nelson28-Jan-08 7:41 
GeneralRe: Visual Studio 2005 collaboration Pin
led mike28-Jan-08 8:42
led mike28-Jan-08 8:42 
GeneralRe: Visual Studio 2005 collaboration Pin
Mike Nelson28-Jan-08 9:34
Mike Nelson28-Jan-08 9:34 
GeneralRe: Visual Studio 2005 collaboration Pin
led mike28-Jan-08 9:51
led mike28-Jan-08 9:51 
GeneralRe: Visual Studio 2005 collaboration Pin
Mike Nelson29-Jan-08 2:15
Mike Nelson29-Jan-08 2:15 
GeneralFree tool for UML Pin
mhmo21-Jan-08 2:42
mhmo21-Jan-08 2:42 
AnswerRe: Free tool for UML Pin
martinig29-Jan-08 6:46
martinig29-Jan-08 6:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.