Most Popular

1500 questions
40
votes
2 answers

What's the point of WHERE 1=2 for SELECT INTO table query

If we want to create a new table from an existing one in SQL Server we can do the following SELECT * into Table2 from Table1 WHERE 1=2 Whats the point of where clause? I tried it without the where clause and it ran fine. I've seen this where clause…
Muhammad Hasan Khan
  • 683
  • 2
  • 6
  • 11
40
votes
1 answer

USING construct in JOIN clause can introduce optimization barriers in certain cases?

It was brought to my attention that the USING construct (instead of ON) in the FROM clause of SELECT queries might introduce optimization barriers in certain cases. I mean this key word: SELECT * FROM a JOIN b USING (a_id) Just in more complex…
Erwin Brandstetter
  • 175,982
  • 27
  • 439
  • 600
40
votes
1 answer

Would using varchar(5000) be bad compared to varchar(255)?

Since varchar anyways allocate space dynamically, my question is whether using varchar(255) be more efficient or save more space compared to using varchar(5000). If yes, why?
Tintin
  • 503
  • 1
  • 4
  • 7
40
votes
2 answers

What does a DBA have to know about SSAS?

I've seen a lot of material covering the business aspect of SSAS, but not really much about the important aspects of administration and management. From the point of view of administering an instance of SQL Server Analysis Services, what does a…
ivanmp
  • 2,323
  • 3
  • 24
  • 35
40
votes
3 answers

Methods for finding new Trace Flags in SQL Server

There are a lot of Trace Flags out there. Some are well-documented, some are not, and others found their way to default behavior status in the 2016 release. Aside from official support channels, Microsoft employees, etc., what are ways to find new…
Erik Darling
  • 40,781
  • 14
  • 130
  • 456
40
votes
1 answer

Should I use many single field indexes, instead of specific multi column indexes?

This question is about the effectiveness of a SQL Server indexing technique. I think it is known as "index intersection". I'm working with an existing SQL Server (2008) application that has a number of performance and stability issues. The…
RaoulRubin
  • 969
  • 2
  • 10
  • 12
40
votes
2 answers

IF EXISTS taking longer than embedded select statement

When I run the following code it takes 22.5 minutes and does 106million reads. However, if I run just the inner select statement by itself it only takes 15 seconds and does 264k reads. As a side note, the select query returns no records. Any idea…
Chris Woods
  • 1,771
  • 1
  • 16
  • 22
40
votes
4 answers

mysqldump vs mysqlpump

I just heard about mysqlpump - it looks like it was released with MySQL 5.7, however MySQL 5.7 still includes mysqldump. They're both backup programs, but could anyone summarize the main differences? Are there scenarios where one of them might work…
Ryan Foley
  • 541
  • 1
  • 5
  • 7
39
votes
1 answer

How do I read Query Cost, and is it always a percentage?

I'm currently studying for SQL 70-433 (the Microsoft Certification exam), and I'm getting very confused about the "query cost" performance metric. According to any documentation I could find via Google, the query cost is a percentage figure, and…
Born Again Geek Girl
39
votes
2 answers

Can I select data inserted in the same uncommited transaction?

Maybe this is a dumb beginner question, but I cannot find an answer anywhere. Everywhere I read about the Transaction Isolation which solves the visibility of data within the concurrent transactions. My concern is the behavior within a single…
NumberFour
  • 577
  • 1
  • 7
  • 10
39
votes
7 answers

How to determine the size of my tables in the SQL Server database

Is there any built-in function/stored procedure/query which is helpful to retrieve information about the size of MyTable in the SQL Server database?
Heisenberg
  • 1,505
  • 5
  • 18
  • 31
39
votes
4 answers

Difference between MongoDB's find and findone calls

I am working on a project and I am unsure if there is a difference between the way the find cursor works and the way the findOne cursor works. Is findOne just a wrapper for find().limit(1)? I was looking around for it and maybe someone knows if…
WojonsTech
  • 652
  • 1
  • 5
  • 11
39
votes
2 answers

Multi cores and MySQL Performance

Importance of RAM is an established fact but far less material is available about the importance of cores and multithreading when it comes to the usage of CPU by MySQL. I am talking about the difference of running MySQL on 4cores vs 6cores vs 8cores…
Rick James
  • 1,271
  • 3
  • 15
  • 19
39
votes
4 answers

MySQL relay log corrupted, how do I fix it? Tried but failed

A MySQL v5.1.61 relay got corrupted when the machine suddenly shut down. I tried to fix it but it didn't work. — How do I fix it? Did I do something wrong? As far as I've read, corrupted MySQL relay logs are easily fixed: change master to…
KajMagnus
  • 1,209
  • 2
  • 14
  • 21
39
votes
7 answers

save/export PGAdmin server list configuration settings

I have a ton of configured connections listed in the Server Groups, is there a way I can save this? not just save the passwords but the Server Group Settings
Phill Pafford
  • 1,365
  • 6
  • 18
  • 26