Most Popular

1500 questions
85
votes
4 answers

PostgreSQL: Remove password requirement for user postgres

I understand that, upon installation, PostgreSQL has no password for its db root user (postgres): postgres=# select usename, passwd is null from pg_shadow; usename | ?column? ----------+---------- postgres | t (1 row) ... and one is advised to…
Marcus Junius Brutus
  • 3,409
  • 7
  • 30
  • 44
85
votes
5 answers

Which database could handle storage of billions/trillions of records?

We are looking at developing a tool to capture and analyze netflow data, of which we gather tremendous amounts of. Each day we capture about ~1.4 billion flow records which would look like this in json format: { "tcp_flags": "0", "src_as":…
somecallmemike
  • 965
  • 1
  • 7
  • 5
85
votes
1 answer

How to force drop database in SQL Server 2008

I'm trying to force drop a database, but after dropping the database, when I try to recreate the database, I'm getting the error cannot create file C:\Program Files.....[databasename].mdf because it already exists Here's my query to force drop…
srk
  • 951
  • 1
  • 6
  • 6
85
votes
2 answers

How to add the Debug button to SSMS v18?

The Debug button is present on this version of SSMS: But it is not present on version 18, preview 4: I have tried in several ways to add the Debug button to my SSMS but not successful. Is there a way to add the Debug button to SSMS v18?
Marcello Miorelli
  • 17,274
  • 53
  • 180
  • 320
85
votes
4 answers

Mongodump: Unrecognized field 'snapshot'

I am using mongodump from mongo tools to download a backup of my server. However as I run the command, the command returns "Unrecognized field 'snapshot'". The full error is: Failed: error reading collection: Failed to parse: { find: "data", skip:…
Dave
  • 1,023
  • 2
  • 9
  • 8
84
votes
6 answers

What is the best way to store an email address in PostgreSQL?

What would be the right datatype to store email addresses in PostgreSQL? I can use varchar (or even text), but I wonder if there is a more specific data type for emails.
Adam Matan
  • 12,079
  • 30
  • 82
  • 96
84
votes
6 answers

How to select the first row of each group?

I have a table like this: ID | Val | Kind ---------------------- 1 | 1337 | 2 2 | 1337 | 1 3 | 3 | 4 4 | 3 | 4 I want to make a SELECT that will return just the first row for each Val, ordering by Kind. Sample…
BrunoLM
  • 3,533
  • 7
  • 28
  • 22
84
votes
8 answers

MySQL Error Reading Communication Packets

In MySQL error logs, I see these quite few a warnings like these: 120611 16:12:30 [Warning] Aborted connection 2619503 to db: 'db_name' user: 'user_name' host: 'webapp_hostname' (Got an error reading communication packets) Haven't noticed any loss…
KM.
  • 1,367
  • 4
  • 14
  • 20
83
votes
2 answers

How to join a table with a table valued function?

I have a user defined function: create function ut_FooFunc(@fooID bigint, @anotherParam tinyint) returns @tbl Table (Field1 int, Field2 varchar(100)) as begin -- blah blah end Now I want to join this on another table, like so: select f.ID,…
Shaul Behr
  • 2,963
  • 8
  • 34
  • 42
83
votes
4 answers

Check constraint only one of three columns is non-null

I have a (SQL Server) table that contains 3 types of results: FLOAT, NVARCHAR(30), or DATETIME (3 separate columns). I want to ensure that for any given row, only one column has a result and the other columns are NULL. What is the simplest check…
David Clarke
  • 1,197
  • 2
  • 10
  • 17
82
votes
10 answers

What are the arguments against or for putting application logic in the database layer?

NOTE The audience of programmers.se and dba.se is different, and will have different viewpoints, so in this instance I think it's valid to duplicate What are the arguments against or for putting application logic in the database layer? on…
Phil Lello
  • 1,469
  • 1
  • 11
  • 9
82
votes
7 answers

How do I completely disable MySQL replication

I am running dual master MySQL replication and now want to move to a single database with no replication. How do I completely disable replication on both databases?
David Collie
81
votes
7 answers

Writing a simple bank schema: How should I keep my balances in sync with their transaction history?

I am writing the schema for a simple bank database. Here are the basic specifications: The database will store transactions against a user and currency. Every user has one balance per currency, so each balance is simply the sum of all…
81
votes
5 answers

Are SQL Server in-place upgrades as ill advised as they used to be?

I have been working with SQL server on and off since SQL Server 6.5, the old advice that still rings in my head was never to do an in-place upgrade. I'm currently upgrading my 2008 R2 DEV and TEST systems to SQL Server 2012 and need to use the same…
DamagedGoods
  • 2,591
  • 6
  • 34
  • 48
81
votes
4 answers

How to identify which query is filling up the tempdb transaction log?

I would like to know how to identify the exact query or stored proc which is actually filling up the transactional log of TEMPDB database.