database-design

The right way to manage user privileges (user hierarchy)

I want to allow users of my application to add sub-users and set privileges for what each sub-user is allowed to view or do. My ideas is to have a separate PRIVILEGES table, like this: +-----------------+--------+ |privilege | value | +-----------------+--------+ |create sub users | 1 | |edit own profile | 2 | |add ne...

What does Sharding means from Database Design Perspective ?

What is the concept of Sharding from Database Design perspecitve ? ...

What do databases excel at?

I'm trying to get my team to think about only asking the database to do things it can do really well. I believe that when they stop thinking of the DBMS as an omniscient, omnipotent being and start treating it as a useful--albeit dumb--tool, they can begin to approach optimization and database design with the right attitude. That got m...

What is loop based programming?

This isn't a joke. ;) I was working with a DBA to define a data model and he was pushing back against some of my suggestions by saying something like "well before we had 'loop based' programming" or "loop based data models" My suggestions, because we are working with Entity Framework, a model == table schema based ORM, were to simplif...

Implementing a Type-2 Slowly Changing Dimension in PostgreSQL

I am planning to implement a Type-2 SCD in PostgreSQL. The downside of SCDs is that you cannot have foreign keys referencing thos tables if used as is often seen. In other words, I often see referential integrity being dealt with within the application code. This strikes me as bad practice as it could be done directly within the database...

T-SQL Tag Database Architecture Design!?

Scenario I am building a database that contains a series of different tables. These consist of a COMMENTS table, a BLOGS table & an ARTICLES table. I want to be able to add new items to each table, and tag them with between 0 and 5 tags to help the user search for particular information that is relevant more easily. Initial thoughts fo...

Database Structure Advice Needed

Hey Guys, Im currently working on a site which will contain a products catalog. I am a little new to database design so I'm looking for advice on how best to do this. I am familiar with relational database design so I understand "many to many" or "one to many" etc (took a good db class in college). Here is an example of what an ite...

MySQL Column Unification, any performance improvements?

I'm designing a MySQL table for an authentication system for a high-traffic personal website. Every time a user comment, article, etc is displayed the following fields will be needed: login User Display User Bio ( A little signature ) Website Account YouTube Account Twitter Account Facebook Account Lastfm Account So everything is in ...

SQL-Server DB design time scenario (distributed or centralized)

We've an SQL Server DB design time scenario .. we've to store data about different Organizations in our database (i.e. like Customer, Vendor, Distributor, ...). All the diff organizations share the same type of information (almost) .. like Address details, etc... And they will be referred in other tables (i.e. linked via OrgId and we hav...

Handling data content security

So let's say that in your application you have to handle data content security, in such a way that application defines several "Entities" that have to be secured so that user cannot view, edit etc. certain code ranges. Let's say we have secured entities such as Location, Department, Division, ProductLine etc. and each user gets associat...

SQL Server to PostgreSQL - Migration and design concerns

Currently migrating from SQL Server to PostgreSQL and attempting to improve a couple of key areas on the way: I have an Articles table: CREATE TABLE [dbo].[Articles]( [server_ref] [int] NOT NULL, [article_ref] [int] NOT NULL, [article_title] [varchar](400) NOT NULL, [category_ref] [int] NOT NULL, [size] [bigint] NOT...

How to design and implement a wiki?

I want to implement a simple wiki. Most probably will be using Java on Google app engine. I have been searching around for sample design or how others have implemented it, what issues they faced, how they solved it etc. But most search queries turned out to be useless as Google gave links to wikis discussing about programming instead of ...

When to Create, When to Modify a Table?

I wanted to know, what should i consider while deciding if i should create a new table or modify an existing table for a sql db. i use both mysql and sqlite. -Edit- I always thought if i can put a column into a table where it makes sense and can be used by every row then i would always modify it. However at work if its a different 'rele...

Is there a benefit to storing street address data distinctly instead of just as a string?

Currently we store our address data like so: string suiteNumber (ie. unit number) string streetNumber (building number) string streetName string streetDirection (N/NW/S/etc.) string streetType (rd/st/ave/etc.) // ... etc. (postal code/city/province/state/country But I'm running into the (common from what I can tell) problem of pars...

Tool To Read SQL query and aggregate data relationships & fields.

I'm looking for a tool that can read multiple SQL queries and aggregate the data dependencies an relationships. For example if I have 20 queries that start with "Select * from employees" I'd expect to see the employees table weighted at the top. I imagine there has to be some data warehousing tool or other product out there to analy...

SQL Database Structure for Custom Categories

I am creating an online blog website and for each blog post, I'd like to have the user be able to create/edit/delete their own category so that they may categorize their post. What is generally considered a good database design for user generated categories? This is my proposed table design. (Is there a name for this type of db?) USE...

Storing a Windows SID in a Database for Lookup

I have an ASP.NET MVC application where I need to allow to customers configure MembershipProviders based on their environment, but still be able to map that MembershipUser to a concrete User model in our database. Membership.GetUser() will give me access to the logged-in user's Membership.ProviderUserKey. I can use this to relate to a U...

Guidance on modelling system with Nhibernate

Hi guys, I'm having issues trying to model a new system with nhibernate or even databases. I have lot of hardware which can be connected via IP or Serial Com Port (maybe more in the future). I want to be able to have different information depending on which one it is. I was thinking of a ConnectionInformation abstract class with Seria...

Surrogate key as a foreign key over composite keys

I realise there might be similar questions but I couldn't find one that was close enough for guidance. Given this spec, Site --------------------------- SiteID int identity Name varchar(50) Series --------------------- SiteID int SeriesCode varchar(6) ... --SeriesCode will be unique for every unique SiteID Episod...

Does varchar result in performance hit due to data fragmentation?

How are varchar columns handled internally by a database engine? For a column defined as char(100), the DBMS allocates 100 contiguous bytes on the disk. However for a column defined as varchar(100), that presumably isn't the case, since the whole point of varchar is to not allocate any more space than required to store the actual data va...