database-design

Postgresql Application Insertion and Trigger Performance

I'm working on designing an application with a SQL backend (Postgresql) and I've got a some design questions. In short, the DB will serve to store network events as they occur on the fly, so insertion speed and performance is critical due 'real-time' actions depending on these events. The data is dumped into a speedy default format acros...

save file as lob or as OS file?

hello, I am developing a J2EE application that manages hundreds of jars (saved and loaded on the fly) to manage them i have two options: create a directory on the server that contains all the jars save the jar as a LOB in an oracle 10g database Could you help me to choose the best solution?What are the benefits of each option? than...

Different database tables joining on single table

So imagine you have multiple tables in your database each with it's own structure and each with a PRIMARY KEY of it's own. Now you want to have a Favorites table so that users can add items as favorites. Since there are multiple tables the first thing that comes in mind is to create one Favorites table per table: Say you have a table ...

Database constraints - keep or ignore?

When I was learning in university, they taught us the database fundamentals, basics and rules, and one of the most important rules is the constraints (primary key, foreign key), and how to make 1-m, 1-1, m-n relationships. Now when I move to real business environment they tell me: you should forget all you have been taught; no constrain...

What SQL Server DataType should I use for a Text field which will be JOINED, "LIKE'd" and Queried against alot?

The title really says it all, a bit more info though for those who bothered to click. Strings will be of variable length typically between 2-5 characters in length, could occasionalyl exceed 5 characters and be upwards of 10. Never more than 10. Will be queried on like such: SELECT ... WHERE ... = 'abcd'; SELECT ... WHERE ... LIKE 'ab...

Guidance on Database Design for CakePHP

I'm developing an application using the CakePHP framework and am currently in the process of designing the database. I want to make sure that I design the objects and their associations correctly so that the application performs well, is organized properly, is extensible, and scales well. I will first describe the application in detail, ...

Multi tables with same schema, query design strategy?

I have an Oracle database with a dodgy design: many tables have same schema. They're pieces from a huge table, and time by time, new tables will be created with specific rows. Of course, I'm not authorized to access the huge table, only the small ones. How can I query against these tables, effectively? Many thanks in advance. ...

Converting Paper/PDF forms for web - Normalize, Partition or Wide-Table it?

We'll be converting a fairly long lease application form into a web application for submission via PHP in to a PostgreSQL database. I abide by the maxim "Normalize till it hurts, then denormalize till it works" (Attr:SQLMenace) but as I jump in I figured I'd tap the collective mind. Here is what the paper form currently looks like: ht...

C# How to store Brush/Pen information in a database table

I need to store Brush/Pen information about several shapes in a database table, one row for each layer I draw. I was thinking of two schemes: BRUSH_INFO PEN_INFO SolidBrush(Color.Red) Pen(Color.Black) pros: only two colums cons: eval'd column BRUSH_INFO PARAM_B1 PARAM_B2 ... PEN_INFO PARAM_P1 PARAM_P2...

How to calculate time left in a count down scenario

We have a requirement to count down based on a user taking a test. What would be a best way to tackle tracking the time taken by a user while taking the test. We do capture start time, end time. But the calculations go awry if the application server or the OS goes down during the test. We were thinking of using another variable to store...

How would you model this in MongoDB?

There are products with a name and price. Users log about products they have bought. # option 1: embed logs product = { id, name, price } user = { id, name, logs : [{ product_id_1, quantity, datetime, comment }, { product_id_2, quantity, datetime, comment }, ... , {...

What are the pitfalls and advantages of using the following two database schemas

Assuming you have a business that rents movie and you were designing a schema for your database. The customer will have to choose a plan, a delivery type, and a billingTerm (monthly, every three months, every six months). The plan has a base price and decides how many movies a customer can rent per month, and how many at once. The delive...

What do I need to know about working with huge databases?

I want to know what specific problems/solutions/advices/best-practices[don't punish me for the word] are arising while working with huge databases. Under huge I imply databases, which have tables with millions of rows and/or databases with petabytes of data. Platform-oriented answers will be great too. ...

Rails relationship modelling

I have a users table and a gifts table. Users can pick gifts for their friends. I am thinking of creating a table to store user id and gift id to track which user picked which gift for whom. How to model this relation? I think users and gifts have a HABTM relation. Is that right? ...

Tool to Draw Extend ER (with inheritance)

Is there any tool to draw E(xtended)ER diagram with inheritance in a form of generalization/specialization? ...

Database schema designing help - Mysql

Ok need some help, I have a system I'm creating that will allow users to purchase site credits and earn them, and with these credits order products, and access features that may be for sale. My issue is creating the orders and transactions tables. I have 2 separate order tables one for site credits (sitecredit_orders) and one for produc...

Linking two tables together using has_many AND has_one?

I sure this has been asked a million times already. I just not searching very well. I have the following setup: I have an Instructor who has many Events. Each event has only one Instructor (owner/creator). I want to add a separate linkage to allow other instructors to be associated but still preserve the original instructor (owner). I ha...

database design pattern: many to many relationship across tables?

I have the following tables: Section and Content And I want to relate them. My current approach is the following table: In which I would store Section to Section Section to Content Content to Section Content to Content Now, while I clearly can do that by adding a pair of fields that indicate whether the source is a section or...

Do you need deep knowledge in databases when using an abstract layer in your application.

Most(if not all) of the MVC frameworks provide an abstraction layer over the database and except in some very special cases you do not need to write SQL code by hand. Of course you need to know basic things to design your model but do we need deep knowledge how to optimize queries, make triggers and other db stuff. ...

Is there a limitation on the number of tables a PostgreSQL database can have?

I have created a database in PostgreSQL, let's call it testdb. I have a generic set of tables inside this database, xxx_table_one, xxx_table_two and xxx_table_three. Now, I have Python code where I want to dynamically create and remove "sets" of these 3 tables to my database with a unique identifier in the table name distinguishing dif...