database-design

How would you structure your entity model for storing arbitrary key/value data with different data types?

I keep coming across scenarios where it will be useful to store a set of arbitrary data in a table using a per-row key/value model, rather than a rigid column/field model. The problem is, I want to store the values with their correct data type rather than converting everything to a string. This means I have to choose either a single tabl...

Modeling "optional" foreign key

Hi! I have 2 entities User UserCreditCard A user can have a credit card or not. How would you model the relation and why? Option 1: User has a foreign key to UserCreditCard that may be null Option 2: UserCreditCard has a foreign key to User that can't be null EDIT My mistake not remarking that user will have 0 or 1 credit cards, ...

How do you distinguish centralized and decentralized databases?

What is the difference between centralized and decentralized databases? ...

What database design for an enterprise cloud service

I'm planning a database for an enterprise cloud service. The service will be two web applications, one Warehouse management system and one for Invoices. Companies can signup and become a "user" of the service, then they can have their Inventory and Invoice system online. Should I keep all users/companies in the same table or should I h...

Sybase PowerDesigner Change Many (Find/Replace/Convert) Data Item's Data Types

Hello, I have a relatively large Conceptual Data Model in PowerDesigner. After generating a Physical Data Model and seeing the DBMS data types, I need to update all of data types(NUMBER/TEXT) for each data item. I'd like to either do a find/replace within the Conceptual Data Model or somehow map to different data types when creating t...

Are there actually lag times to remove an email address from "the system"?

For example, you send an unsubscribe message to a legitimate company or a spam, they reply that they will remove you and it may take up to 72 hours to take effect. I find it hard to believe anything that simple could take more than 3/4 of a second to take effect system wide. Another example would be when you call the visa activation lin...

Locking DB w/ Large Reads (Ruby-on-Rails/Heroku)

Currently I have a Web API running on Heroku that is constantly writing information we're collecting from other data sources (currently theres about half a GB of data and it's growing very quickly). We're looking to add a reporting system on top of the current database that we can use to extract useful information out of the DB. The pr...

Guid Primary /Foreign Key dilemma SQL Server

Hi guys, I am faced with the dilemma of changing my primary keys from int identities to Guid. I'll put my problem straight up. It's a typical Retail management app, with POS and back office functionality. Has about 100 tables. The database synchronizes with other databases and receives/ sends new data. Most tables don't have frequent ...

Users in database server or database tables

Hi all, I came across an interesting issue about client server application design. We have this browser based management application where it has many users using the system. So obvisously within that application we have an user management module within it. I have always thought having an user table in the database to keep all the log...

Ways to get past the Inner-platform effect while still building highly customized web apps?

Feel free to answer the question in the title as generally as I posed it, I offer some more details and specifics below. Currently I develop and maintain a somewhat legacy business app (ASP/SQL) that is highly customizable allowing for moderate to full customization on: custom fields, forms, views, reports, actions, events, workflows, e...

Database design grouping contacts by lists and companies

Hi, I'm wondering what would be the best way to group contacts by their company. Right now a user can group their contacts by custom created lists but I'd like to be able to group contacts by their company as well as store the contact's position (i.e. Project Manager of XYZ company). Database wise this is what I have for grouping cont...

Object Oriented Database - why most of the companies do not use them

Hi, I am pretty new to programming(just finished University). I have been thought in the last 4 years about Object Oriented development and the numerous advantages of this approach. My question is Isn't it easier to use a pure Object Oriented database in development applications? Why Object Oriented database are not as much diffus...

Best practices to store CreditCard information into DataBase

In my country the online payments are not an old thing, the first time i saw a web application taking payments directly to a local bank account was last year. So, Im a newbie coding web payment system. My question is, what are the best practices to store creditcard information into the database... I have many ideas: encrypting the cre...

Unique constraint on more than 10 columns

I have a time-series simulation model which has more than 10 input variables. The number of distinct simulation instances would be more than 1 million, and each simulation instance generates a few output rows every day. To save the simulation result in a relational database, i designed tables like this. create table SimulationModel ...

What sort of schema can I use to accommodate manual date based data entries?

I have an admin where users from multiple properties can enter in monthly statistics for twitter/facebook followers. We do not have access to the real data/db so this is why a manual entry. The form looks like this: Type ( radio, select **one** only ): - Twitter - Facebook Followers/Fans ( textfield ): Property (dropdown): Hotel A, ...

MySQL friends table

I have a MySQL DB in which I store data about each user. I would like to add a list of friends for each user. Should I create a table of friends for each user in the DB or is there a better way? ...

Help with database design

Hey im new to database design and having trouble trying to figure this one out. I have two tables Team and Fixtures. Team has rows of football teams and Fixture has 2 of those football teams in each row (home and away team). I want to link team id to home_team and away_team but it doesnt allow me to. Please tell me how i can solve this. ...

Does column ordering in databases affect performance?

I am using Django with MySql. I have a CharField with max length of 64 as the 2nd to last column, and a Boolean as the last column. Will reversing the order of these provide better optimization of space? ...

How to design a generic database whose layout may change over time?

Here's a tricky one - how do I programatically create and interrogate a database whose contents I can't really foresee? I am implementing a generic input form system. The user can create PHP forms with a WYSIWYG layout and use them for any purpose he wishes. He can also query the input. So, we have three stages: a form is designed an...

Simulating relations in MongoDB

Being one of the most popular NoSQL solutions MongoDB has most of the advantages of this approach. But one issue I'm still struggling with is how reflect object relations in NoSQL data store, specifically - MongoDB. For example, let's consider a simple data model: User, Post and Comment. It is clear to me that comments have no value on ...