Most Popular
1500 questions
49
votes
8 answers
SQL Server Agent Jobs and Availability Groups
I'm looking for best practice in dealing with scheduled SQL Server Agent jobs in SQL Server 2012 availability groups. Maybe I missed something, however at the current state I feel that SQL Server Agent is not really integrated with this great…
nojetlag
- 2,877
- 9
- 33
- 42
49
votes
5 answers
Can I add a unique constraint that ignores existing violations?
I have a table which currently has duplicate values in a column.
I cannot remove these erroneous duplicates but I would like to prevent additional non-unique values from being added.
Can I create a UNIQUE that doesn't check for existing…
Matthew
- 1,682
- 2
- 17
- 27
49
votes
4 answers
Are individual queries faster than joins?
Conceptual question: Are individual queries faster than joins, or: Should I try to squeeze every info I want on the client side into one SELECT statement or just use as many as seems convenient?
TL;DR: If my joined query takes longer than running…
Martin
- 2,420
- 4
- 25
- 35
49
votes
2 answers
Configuring PostgreSQL for read performance
Our system writes a lots of data (kind of Big Data system). Write performance is good enough for our needs but read performance is really too slow.
The primary key (constraint) structure is similar for all our tables:
timestamp(Timestamp) ;…
JPelletier
- 593
- 1
- 5
- 6
49
votes
1 answer
Dump only the Stored Procedures in MySQL
I need to dump only the stored procedures : no data, no table creation. How can I do this using mysqldump?
nakhli
- 733
- 2
- 7
- 10
49
votes
5 answers
ALLOW_SNAPSHOT_ISOLATION and READ_COMMITTED_SNAPSHOT
Most of the forum and example online always suggest to have both ALLOW_SNAPSHOT_ISOLATION and READ_COMMITTED_SNAPSHOT set to ON whenever someone is asking snapshot, row versioning or similar question.
I guess the word SNAPSHOT in both setting get a…
Travis
- 2,315
- 2
- 20
- 25
49
votes
6 answers
MySQL Set UTC time as default timestamp
How do I set a timestamp column whose default value is the current UTC time?
MySQL uses UTC_TIMESTAMP() function for UTC timestamp:
mysql> SELECT UTC_TIMESTAMP();
+---------------------+
| UTC_TIMESTAMP() |
+---------------------+
| 2012-07-01…
Adam Matan
- 11,659
- 29
- 80
- 95
49
votes
6 answers
In MySQL, does the order of the columns in a WHERE clause affect query performance?
I am having performance issues on certain database queries that have large possible result sets.
The query in question, I have three ANDs in the WHERE clause
Does the order of the clauses matter?
As in, if I put the ASI_EVENT_TIME clause first…
Patrick
- 4,229
- 7
- 28
- 28
49
votes
3 answers
MongoDB using too much memory
We've been using MongoDB for several weeks now, the overall trend that we've seen has been that mongodb is using way too much memory (much more than the whole size of its dataset + indexes).
I've already read through this question and this question,…
SpiXel
- 991
- 1
- 9
- 13
48
votes
2 answers
Difference between Hash, Merge and Loop join?
In SQL Server you can specify the join hints:
HASH JOIN
MERGE JOIN
LOOP JOIN
What is the definition of those three join hints, and when should each be used?
Andrew Bickerton
- 3,234
- 5
- 29
- 38
48
votes
10 answers
How do I copy a table with SELECT INTO but ignore the IDENTITY property?
I have a table with identity column say:
create table with_id (
id int identity(1,1),
val varchar(30)
);
It's well known, that this
select * into copy_from_with_id_1 from with_id;
results in copy_from_with_id_1 with identity on id too.
The…
bernd_k
- 12,211
- 23
- 75
- 111
48
votes
5 answers
Is nested view a good database design?
I have read somewhere long time ago. The book states that we should not allow to having a nested view in SQL Server. I am not sure the reason why we can't do that or I might remember incorrect statement.
Students
SELECT studentID, first_name,…
Richard Sayakanit
- 927
- 2
- 8
- 12
48
votes
2 answers
What is the actual behavior of compatibility level 80?
Could somebody provide me with a better insight about the compatibility mode feature? It is behaving different than I expected.
As far as I understand compatibility modes, it is about the availability and support of certain language structures…
souplex
- 833
- 1
- 8
- 10
48
votes
6 answers
Can I see Historical Queries run on a SQL Server database?
Someone was running a query on our SQL Server database remotely and their system crashed.
They have no backup of that query and want to see what was run on the server.
Is it possible to find this query in a log or in a history somewhere?
user87094
- 583
- 1
- 4
- 4
48
votes
3 answers
How to speed up queries on a large 220 million rows table (9 gig data)?
The issue:
We have a social site where members can rate each other for compatibility or matching. This user_match_ratings table contains over 220 million rows (9 gig data or almost 20 gig in indexes). Queries against this table routinely show up in…
Ranknoodle
- 641
- 1
- 6
- 8