A SQL script to automatically infer the data types of data that someone just dumped in your DB with no effort
Do you know the feeling when someone gives you a flat file, without any schema information whatsoever, and you have to dump it in your database as-is, and then have to spend precious time to figure out the data type for each column?
Let me help you with that, as I'm helping myself too
How to lose hundreds of thousands of dollars by using functions in SQL Server
Ahh, functions, the greatest tool at a programmer’s disposal, they make code reusable and easy to read, they’ve been essential since the first function call was made in the last century… Unfortunately for the developers out there, when working for SQL Server, especially when tuning for performance, you need to get everything you knew about programming and throw it out of the...
Row Level Security Performance Implications
A conversation had me wondering about performance implications in SQL Server RLS feature, specifically on how to mitigate the performance impact;TL; DR; ? Since security functions are actually Inline Table Valued Functions (ITVF), if you write them in a decent way the queries will run in the most efficent way possibile, avoiding RBAR processing. Let’s set the case scene; I’m starting...
A script to automatically align columnstore indexes to enhance segment elimination (and hence performances)
Columstore indexes are a “new” neat data structure that I like, even if technically they’ve been around for years, only recently they’ve become usable by most customers. Let me recap a little bit what we’re talking about, so the point of this will be clearer: The table is divided in rowgroups of about one million rows max, then each column is stored by itself in a...
What’s the best way to massively update a big table?
A thing that can happen once in a while in a DW is the need to massively update a column in a table, let’s find out. I’ll be using the same table as last post , the lineitem table of the tpch test by HammerDB, the three contenders are: Heap Clustered Index Clustered Columnstore Index No other NonClustered index will be included in the base table. You should already know that each...