database-design

Quality diagnostics tool for database model

I´m looking for one tool capable to analyse an existing db model (an Oracle schema in my setup) building a report with quality metrics, potential causes of problems (circular constraints, for example), etc. We have this kind of features for Java code using tools like PMD or checkstyle. Does anyone know about some tool like this for d...

How can I store data in a vertical table without losing precision?

I would like to have a vertical table (I know, I know... it's pretty much unavoidable) that is able to store an identifying field, the value, and the original type. Obviously the value field needs to be something generic or I won't be able to store various different types of data in it (varchar, text, int, decimal, bit, etc). What sugge...

How Do I aggregate Data By Day and Still Respect Timezone?

We are currently using a summary table that aggregates information for our users on an hourly basis in UTC time. The problem we are having is that this table is becoming too large and slowing our system down immensely. We have done all the tuning techniques recommended for PostgreSQL and we are still experiencing slowness. Our idea ...

database Collation diffrence utf ? latin ? etc ?

what is collation usage for database ? well for html utf-8 i know a bit, like for displaying other language type. but whats for in database ? im useing latin-1 ( default ), my friends told me that to use utf insted, when i ask why, they just dont know and said, others use it. so im questioning what does collation reall...

Which one is better for (mysql) performance ?

Which one is better for (mysql) performance ? "1500 (300x5) Tables with 365 rows per table" OR "(300x5)1500x365 rows in 1 table" ? (I will get the data(s) with php.) 365 -> days number of the year if second: I will use "date" and "x_id" to get the 1 row from (300x5)1500x365 rows. if first: I will use "date" and "table_name" to get 1...

What is the most flexible design for a table of physical addresses in some variety of SQL?

What is the most flexible design for a table of physical addresses in some variety of SQL? I assume there is something better than { street address, building address, city, state/province/region, country, zipcode }. Also are there standard names for various components of addresses, especially international standard names? Further, wha...

the mysql query option "between" in "multiple column index"

I will design my mysql tables/columns using "multiple column index". I've checked some articles about "multiple column index". But I can't find information about the option "between" with "multiple column index". http://dev.mysql.com/doc/refman/5.0/en/multiple-column-indexes.html http://www.mysqlfaqs.net/mysql-faqs/Indexes/When-does-m...

Modbus logger into database and array handling strategy

I have found that reading 64 contiguous memory locations (elements) using modbus is the most efficient way of retrieving information over Modbus using the rmodbus library. My goal is to log the read information in a simple database that can be mined to generate graphs and tables of data on a webpage and store the most current value in ...

Designing a database

Hi All, I am currently trying to design a DB for a new project I am working on. My question stems around Normalizing and Denormalizing....what I am trying to figure out is should you always normalize to the fullest extent? The data will be information that the users will be revising very very rarely and will most often be interacting w...

Foreign Keys - What do they do for me?

I'm building a small application and setting up foreign key relationships between tables. However I'm confused as to WHY I really need this? What is the advantage - does it assist me when writing my queries that I don't have to perform any joins? Here's an example snippet of my database: +-------------------+ | USERS | +----...

Query optimization - VARCHAR equality vs Numeric equality

I have a large SQL Server database with about 40 columns and hundreds of millions of rows. This table is supposed to be loose in schema so I have a lot of columns as VARCHAR(MAX) even where it could have been BIGINT, DATETIME, INT etc. Does this have an impact on querying time/efficiency? e.g. will SELECT TOP 100 * FROM CustomerId = 3...

Is it a good idea to use a foreign key to reference 2 or more tables?

Hi, Ruby on Rails ORM(object relational mapping) has a thing call polymorphic associations that allow a foreign key to be used to reference 2 or more other tables. This is achieved by creating an additional column called "type" that specifies the table with which the foreign key is associated with. Does this implementation have a name f...

What is the difference in rebuilding an index on index-organized table and an ordinary table?

From this article about index organized tables, Note that rebuilding a secondary index on an index-organized table involves reading the base table, unlike rebuilding an index on an ordinary table. Why does rebuilding of an index on an ordinary table not require reading the base table? ...

Groups-People Database Design - Need advise

I'm developing an application in which users upload pictures to server and then send email to people they choose with a link that shows these pictures. My question is about organizing the people in a database (I'm using MySQL). I would like each user to have people tree like this: Family Mom Daddy Jonathan Close Friends David Ron...

How does index rebuilding happen after a table is updated?

original simple table A ------------------------ rowid id name 123 1 A 124 4 G 125 2 R 126 3 P index on A.id ------------- id rowid 1 123 2 125 3 126 4 124 updated simple table A ---------------------- rowid id name 123 1 A 124 5 G 125 2 R 126 7 P Assumin...

Data Design question

I am having a tough time with this design problem and would appreciate any insight. i have a doctors office that is provided certain privileges currently there are only 5 privileges but more could be added. Each of these privileges has a status of Yes or No, but there could be a finer grained status in the future and each of these privi...

Inserting records to an interface

I have set up a stored procedure for inserting a single record into a table. The reason for this is to create a general interface for people to use so I can change the table structure that it points to without anyone noticing or having to change code on their end in the future. The problem occurs when the user has to insert many records...

Three Entity Intersection Table "many-many-many"

I'm currently working on a data model design (which will be backed by an RDMS). It is based around 3 entities relating to benefits for a member of the organization. The entities are the Benefit, Membership Type, and Provider. I've created a standard many-to-many intersection table to relate two entities, but never 3. I'm wondering if any...

Basic Database Design Questions

Please feel free to offer improvements to any of my ideas. My objective is to have multiple users running a desktop program which will pass information to a php script that will then write the information to a database. No need to worry about the details of the desktop application. My Questions: 1) Will this method be efficient? Or w...

How do I setup a Doctrine relation for a foreign key that could point to different tables, depending on context?

I am creating an application, built with PHP, MySQL and Doctrine v1.2, that deals with ordered groupings of items, which can contain different types of items. For example, the group My Last Vacation can have images, video and textual notes. These items would be sortable so that they appear in the order that the end user specifies. Eac...