Best practices are generally and informally recognized as the methods and processes that have been shown over time to be superior to those achieved by other means.

learn more… | top users | synonyms

0
votes
2answers
48 views

Memory Allocation in Shared DB & IIS Environment

In my use case, we have production servers that host both IIS & SQL on the same machine, not ideal but no flexibility to change that. Basically a single machine is both a DB and an Application ...
1
vote
1answer
77 views

What's better here - a single column or multicolumn primary key?

Let's assume you have a table groups and a table item. Each item belongs to exactly one group. It is an inherent part of that group. An item cannot exist outside of a group and it cannot be moved to ...
0
votes
0answers
23 views

Hints about Datatypes

I'm currently writing some style guides for a new project where we want to use Oracle for the first time in a extensive manor. I already wrote down some naming conventions for tables, columns, pk, ... ...
11
votes
1answer
507 views

GO After every T-SQL statement

What is the reasoning behind using the GO statement after every SQL statement? I understand that GO signals the end of batch and/or allows the reputation of statements but what advantage does it have ...
0
votes
0answers
13 views

Performance One Row With Total Vs Multiple Rows with Seperate Values?

Not 100% sure how to explain this situation but here it goes: I am building an Inventory Database that all items received are entered into and a label is created for each Container, that is going to ...
0
votes
3answers
46 views

Item availability in row or another table

I'm a database newbie, so please bear with me. Say I'm creating a library database. I have a table containing information about books. Do you put the book availability as a row in this table or would ...
0
votes
1answer
114 views

Best practices in securing Oracle Standard edition one [closed]

I have a database server with Oracle Standard Edition One. I'm interested what are the best practices to secure Oracle? I have Java web application installed in the same server. The Java application ...
0
votes
1answer
26 views

Query optimization ndbcluster + order by

