Problems displaying this newsletter? View online.
SQL Server Central
Featured Contents
Question of the Day
Redgate SQL Prompt
The Voice of the DBA
 

Daily Coping Tip

Avoid saying “I ought to” or “I should” to yourself

I also have a thread at SQLServerCentral dealing with coping mechanisms and resources. Feel free to participate.

For many of you out there working in a new way, I'm including a thought of the day on how to cope in this challenging time from The Action for Happiness Coping Calendar. My items will be on my blog, feel free to share yours.

The Challenges of Splitting a Table

I ran across a discussion on Reddit about splitting a table. In this case, the original post had to do with a vertical partition of data, which is a technique that can help you better manage data in your database. However, I haven't often seen this technique employed in the real world.

I wonder how many of you have considered a vertical partition when you are modeling data. Often we may not think about this early in the lifecycle of an entity, but as it grows, you might think about reducing the amount of data you often query in some way, and a vertical partition can help.

Is there some criteria that you might use in deciding this? Or how you can evaluate if there is a need? I once worked on a system with a very hot table, lots of queries, lots of updates against this table from our online system. In response to some requests, the developers wanted to add some columns to the table. This was important, and we needed to capture the data.

These were valid columns, but they were large in terms of data size, and not every one would always be used. This was before the option of sparse columns, so that wasn't an option. I had no interest in an EAV table, despite the fact that it might have worked well at this scale. Instead, this was a situation where I thought a vertical partition would work. In fact, I thought a few of the other columns in this entity could be moved as well, as they were rarely queried and contained significant data.

We split the table, and performance actually improved for the main table, as it had less data. Just like an index, we had more rows on every page and less IO for range queries, and even key lookups for data that wasn't already indexed.

There are lots of good techniques in database development for dealing with the challenges we face in data modelling and with performance. I'd urge you to learn about some of them and understand when they can be useful. I would also practice implementing them, making changes to existing tables, and learning how you can deploy them if the need arises.

Steve Jones - SSC Editor

Join the debate, and respond to today's editorial on the forums

Redgate SQL Prompt
 
 Featured Contents

Indexes: When Column Selectivity Is Not Always A Requirement

Mike Byrd from SQLServerCentral

While preparing for my SQL Saturday Salt Lake City presentation, Climbing the B-Tree, I ran into one of the “word of mouth” facts that the first column of an index should be highly selective, i.e., it should only point to one or a few rows. This is not always the case and I’ll show you […]

SQL Server Wait Stats Monitoring with PowerShell

Additional Articles from MSSQLTips.com

In this article we add another module to the PowerShell monitoring process to capture wait stats for all monitored SQL Server instances.

From the SQL Server Central Blogs - Automate Credit Card Audits

SQLRNNR from SQL RNNR

In this article, I have shown how to use the power of automation to help identify the risk of having card data stored in the database. Identifying this risk...

From the SQL Server Central Blogs - Automation Ideas for T-SQL Tuesday #130

Steve Jones - SSC Editor from The Voice of the DBA

This month we have another great T-SQL Tuesday topic, and again, a host that I pressured into writing the invitation. Elizabeth Noble (@SQLZelda) and I were talking DevOps last...

 

 Question of the Day

Today's question (by Steve Jones - SSC Editor):

 

Finding Perfmon Data

I've got some scripts on my SQL Server 2017 server that uses sysperfinfo to read performance counter data. I know this code should be upgraded, but what DMV should I use?

Think you know the answer? Click here, and find out if you are right.

 

 

 Yesterday's Question of the Day (by Steve Jones - SSC Editor)

Correcting Server Memory

I set the max server memory on one of my SQL Server 2017 instances to  128MB. This causes problems when the server reboots. What should I do to get the instance to start?

Answer: Set the -f option in the services applet

Explanation: The -f option will start SQL Server in minimal configuration, allowing you to connect and reset the config. Then stop the instance, remove the option, and restart it again. Ref:

Discuss this question and answer on the forums

 

 

 

Database Pros Who Need Your Help

Here's a few of the new posts today on the forums. To see more, visit the forums.


