Most Popular
1500 questions
20
votes
2 answers
Can you explain this execution plan?
I was researching something else when I came across this thing. I was generating test tables with some data in it and running different queries to find out how different ways to write queries affects execution plan. Here is the script that I used to…
Andrew Savinykh
- 1,305
- 5
- 14
- 28
20
votes
2 answers
How do I determine why a MongoDB document is failing validation?
How do I determine why a MongoDB document insert is failing validation? All I get back is a writeError that says "Document failed validation", which isn't very helpful.
(This happens often, and I'd like to understand how to properly debug these,…
Jonathan Wheeler
- 303
- 1
- 2
- 6
20
votes
3 answers
How to connect to SQL Server using sqlcmd on Linux?
I have set up the Microsoft ODBC Driver 13 for SQL Server on an Ubuntu 16.04 machine. I am now trying to test a database connection, that includes both the server name and an instance name.
The following both work fine from a Windows…
geographika
- 523
- 2
- 4
- 15
20
votes
8 answers
Error Log Location?
Does MySQL write any log file? If yes, what is the path of it (on ubuntu/Linux)?
Maulik Patel
- 313
- 1
- 2
- 7
20
votes
1 answer
What is the special database "postgres" for?
I have a PostgreSQL server with several databases running on it. One of the databases is called postgres, and it was there right from the beginning. I could not see any tables inside and I've never used it explicitly, but I noticed, that any user is…
Roman Kiselev
- 303
- 2
- 6
20
votes
8 answers
Why would a primary key value change?
I have been researching the concept of ROWGUID's recently and came across this question. This answer gave insight, but has led me down a different rabbit hole with the mention of changing the primary key value.
My understanding has always been…
5crammed
- 311
- 2
- 3
- 8
20
votes
2 answers
Why does Concatenation operator estimate fewer rows than its inputs?
In the following query plan snippet, it seems obvious that the row estimate for the Concatenation operator should be ~4.3 billion rows, or the sum of the row estimates for its two inputs.
However, an estimate of~238 million rows is produced, leading…
Geoff Patterson
- 8,397
- 2
- 27
- 53
20
votes
3 answers
Does a SQL Server bit column really use a whole byte worth of space?
I was poking around SSMS and noticed the "size" of my INT columns were 4 bytes (expected) but I was a bit shocked to see my BIT columns were a whole byte.
Did I misunderstand what I was looking at?
Nate
- 1,687
- 4
- 22
- 33
20
votes
5 answers
Performance of a=0 and b=0 and ... z=0 vs a+b+c+d=0
This is a simple question that I can't seem to find the answer for.
In terms of performance, If I have a WHERE clause such as a=0 and b=0 and ... z=0, Would I gain any performance if I replaced that condition with a+b+...+z=0?
In other words, is…
JohnG
- 1,081
- 1
- 11
- 26
20
votes
2 answers
psql: FATAL: Peer authentication failed for user
I just installed PostgreSQL 9.4 on Ubuntu 15.10.
I created a user with createuser -P myuser
I created a database with createdb -O myuser mydatabase
I edited pg_hba.conf and added local mydatabase myuser md5
I restarted PostgreSQL with sudo service…
Daniel
- 317
- 1
- 2
- 7
20
votes
4 answers
What is the difference between Oracle's VARCHAR and VARCHAR2 datatypes?
When migrating tables coming from other DBMSs to Oracle, one of the standard tasks is to replace all VARCHAR(n) fields with VARCHAR2(n) fields (provided n <= 4000).
Why does Oracle call this datatype VARCHAR2 and not just VARCHAR like other DBMSs?
bernd_k
- 12,211
- 23
- 75
- 111
20
votes
1 answer
SQL Server - Handling localization of strings in nested non-deterministic view stacks
While profiling a database I came across a view that is referencing some non-deterministic functions that get accessed 1000-2500 times per minute for each connection in this application's pool. A simple SELECT from the view yields the following…
beeks
- 1,251
- 1
- 8
- 15
20
votes
4 answers
Selecting data from another table using a foreign key
I have two tables A & B.
Table A
id | name | num
Table B
id | date | roll
id in table B is a foreign key which relates to the id in table A.
I want to get the contents of table B where id is given and also along with that data, I need the name…
Yashas
- 365
- 1
- 3
- 12
20
votes
5 answers
SQL Server - separate database for reports?
On our SQL Server, we have a database for each of our web apps. For reports, we use Reporting Services and all report data (including report parameters) come from stored procedures.
The stored procedures are in the same database as the data in the…
Craig
- 503
- 1
- 4
- 11
20
votes
1 answer
Restore Database using GUI - Wrong file to restore
I'm just messing around with the SSMS graphic interface and studying the options of the "restore" task.
One thing that I noticed is when I click on "generate script", the first line of the query is:
RESTORE DATABASE [MyDatabase] FROM DISK =…
Racer SQL
- 7,386
- 14
- 69
- 128