+ Start a Discussion

Database Design

I would like to know what is the better design for the database.  The application uses Visual Force pages to perform CRUD methods on a custom object and at least 8 related list objects.  Each record of the custom object has about 5-50 records in each of the related lists.  A majority of the time only a single custom object record and its related lists is queried.


1. Is it be better to create a single related list object with a field that specifies the related list type in lieu of the 8 related list objects?  In this case all the fields on each of the 8 related lists objects would be put in the single object.  However, many of these fields obviously would be null. 


2. Is there a performance difference between doing 8 queries and 1 query where the same number of records are returned in both cases?  In the case of the single query, the records would be filtered thru code to put them into appropriate lists and is the 8 query method more efficient?


3. Is there a performance difference when a query when 10 fields are returned in a query versus 100 fields are returned in a query?  The 100 field query would be filtered thru code to put them into appropriate lists.


4. Is there a storage taken up by fields that are null in an object?









It doesn't really make sense to try and second guess salesforce performance issues. What you need to think about is having a good. solid, logical application design so that users and future developers can understand, use and maintain it. 


From what you are saying it looks like your data logically fits into 8 objects. I would very strongly advise you to use 8 objects. It's salesforce's job to optimise for perfomance - your job is to write a nice logical application. (In any case, the performance differences you are asking about would be so miniscule that they are not worth giving any thought to whichever way round they might happen to be).







I have done that.  Thanks