I'm not really all too familiar with the ndbcluster storage engine of MySQL, but I've recently written an application that does some very simple queries. However, a co-worker of mine (who is now on ...
1
vote
1answer
32 views

MySQL Join Clarification

I'm new to MySQL and PHP, I come from an OO background and trying to wrap my head around SQL queries has been a bit frustrating. Right now I'm trying to find all matching IDs within the same table ...
1
vote
0answers
72 views

What's is the best way to get incremental changes from production to incrementally changed development database?

I came to a new dev team where all development is on the same (instance) of an SQL Server (2005) database once in 1-2 days restored from a current full backup of production database replacing a dev ...
37
votes
12answers
4k views

How could DBAs be more 'programmer friendly'?

The answers and comments on the dba.se version and programmers.se version of the question "What are the arguments against or for putting application logic in the database layer?" are very revealing ...
10
votes
3answers
4k views

What does a best-practice SQL Server maintenance plan look like? [closed]

I am a student from Fontys University in Eindhoven, and I am currently carrying out a series of interviews to help with the development of a SQL Server tool and I would like to get feedback from the ...
3
votes
3answers
135 views

Best practices for configuring the Drive/Filegroup setup for Microsoft SQL 2008

I am a software developer for a small company. I wish we had a dba but not in the cards at this point for this company. I was working on migrating our 75gb SQL Server 2000 database to SQL Server 2008 ...
2
votes
0answers
66 views

Use Matlab or SQL Server to do mathematical computations? [closed]

Current situtation I am working with a dozen of CSV files containing financial simulations in form of 100'000x100 matrices. Each file is around 100Mb large. Until now, only analyse these files with ...
3
votes
2answers
2k views

changing float->numeric casts from assignment to implicit, dangerous?

In porting an application to PostgreSQL (9.1), one odd SQL incompatibility I've discovered concerns the round() function, specifically the version that takes a second argument indicating the rounding ...
23
votes
5answers
7k views

Best practices on common person fields (Name, email, address, gender etc…)

What are the most common best practices on length and data type on common fields like: First Name Last Name Address Email Sex State City Country Phone Number etc....
2
votes
3answers
127 views

How to make stored procedures more readable without harming performance

I come from OOP background, and I need to write and maintain huge stored procedures. Naturally, the sprocs become quite unreadable very quickly, no matter how much I try formatting, giving readable ...
1
vote
1answer
58 views

MySQL DB dynamic ranking or “static” separately saved

I have a table where I store the points with the connected categories and game-types of each user. There are different ways to get points. However everytime when the points need to get displayed in a ...
16
votes
4answers
4k views

PostgreSQL Stored Procedure Performance

Coming from a MySQL background, where stored procedure performance (older article) and usability are questionable, I am evaluating PostgreSQL for a new product for my company. One of the things I ...
28
votes
5answers
8k views

When should I use a unique constraint instead of a unique index?

When I want a column to have distinct values, I can either use a constraint create table t1( id int primary key, code varchar(10) unique NULL ); go or I can use a unique index create table t2( id ...
1
vote
3answers
127 views

Uniqueidentifier vs. IDENTITY vs. Material Code --which is the best choice for primary key? [closed]

Which one is the best choice for primary key in SQL Server?There are some example code: Uniqueidentifiers e.g. CREATE TABLE new_employees (employeeId UNIQUEIDENTIFIER DEFAULT NEWID(), ...
1
vote
2answers
73 views

Is it worth it to create an “Id” column?

I have a table which has a column Name, which is of type VARCHAR2(20), unique, cannot be null, and cannot be changed. At first I used it as a Primary Key for this table but I was wondering if it was ...
1
vote
3answers
187 views

Proper use of database functions for business logic

I have a database in postgres with 147 tables; these tables contain data generated by functions that have most of the logic of the system, for example how to build an accounting entry. These ...
3
votes
2answers
245 views

Postgres DDL and DML best practices and coding standards

Is there a best practice or coding/design conventions for Postgres both DDL and DML/SQL that you could share and recommend. I am looking for something similar to what Google has for programming. ...
0
votes
3answers
77 views

Is it good practice to create new tables for new elements in a database?

I am trying to create a good model for a database that I need for an application. The way that I have tought about realizing it involves creating a new table for each new element that is added, but I ...
2
votes
1answer
428 views

Payment methods conceptual and logical model

I need to create a conceptual and logical (normalized) models of parking house according to the requirements below. It looks to me as a very simple concept that doesn't need all tables to have ...
2
votes
1answer
785 views

Max Memory settings on Multi-Instance SQL Server 2008 R2 Cluster

SQL Server 2008 R2 multi-instance cluster (on VMware vSphere 5.1) 2 nodes, each running 2 instances 16GB RAM per node. The only time the instances are on the same node is when I am patching the ...
0
votes
1answer
452 views

DB2 9.7 LUW - How do I SET SESSION_USER when I am DBADM,SECADM?

Based on a previous question I have asked, I am attempting to work on a solution as recommended by mustaccio's answer, whereby I have another ID to create my DDL objects. I have been trying to follow ...
1
vote
1answer
697 views

MySQL: Alter Table on very active table gives “Waiting for table metadata lock”

At my work, we've recently upgraded to MySQL 5.5 and since then, have been bitten a few times by the new (and intended) behavior of metadata locking. Basically, whenever we run an ALTER TABLE ...
11
votes
2answers
2k views

Is it a bad practice to always create a transaction?

Is it a bad practice to always create a transaction? For example, it is a good practice to create a transaction for nothing but one simple SELECT? What is the cost of creating a transaction when it ...
1
vote
2answers
719 views

What steps are necessary to safely restart a machine hosting Microsoft SQL Server?

Are there any special steps necessary to prevent data corruption when restarting a server hosting an MS SQL instance? For example, I recently encountered the recommendation of stopping the SQL ...
3
votes
3answers
159 views

Why set up static data in views vs. using tables in mysql?

I get an LDAP feed nightly. I get it as a text file and dump/create my LDAPALL table. There are roughly 75K employees times about 50 fields. I have the following too: LDAPIMPORTANT - view that ...
1
vote
4answers
3k views

Coding an accounting database from scratch?

My new medical practice is picking up fast and my homemade Libreoffice Calc spreadsheet is quickly becoming cumbersome to track patient visits, accounts receivable, overhead reconciliation, etc. Most ...
1
vote
2answers
2k views

Splitting a large table to improve performance

This is a follow-up to an earlier question. I have a SQL Server 2008 R2 Standard server, that holds a single database, which itself has almost nothing except a large table. The table is 100+ million ...
1
vote
1answer
70 views

Is it a good way to use different schemas for storing the data and provide data access?

For a new product we came along with a pattern, where all the data tables are stored in one schema (lets call it storage), while the clients connect to another one (here called api). The api schema ...
1
vote
2answers
127 views

How to avoid timeouts during big DML operations

I have a big insert script I need to run. Its about 55,000 records and 160 columns. The script is already created and I can't create it again. The problem I have is that this runs for about 4 hours ...
9
votes
6answers
5k views

Splitting Tables in MySQL. Good practice?

I have started working on an existing project and the previous developer had split up a table into 10 separate tables with identical schemas but different data. The tables look like this: ...
0
votes
1answer
137 views

How to revoke DBADM and clean up any related objects from DB2 LUW

This question has started because of us taking copies of production backups and restoring them into lower environments (with scrambled data of course) for developers to practice and/or debug against. ...
2
votes
1answer
307 views

Multiple Similar Tables vs One Master Table

I'm a web app developer and less experienced in database design, so would appreciate anyone's input. When I first built this web app, the app managed one type of object (table) with a handful of ...
1
vote
2answers
456 views

Database design experienced view

I want to make a database that stores countries, their respective states, and cities. I am confused how to normalize these. Can anyone help? My ideas: Table 1 Countries (id pk, name , code) ...
0
votes
0answers
97 views

Execute prepared statement in loop, which has been prepared before loop

The advice to not perform SQL statements in loops is given often. However, it seems to me that prepared statements are in fact designed for use in loops. That is, the statement should be prepared ...
5
votes
2answers
659 views

Stored Procedures Best Practices: Fenced or Unfenced?

I believe I understand the reasons behind fenced and unfenced stored procedures. Fenced run "outside" of the database (in our case DB2) so as to prevent possible corruption of the database engine ...
0
votes
1answer
489 views

DB2 LUW: Should temporary tablespaces share bufferpools with other tablespaces?

We are in the process of tuning a massive application our company has just written. Part of that tuning includes tuning the databases. We run DB2 LUW on AIX. Specifically we are at 9.7 Fix Pack 4 ...
2
votes
1answer
136 views

Need help to design model with multiple rights

For a website, I have multiple elements that need to be moderated by many different users. Until now, I have always used Role-Based Access Control (RBAC) model but I want a more flexible model. I ...
1
vote
1answer
48 views

When importing raw files for internal conversion, should I use a secondary database or just isolate them within the database?

When importing raw files for internal conversion, should I use a secondary database or just isolate them within the database? I've got between 1.25 and 2GB of CSV files to be imported (and already ...
0
votes
3answers
267 views

Is it a good practice to create tables dynamically in a site?

A friend asked me to build a site with a few "static" and "dynamic" tables. In fact he wants to have a few tables which can't be deleted, and some "dynamic" tables which can be created directly from ...
6
votes
3answers
192 views

Is using SUM() twice suboptimal?

I know I have to write SUM twice, if I wish to use it in a HAVING clause (or use a derived table otherwise): SELECT id, sum(hours) AS totalhours FROM mytable GROUP BY id HAVING sum(hours) ...
0
votes
1answer
128 views

Relational database primary key requirements

I am trying to put together an ER Diagram to design a fairly simple asset tag tracking/inventory management system for our servers/switches/UPS/etc. The top-level entity corresponds to the business ...
0
votes
2answers
127 views

Should numeric identifiers like serial numbers be stored as integers?

Many of our databases store numeric tracking codes (like serial numbers) as integers. There is little chance of these codes every getting alphabetic characters, but it still seems like an incorrect ...
12
votes
1answer
342 views

Best practices for connecting DBs that are in different geographical regions

We are about to set up SQL Servers in different countries. We need to link them, but we don't have to have a direct link (as in linked server). In other words, they can be loosely coupled. Is it ...