database-design

Setting up polymorphic associations in db when the super is a FK of subclasses?

Using class table inheritance it is recommended that the subclass refers to the superclass and not the other way around. Normally in Rails polymorphic associations work in the other direction--the super refers to the subclass. Recommended vehicle .id car .vehicle_id # PK instead of using id (identity column) boat .vehicle_id...

Venue/Event Booking Database Design

I am task with designing a database for online bookings. I am not looking for a full design as we have had previous exp with online house rental. What i would like to know, is how do we design a db for booking of hotel, travel, events. We have some ideas. Basics... Have all venues/ events (once/reoccuring) register. That seems like ...

What are good open source GUI SQLite database managers?

Is there any good open source SQLite database manager around? I am using sqlitebrowser now but I have to say the interface is not really friendly so I am looking for something better. ...

How should I create this customized e-commerce database model?

I am building an e-commerce website from scratch and have to make a special product configuration page. It's only 1 type of product, but it is configurable on several levels: Color (about 4 different options). Value is a VARCHAR. Material (about 10 different options). Value is a VARCHAR. Size (About 30 different options). Has 2 Val...

multiple table good Or Bad???

I Can place data in single table ,other option is , i can use two table for the same information??? what is better using one table or two??? which will give me best performance??? table-tblschool name address Principal NAME PRINCIPAL MOBILE ADMIN NAME ADMIN MOBILE Here in abhove table one school will have one admin and one principle ,s...

How would this lookup table example work?

Say I have a products table that stores off the shelf products that are not customizable and have static pricing. I also have 1 product in this same table that is customizable and it's price and all sorts of characteristics vary based on the configuration. The final price for this customizable product is based on an equation, not a sum...

database design for unread meassages in mysql?

What would be the best way to check unread messages from mysql table... I have two tables one for users and the other for messages... In the users table I am saving the last-login-date column & in messages table the date-added column, but what would be the best way to check whether the user has accessed the messages or not.... I am think...

database index and memory usage

suppose I have a table that stores 100 million records of strings of varying sizes up to 20 characters in a column field. I need to index this column, I only have a 2GB-Ram machine, is this sufficient to perform such task? Is mysql recommended db engine for storage? ...

Pros and cons of database events

I am considering rewriting part of an application's data model update methods to include support for registering to events coming from the database. Are there any reasons why this would be a bad idea? Should I limit myself to receiving events fired by CRUD operations, or could I program more of the business logic around event notificatio...

Unable to create column in MySQL database with datatype of TEXT

I'm creating a table to hold items from rss feeds and I need to create a column 'description'. I selected the datatype as TEXT with no limit set with no index on this column. This is the error I'm getting: #1071 - Specified key was too long; max key length is 1000 bytes If I select to index this column, I get this error message: #117...

Person -> Details database structure

I have a Domain model: Employee: Id, FirstName, LastName, Sex, BirthDate. Office: Employee, WorkStation, OfficeName, etc.. Contacts: Employee, MobilePhone, EMail, etc... But I`m not sure about my current database structure. How is right: Employees table has a PK EmployeeID, and the Offices and Contacts tables has their own IDs and r...

Anatomy of a Distributed System in PHP

I've a problem which is giving me some hard time trying to figure it out the ideal solution and, to better explain it, I'm going to expose my scenario here. I've a server that will receive orders from several clients. Each client will submit a set of recurring tasks that should be executed at some specified intervals, eg.: cl...

Forum Schema: should the "Topics" table countain topic_starter_Id? Or is it redundant information?

I'm creating a forum app in php and have a question regarding database design: I can get all the posts for a specific topic.All the posts have an auto_increment identity column as well as a timestamp. Assuming I want to know who the topic starter was, which is the best solution? Get all the posts for the topic and order by timestamp....

30 million records a day, SQL Server can't keep up, other kind of database system needed?

Some time ago I thought an new statistics system over, for our multi-million user website, to log and report user-actions for our customers. The database-design is quite simple, containing one table, with a foreignId (200,000 different id's), a datetime field, an actionId (30 different id's), and two more fields containing some meta-inf...

MySQL: Writing to slave node

Lets say I have a datbase of Cars. I have Makes and Models (FK to Makes). I plan on having users track their cars. each Car has a FK to Model. Now, I have a lot of users, and I want to split up my database to distribute load. The Makes and Models tables don't change so much, but they need to be shared across shards. My thought is to use ...

Ways to circumvent a bad database schema?

Our team has been asked to write a Web interface to an existing SQL Server backend that has its roots in Access. One of the requirements/constraints is that we must limit changes to the SQL backend. We can create views and stored procedures but we have been asked to leave the tables/columns as-is. The SQL backend is less than ideal....

Database design: Keeping track of tag changes between revisions

I'm building a revision system similar to the one Stack Overflow has and there's one thing I can't get my head around, what's the best way to the differences in tags between multiple revisions? The simplest way I can think of is we have 3 tables, revisions, tags and another to link the two. Each revision then has its own set of tags, t...

What are good candidates for creating indexes on beside pk and unique columns?

I'm always asking myself should I create an index or not in my Oracle tables, what criteria in a table makes the index worth creating? And is it also a criteria in the query? And are there (with respect to Oracle) different kinds of indexes you can create based on some factor(s)? ...

Asking for opinions : Accent marks / diacritics in primary key

I have this application that uses natural primary keys. The database uses the WE8ISO8859P15 character set. So in my table City whe have primary keys like 'MEDELLÍN' and 'MÜNCHEN'. I have a hunch we are going to have a lot of trouble with this. The problems I see Interfacing this data to databases with another character set. I don't ...

5 separate database or 5 tables in 1 database?

Let's say I want to build a gaming website and I have many game sections. They ALL have a lot of data that needs to be stored. Is it better to make one database with a table representing each game or have a database represent each section of the game? I'm pretty much expecting a "depends" kind of answer. ...