database-design

Are nulls in a relational database okay?

There's a school of thought that null values should not be allowed in a relational database. That is, a table's attribute (column) should not allow null values. Coming from a software development background, I really don't understand this. It seems that if null is valid within the context of the attribute, then it should be allowed. This...

Handling large databases

Hi all, I have been working in a web project(asp.net) for around six months. The final product is about to go live. The project uses SQL Server as the database. We have done performance testing with some large volumes of data, results show that performance degrades when data becomes too large, say 2 million rows (timeout issues, delayed ...

Should I have a dedicated primary key field?

I'm designing a small SQL database to be used by a web application. Let's say a particular table has a Name field for which no two rows will be allowed to have the same value. However, users will be able to change the Name field at any time. The primary key from this table will be used as a foreign key in other tables. So if the Name...

Database Design: A proper table design for large number of column values.

I wish to perform an experiment many different times. After every trial, I am left with a "large" set of output statistics -- let's say, 1000. I would like to store the outputs of my experiments in a table, but what's the best way...? Option 1 Have a table with 1000 columns. Seems like a bad idea. What if the number of statistics o...

Merging Rails databases

I have two databases with the same structure. The tables have an integer as a primary key as used in Rails. If I have a patients table, I will have one patient using primary key 123 in one database and another patient using the same primary key in the other database. What would you suggest for merging the data from both databases? ...

Is it possible to query a tree structure table in MySQL in a single query, to any depth?

I'm thinking the answer is no, but I'd love it it anybody had any insight into how to crawl a tree structure to any depth in SQL (MySQL), but with a single query More specifically, given a tree structured table (id, data, data, parent_id), and one row in the table, is it possible to get all descendants (child/grandchild/etc), or for tha...

What DB design to use for collecting configurable demographic data?

I'm working on an application for a charitable student organization. The application will track participation and fund-raising for (primarily) student participants in an event. One of the things we'd like to do is collect some demographic information about students who register for the event from our enterprise directory to use in eval...

Add (external) relationship (tagging) to existing Hibernate entities

I need to add a new many-to-many relationship to an existing Hibernate entity. I do not want to touch the original Hibernate entity bean or its configuration. What I am adding is a "tagging" feature that can be viewed as an external contribution and not part of the entity's data itself. I want to have a simple join table with only two c...

What strategy would you use for tracking user recent activity?

Our customer would like to know who is online and currently using the custom application we wrote for them. I discussed it with them and this doesn't need to be exact, more of a guestimate will work. So my thought were maybe a 15 minute time interval to determine user activity. Some ideas I have for doing this are as follows: Stam...

Bad Database Design - Is my table too large?

I have a poorly designed database. One of the most important tables has 11,000+ entries. We would like to expand our system, and I am wondering if this table grew to 5x its size, would this be a problem? It's 15360 kB in size... if that matters. I'm using phpMyAdmin, the server is a Fedora Linux box (nothing fancy), The load is light....

Importing data to MySQL from MS SQL

Hello, i want to import data from mssql, run it through some sort of regexp to fitler out stuff, and import it into mysql. I then, for each query, wish to display a relevant image from a third database. What would be the easiest way to do this, importing and linking wise? Thankyou Clarification: It is a php application to filter data ...

How do you deal with m..n relationships in a relational database?

Let's look at an example - books. A book can have 1..n authors. An author can have 1..m books. What is a good way to represent all of the authors of a book? I came up with an idea to create a Books table and an Authors table. The Authors table has a primary AuthorID key the author's name. The Books table has a primary Book ID and metada...

Optimizations for a Write heavy Oracle application?

What are some useful Oracle optimizations one can use for an Application that mostly writes (updates) to an Oracle database? The general usage pattern here is not web-serving or logging, as is most cases, but instead to persist complex state of a system, so the only times reading is needed is when the system starts up, after that its u...

Is there a role for a DBA when an app uses a persistence layer or repository?

I'm taking on the re-architecting of a pair of applications which use Hibernate in one case, and a combination of Hibernate and a Java Content Repository (specifially JackRabbit) in the second. A key issue in the rearchitecting is to improve performance, so I'm wondering whether there's any value in bringing in a DBA for the design and ...

Customer File design

How do you model your customer address data and what techinques are you using to ensure the quality of the data? Things like deduplication algorithms, duplicate matches, making sure that packages and invoices can actually be delived and such? Esepcially in systems handling customers in multiple countries. ...

How do you effectively model inheritance in a database?

What are the best practices for modeling inheritance in databases? What are the trade-offs (e.g. queriability)? (I'm most interested in SQL Server and .NET, but I also want to understand how other platforms address this issue.) ...

SQL Server - separate database for reports?

On our SQL Server, we have a database for each of our web apps. For reports, we use Reporting Services and all report data (including report parameters) come from stored procedures. The stored procedures are in the same database as the data in the report. So, for example, the procs that serve the Stock reports are in the Stock database...

Oracle recommendations for high volume writes and low volume read.

Is there some general guidelines online on how to tweak oracle for doing a high number of inserts and low number of reads? All the answers below are pretty good recommendations. I have to clarify the following things. I am using 10g and this is an absolute requirement that we use Oracle. I am also more interested in oracle instance para...

How to deal with old, obsolete database data of a long running system?

What are the possibilities of a programmer to handle data that are rarely used but cannot be simply deleted because at least reporting still requires it? Some examples I am thinking of: Discountinued funding types of older years of a university Unused currencies (e.g. Italian lira) Names of disappeared countries (e.g. Austro-Hungary, ...

Should I only store fixed-size data elements in a database?

If the amount of data stored within a given field of a database is unknown, and could be very large, should I store it in an external file rather than within a field in the database? ...