Most Popular

1500 questions
44
votes
5 answers

Backup only one schema and restore it on another server

I have a database named "A" which has two schemas "B" and "C". I want to backup and restore Schema "B" (including data) on a different server. Not sure how to do this as I am new to Postgres. Do I have to create a new database on the new sever as of…
user30422
  • 541
  • 1
  • 4
  • 3
44
votes
4 answers

Can listen_addresses really be set to a list?

I have a VM with IP address 192.168.0.192 running postgreSQL. If I specify listen_addresses = '*' then I can connect from another VM at 192.168.0.191 and from localhost. But I can't seem to use a list to tell postgreSQL to use those two addresses. …
zabouti
  • 543
  • 1
  • 4
  • 4
44
votes
6 answers

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....
Snow_Mac
  • 553
  • 1
  • 4
  • 7
44
votes
4 answers

How do I assign an entire Active Directory group security access in SQL Server 2008?

I would like to use integrated security with my internal application which is all on a domain. Unfortunately, I've never been able to get this to work well. I would like to assign an entire Exchange (Active Directory) Group a role in SQL Server…
Michael Hedgpeth
  • 1,361
  • 4
  • 15
  • 21
44
votes
1 answer

PostgreSQL - Truncate a table on cascade and reset all hierarchic sequences with 1

Is there any way to reset all the sequences of tables, when truncate a table on cascade. I already read this post How to reset sequence in postgres and fill id column with new data? ALTER SEQUENCE seq RESTART WITH 1; UPDATE t SET…
Youcef LAIDANI
  • 543
  • 1
  • 4
  • 10
44
votes
3 answers

Database Design: New Table versus New Columns

(This was suggested to be be repost here from StackOverflow) Currently have a table .. and need to start adding new data columns to it. Not every record (even going forward with new data after adding the new data columns) will have data. So I am…
cgmckeever
  • 565
  • 1
  • 4
  • 7
44
votes
2 answers

Database model with users, roles and rights

I have a database model with a user table and role table. I want to control the access (rights) to up to 10 different elements. The access can be granted to either a role or a single user. Below is the table definition of users, roles and…
taudorf
  • 543
  • 1
  • 5
  • 7
44
votes
3 answers

When is it better to create STATISTICS instead of creating an Index?

I have found plenty of information on what STATISTICS are: how they are maintained, how they can be created manually or automatically from queries or indexes, and so on. But, I have been unable to find any guidance or "best practices" information…
Solomon Rutzky
  • 68,731
  • 8
  • 152
  • 292
44
votes
3 answers

Is it acceptable to have circular foreign key references\How to avoid them?

Is it acceptable to have a circular reference between two tables on the foreign key field? If not, how can these situations be avoided? If so, how can data be inserted? Below is an example of where (in my opinion) a circular reference would be…
KidCode
  • 842
  • 1
  • 8
  • 14
43
votes
2 answers

What is the impact of LC_CTYPE on a PostgreSQL database?

So, I've few Debian servers with PostgreSQL on it. Historically, those servers and PostgreSQL are localized with the Latin 9 charset and back then it was fine. Now we have to handle things like Polish, Greek or Chinese, so changing it become a…
Gregoire D.
  • 533
  • 1
  • 4
  • 6
43
votes
3 answers

Is it a good idea/approach to index a VARCHAR column?

We're using PostgreSQL v8.2.3. There are tables involved: EMPLOYEE and EMAILLIST. Table 1: EMPLOYEE (column1, column2, email1, email2, column5, column6) Table 2: EMAILLIST (email) 2 tables are joined in such a way that if either EMPLOYEE.EMAIL1 or…
Gnanam
  • 987
  • 2
  • 9
  • 16
43
votes
2 answers

MySQL - varchar length and performance

Is declaring VARCHAR size make sense for performance? Is there any difference (in speed) between VARCHAR(50) and VARCHAR(255)? Or defining length is logic/design constraint?
Sonique
  • 533
  • 1
  • 4
  • 5
43
votes
7 answers

Is it better to store images in a BLOB or just the URL?

Possible Duplicate: Files - in the database or not? I was wondering if there's any good reason to still use blob fields in a database. A couple of years ago I worked with a DB with a bunch of images in it, the DB was very slow and I couldn't see…
eiefai
  • 1,874
  • 2
  • 21
  • 18
43
votes
2 answers

Changing column width

Will increasing a column (nvarchar) width necessarily drop the table? In other words, can the width be changed in a production environment with active users? I figured that if the size is increasing (as opposed to decreasing) this wouldn't be a…
Fernando
  • 433
  • 1
  • 4
  • 4
43
votes
5 answers

Why is SQL Server consuming more server memory?

SQL Server is consuming 87.5 % of my server RAM. This recently caused a lot of performance bottlenecks such as slowness. I researched this issue. One common solution I could find on the internet is to set the maximum limit for SQL Server. This was…
kombo
  • 657
  • 2
  • 8
  • 11