SQL Server 2017 - Administration
How does sql server agent access the azure storage blob - Good morning all , I must configure an automated backup to an azure blob storage in the backup script I have correctly configured the credential now what right is needed for the sql server agent startup account to access the storage azure blob thank you for your help
SQL Server 2016 mdf encrypted by ramsomware - Hi, I'm a accidental DBA and had an ramsomware attack today. I stopped the attack but it encrypted the mdf file but not the log. I have a backup from yesterday, so i "only" need to recover a few hours of transactions. However, is it possible to use the log to "rebuild" the mdf up […]
SQL Server 2016 - Administration
trace flag -T460 not working - So this is probably me being a div. 2016 SP1 I've enabled -T460 in my starting params via SSCM & restarted.  I can see this "applied" in the "registry start up parameters..." line in the errorLog. When I try an insert that results in the "string or binary data would be truncated" error I still […]
SQL Server 2016 - Development and T-SQL
SUM and JOIN 2 columns with different tables but did not SUM Qty - Good day! Need help re SUM and JOIN 2 columns with different tables but did not SUM qty and duplicates row result here's the sample data tables; Transfer Shipment table; TransTO - TransFROM -  ItemNo   -   Desc   -   Desc2   -   VariantCode   -   Qty Location1      HO               Item01         Active      Black […]
Formatting dates returned in query - I have a statement below in a query that is returning the invoiced date as 2020-08-24 22:00:10.493 How can I get those query results in MM-DD-YYYY which I think is format 101?   SELECT I.InvoiceDate
SQL Server 2019 - Administration
Can't delete auto created statistics on SQL Server 2019 - Hi, I'm have sysadmin rights but it is not possible for me to delete auto created statisitcs. I receive the message, that the statistic doesn't exits or I do not have enough rights to do this.   drop statistics [company$Sales Line].[_WA_Sys_00000001_73A22229]; What can I do to delete the auto created statistics.
SQL Server 2019 - Development
How to write query for multiple rows into a single row for different columns - How to write query for multiple rows into a single row for different columns in SQL Server While storing in table, I am inserting like below. CountryIDCityID TownID 10 6 11 10 6 12 10 3 11 10 3 12 10 3 13 11 9 11 11 9 12 11 14 11 11 14 12 […]
Creating a unique Batch ID for Update - Hi There, I'm trying to write a query that sets a batch of rows to have a single uniquely generated ID on the fly. Tried lots of things and just can't get it right. Below are sample scripts to create the table and insert some test data along with two update queries that do not […]
SQL Help - Beginner 2* - Hello, I'm back again with another problem.   I ran this through a syntax checker and I got no errors, but when I put it in my IDE I always get this same issue:   Can someone help me out here?
Reporting Services
Condition Based Parameter - SSRS - Hi, I have a situation that I am unable to find any solution by browsing. I have an internal parameter @Category which has to be passed null value to StoredProc if we select @subCategory option "All". If we select any other value in @SubCategory drop down, I need to pass the selected value to Dataset […]
General
Import a large SQL query definition from a text file - The query definition has about 75 lines.     It is part of an Excel VBA routine in which I connect to a MS SQL database using ADO.  One reason to go with an external file is to avoid adding the line break characters such as  " & _  at the end of every line. I […]
Powershell
Need Powershell script to change SQL Server service password - Need sample Powershell script to change PWDS for SQL Server services (on many SQL Servers). We need to modify the SQL Server 'services' passwords (SQL Server, SQL Agent, IS, RS, AS) on several dozen SQL Servers. I am local admin and SQL sysadmin on every server - and I have all current service accts & […]
remove lines from flat file with no header - I have a file that has a delimiter of bar (|) and has no headers. I need a way to remove bad data rows if it meets criteria. Then create a new file with rows removed, and keep a log of the bad rows. This is my criteria for rows I don't want in the […]
Integration Services
Unable to cast COM object of type error using SSIS ODBC Connection to PostgreS - how to avoid Unable to cast COM object of type error using SSIS ODBC Connection to PostgreSQL I want load data from postgres to sql server using ssis package . In ssis solution I have 50 plus dft for loading data from postgres to sql server . source is postgre connecting using odbc connection and […]
Certification
Gaining knowledge - All, I would appreciate some opinions on a few questions. I appreciate that some of it's subjective and I'm not looking for definitive answers, just some advice or opinions. I've had a bit of experience of reading CV's and recruiting staff but not much. I'm currently unemployed looking for a new job. I have several […]
 

 

RSS FeedTwitter

This email has been sent to {email}. To be removed from this list, please click here. If you have any problems leaving the list, please contact the webmaster@sqlservercentral.com. This newsletter was sent to you because you signed up at SQLServerCentral.com.
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved.
webmaster@sqlservercentral.com

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -