Most Popular

1500 questions
32
votes
4 answers

How much time will a vacuum/autovacuum operation take?

I manage a big (some hundreds of gigs) database containing tables with various roles, some of them holding millions of records. Some tables only receive large number of inserts and deletes, some other few inserts and large number of…
zaadeh
  • 465
  • 1
  • 5
  • 9
32
votes
9 answers

How does the Oracle DUAL table work?

SQL> desc dual Name Null? Type ----------------------------------------- -------- ---------------------------- DUMMY VARCHAR2(1) SQL> select 4*5 from dual; …
Lazer
  • 3,351
  • 15
  • 42
  • 53
32
votes
2 answers

Get all partition names for a table

I want to list all the partitions created by dynamic triggers in PostgreSQL 9.1. I was able to generate a count of partitions using this related answer by Frank Heikens. I have a table foo with an insert trigger that creates foo_1, foo_2 etc.…
Vishnu Kumar
  • 495
  • 1
  • 5
  • 8
32
votes
1 answer

INT(5) vs SMALLINT(5): numbers in parenthesis after the numeric type

In MySQL table definitions is there a different between INT(5) and SMALLINT(5)? Or do they both represent the same size?
BenV
  • 4,893
  • 7
  • 39
  • 38
32
votes
2 answers

Amazon RDS for MySQL vs installing MySQL on an Amazon EC2 instance

At work, we host all our webservers on Amazon EC2 and usually have used MySQL databases installed on the same box as our Apache webserver, and communicated with them on localhost. We now face a need to migrate our database to its own server for one…
Mark Amery
  • 1,075
  • 2
  • 14
  • 24
32
votes
2 answers

Preventing PostgreSQL from starting on boot in Ubuntu

I am using PostgreSQL 9.2 and it runs automatically when I start the system (Kubuntu). How can I avoid this? I need to start it manually, and I don't want it to start unattended because I need to look at the console.
DarkCoffee
  • 507
  • 1
  • 7
  • 11
32
votes
1 answer

How do I attach a database in SQL Server?

Some common questions relating to attaching databases in SQL Server: What does it mean to attach or detach a database? How do I detach a database? How do I attach a database? What does it mean to attach and rebuild the log? How do I do it…
Mike Walsh
  • 18,173
  • 6
  • 47
  • 72
32
votes
6 answers

Query to report disk space allocation and used space

We are using 6 databases in total for an application, and we can only share 4TB of space among all 6 auto-grow databases (via SAN storage). I'd like to write a query (report) for a single database indicating the "Currently allocated space" and…
JustBeingHelpful
  • 2,082
  • 18
  • 45
  • 60
32
votes
9 answers

How do you version your Oracle database changes?

I am interested to know what methods other people are using to keep track of changes made to the database including table definition changes, new objects, packages changes, etc. Do you use flat files with an external version control system? …
Leigh Riffel
  • 23,854
  • 16
  • 78
  • 152
32
votes
3 answers

Why do wildcards in GROUP BY statements not work?

I am trying to make the following SQL statement work, but I get a syntax error: SELECT A.*, COUNT(B.foo) FROM TABLE1 A LEFT JOIN TABLE2 B ON A.PKey = B.FKey GROUP BY A.* Here, A is a wide table with 40 columns and I would like to avoid listing each…
Anonymous Maximus
  • 769
  • 2
  • 8
  • 16
32
votes
3 answers

Why do I get a PostgreSQL permission error when specifying a tablespace in the "create database" command?

When I create a database in PostgreSQL without explicitly specifying a default tablespace the database is created without issue (I'm logged in as the pgsys user): postgres=> create database rich1; CREATE DATABASE postgres=> \l+ …
HuggieRich
  • 421
  • 1
  • 4
  • 5
32
votes
2 answers

Is there a way to prevent Scalar UDFs in computed columns from inhibiting parallelism?

Much has been written about the perils of Scalar UDFs in SQL Server. A casual search will return oodles of results. There are some places where a Scalar UDF is the only option, though. As an example: when dealing with XML: XQuery can't be used as…
Erik Darling
  • 40,781
  • 14
  • 130
  • 456
32
votes
5 answers

What database technologies do big search engines use?

Does anybody knows how Google or Yahoo perform searches for keywords against very very huge amounts of data? What sort of database or technologies do they employ for this? It takes few milliseconds, but they have more than a billion pages indexed.
rkosegi
  • 518
  • 1
  • 7
  • 13
32
votes
3 answers

Is using multiple foreign keys separated by commas wrong, and if so, why?

There are two tables: Deal and DealCategories. One deal can have many deal categories. So the proper way should be to make a table called DealCategories with the following structure: DealCategoryId (PK) DealId (FK) DealCategoryId (FK) However, our…
32
votes
3 answers

Why is it recommended to store BLOBs in separate SQL Server tables?

This highly-upvoted SO answer recommends to put images in separate tables, even if there is only a 1:1 relationship with another table: If you decide to put your pictures into a SQL Server table, I would strongly recommend using a separate table…
Heinzi
  • 3,145
  • 2
  • 29
  • 42