Posts

Performance: SQL Server vs MongoDB (JSON data)

Anyone reading the title of this post may immediately start to question my sanity and/or competency. After all, SQL is a relational datastore and MongoDB is a document datastore, and wouldn't it just be obvious that a document datastore would be more effective at storing unstructured JSON documents? I have been learning more about NoSQL databases and that's the common wisdom, but I've been around long enough to doubt any hype over any technology. I want to know: how much better? Do the new JSON features in SQL Server 2019 compare well? I wanted to see how both systems perform when the rubber meets the road. Setup To do the comparisons, I'm using DICOM files as the data. The protocol details are too deep to get into here, but they're used in health care to transfer information and images between systems. They are distinct documents, with information stored in tags and sequences, and readily translate to a JSON format . Here's a full example . Updates are not rea...

Adding Font Awesome to .NET MAUI App

First, download the desktop version of the Font Awesome fonts. https://fontawesome.com/download Extract the .OTF files to the project's Resources/Fonts folder. You can rename the files to something easier to type/read, if desired.  After copying, check the properties on the files and make sure the Build Action = "MauiFont". Open the MauiProgram.cs file and add the new fonts to the app builder. public static class MauiProgram {   public static MauiApp CreateMauiApp() {     var builder = MauiApp.CreateBuilder();     builder       .UseMauiApp<App>()       .ConfigureFonts(fonts => {         fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");         fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");         fonts.AddFont("FontAwesome6Brands.otf", "FontAwesomeBrands");         fonts.AddFont("FontAwesome6Regular.otf", "FontAwesomeR...

Top Fives (Movie Edition)

Apropos of nothing, here's some of my top 5 lists of favorite movies. Some of the lists have more than five because I couldn't narrow them down any farther. Some count more than one movie together because I think they work better as a singular work of art versus a single movie. Purely subjective, and in no particular order. Action 13th Warrior The Bourne Identity Rambo First Blood John Wick Mad Max Fury Road Comedy Game Night Scott Pilgrim vs. the World Bill & Ted's Bogus Journey Monty Python & the Holy Grail Army of Darkness Back to the Future Groundhog Day O Brother, Where Art Thou? Oscar Beerfest Spaceballs Drama Braveheart Twister EDTV Empire Records The Truman Show Family Kung Fu Panda (trilogy) The Muppets Christmas Carol The Goonies Hook Toy Story 1 & 2 Fantasy Lord of the Rings (trilogy) Willow How to Train Your Dragon The Princess Bride The Dark Crystal Horror The Thing Jacob's Ladder The Cabin in the Woods Event Horizon Predator 1 & 2 Mystery T...

Improving a cheap barbell

Image
 My home gym equipment is cheap and second-hand, but it works for me, except for a minor issue with the barbell. It is a cheap hex bolt barbell that I picked up at a garage sale, and although it's straight it wasn't stored properly and there was some rust in between the shaft and the sleeve at the very end. The red area in the diagram below shows where it would stick and keep from rotating properly. I tried disassembling it and cleaning it, which helped a bit but didn't fix the issue. So, with a flash of inspiration I searched and purchased a cheap pair of roller thrust bearings. They were 4 mm thick, with the right inner and outer diameter to fit around the problem area and separate the shaft and sleeve.  They work perfectly, and now the sleeves and weights rotate smoothly.

Comparing SELECT Performance of Joining Integers vs GUIDs in SQL Server

Image
Overview There are plenty of online conversations and articles asking which makes a better primary key: INT or GUID? There are pros and cons to both, but from my perspective the winner is  INT  by a small margin. As shown in this article , as long as the indexes are maintained to keep fragmentation down the performance is similar, with  INT  slightly ahead in both index size and the speed of CRUD operations. The key is storing the GUID as a UNIQUEIDENTIFIER datatype and never using VARCHAR. Not only is SQL Server less efficient at comparing strings, there's also a chance to run into collation issues comparing across databases. In these discussions, one thing I haven't seen is a comparison of SELECT performance when joining different datatypes. After all, it's rare to find queries that don't stretch across multiple tables in a relational database. I used the StackOverflow2013 database (83 GB size) for testing. Download a copy for yourself from Brent Ozar's  fanta...

Cleaning a Cat Tree

If you have a cat and a cat tree, you probably have the same problem. At least once a year, it's necessary to take a vacuum to the cat tree to clean off the clumps of cat hair that seem woven into the carpeting. In the past, I've just used the brush attachment for the vacuum, which is better than the normal vacuum hose, but ends up as a 15-minute toil, working away at the bits of hair. So yesterday, as I prepared to do it again, a thought occurred to me. What would happen if I used a de-shedder tool on the carpeting? I have a Furminator that I used on a regular basis with my cats and dogs, and it's always done a great job for grooming their hair.  So, I gave it a try, and the answer is that it works amazingly well. The metal teeth are able to really grab and pull the hairs out from the carpeting, and it's also easy to get into the corners where the hair gets matted and nasty. Once I brushed over the entire surface, which only took a few minutes, I gave it another once...

Automatic SQL Server Database Documentation

Recently, I've been looking for a good way to automatically generate a data dictionary for multiple databases. Some are internally developed, and others are vendor-provided. My company already had licenses for SAP Power Designer, but the reports generated by that software didn't have a great layout for end-users, and reverse-engineering a PDM from a database would choke on the complicated databases with 100+ tables and other objects. I needed an easy way to use a database or SQL script to generate the documentation. Criteria: Open-source is preferred, but not mandatory HTML or PDF output List basic objects like tables, indexes, and foreign key references to other tables Show the details on each object, like datatype and included index columns Showing information in extended properties would be nice, but not necessary Editing the metadata would not be necessary, as that wouldn't be allowed on vendor db's Cross-platform support for MS SQL, DB2, and MySQL A w...