Most Popular

1500 questions
28
votes
1 answer

Is the eager spool operator useful for this delete from a clustered columnstore?

I'm testing deleting data from a clustered columnstore index. I noticed that there is a large eager spool operator in the execution plan: This completes with the following characteristics: 60 million rows deleted 1.9 GiB TempDB used 14 minutes…
James Lupolt
  • 4,258
  • 5
  • 27
  • 45
28
votes
5 answers

What are some ways to implement a many-to-many relationship in a data warehouse?

The dominant topologies of Data Warehouse modelling (Star, Snowflake) are designed with one-to-many relationships in mind. Query readability, performance, and structure degrades severely when faced with a many-to-many relationship in these modelling…
Brian Ballsun-Stanton
  • 4,731
  • 2
  • 29
  • 36
28
votes
4 answers

Copying (hundreds of) tables from one server to another (with SSMS)

I have several hundred (currently 466, but ever growing) tables I have to copy from one server to another. I have never had to do this before, so I'm not sure at all on how to approach it. All the tables are in the same format: Cart
Der Kommissar
  • 1,513
  • 1
  • 15
  • 27
28
votes
2 answers

Mongo Create a user as admin for any database raise an error

I am trying to create a simple user with the rights permission to access to any database and can do any actions. When I trying to execute the createUser command I got this error: db.createUser({ user: "mongoadmin" , pwd: "mongoadmin", roles:…
Robert
  • 695
  • 3
  • 12
  • 20
28
votes
5 answers

How to examine PostgreSQL server's SSL certificate?

Suppose there is a PostgreSQL server running and it has SSL enabled. Using "standard" Linux and PostgreSQL tools, how can I examine its SSL certificate? I'm hoping for output similar to what you would get from running openssl x509 -text .... And…
csd
  • 640
  • 1
  • 6
  • 11
28
votes
5 answers

SELECT DISTINCT on multiple columns

Supposing we have a table with four columns (a,b,c,d) of the same data type. Is it possible to select all distinct values within the data in the columns and return them as a single column or do I have to create a function to achieve this?
Fabrizio Mazzoni
  • 1,940
  • 4
  • 22
  • 31
27
votes
2 answers

Transactional DDL workflow for MySQL

I was a little surprised to discover that DDL statements (alter table, create index etc) implicitly commit the current transaction in MySQL. Coming from MS SQL Server, the ability to do database alterations in a transaction locally (that was then…
sennett
  • 370
  • 4
  • 7
27
votes
8 answers

A query that lists all mapped users for a given login

When looking at the properties of a particular login, it's possible to see a list of users mapped to that login: I profiled SQL Server Management Studio (SSMS) and I see that SSMS connects to every database one at a time and retrieves information…
Michael J Swart
  • 2,059
  • 5
  • 22
  • 31
27
votes
4 answers

How to find the latest SQL statements within the database?

I like to get the latest executed statements within my database, along with performance indicators. As such, I like to know, which SQL statements were most CPU/DISK intensive.
Sebastian Roth
  • 1,356
  • 3
  • 15
  • 23
27
votes
3 answers

How to select multiple columns but only group by one?

I have a problem with group by, I want to select multiple columns but group by only one column. The query below is what I tried, but it gave me an error. SELECT Rls.RoleName,Pro.[FirstName],Pro.[LastName],Count(UR.[RoleId]) as [Count] from…
Nayeem Mansoori
  • 371
  • 1
  • 4
  • 7
27
votes
2 answers

What happens in PostgreSQL checkpoint?

Here's part of my checkpoint log: 2014-03-26 11:51:29.341 CDT,,,18682,,532854fc.48fa,4985,,2014-03-18 09:15:24 CDT,,0,LOG,00000,"checkpoint complete: wrote 15047 buffers (1.4%); 0 transaction log file(s) added, 0 removed, 30 recycled; write=68.980…
Konrad Garus
  • 633
  • 2
  • 7
  • 7
27
votes
6 answers

Is table aliasing a bad practice?

I remember learning to do this in a DBMS course for Master of Information Services students. To save yourself some typing, you can type: SELECT t1.id, t2.stuff FROM someTable t1 INNER JOIN otherTable t2 ON…
Ben Brocka
  • 2,063
  • 6
  • 28
  • 38
27
votes
1 answer

Why are queries causing spill to tempdb?

Background I am in the process of migrating a 160gb database from MSSQL 2008 (standard) on a Win 2008 server with 48gb RAM to a new server running MSSQL 2012 (64-bit web edition) on Win 2012 with 64gb of RAM. The old server is live and under load;…
Andy W
  • 411
  • 1
  • 5
  • 4
27
votes
5 answers

SQL Server 2012: Generate Scripts from command line

I am running SQL Server 2012. The SQL Server Management Studio has the option to right click on a database then select Tasks and Generate Scripts. Is there a way to automate that via command line somehow? I want to create a script that includes the…
Harald
  • 413
  • 1
  • 5
  • 6
27
votes
5 answers

How to make SSMS upper case keywords

I recently started using Management Studio 2012. When using MySQL Workbench, a handy feature was that I could stay all in lower case and any reserved word (like SELECT, INSERT) would convert to upper case automatically. How do I replicate this…
David Folksman
  • 769
  • 3
  • 8
  • 13