Posts

SQL Server, why does the DELETE statement tend to be slow?

Image
Hi Guys, Today i will post only a small and very informat and short post. Just a question to make a little reflection:   Why DELETE statement tend to be slow?   Enjoy the reading!     Why DELETE statement tend to be slow? Surely you know that data is stored in databases within a series of tables.  When a database is in the 3rd normal form, tables are linked to each other through referential integrity. It is precisely referential integrity that guarantees data integrity.   Suppose we have to manage a list of person.   Our table tblperson will have a primary key (ID) and a number of fields such as name, email and gender.   The information relating to sex will be contained in another table (tblGender). it will also have a primary key ID field Beetween the field GenderID of the table tblPerson and the field ID of the table tblGender we define a referential integrity .  In T-SQL language we can do this by adding a foreign key to the TblPerson: ...

SQL Server: Cursors explained in a simple way. A trick before Christmas: how to make Cursors work faster!

Image
 Hi guys, Welcome back mates and happy sunday! Today an interesting post awaits us. Christmas is coming and so today free tricks for everyone! The trick of today is how to make cursors work faster . But first we will see what cursors are ( i know, there are a couple of posts that I don't talk about theory and I would not want you to lose the habit ... haha )   A personal premise: cursors are not known to be fast and I honestly don't find situations where it is preferable to use them. This is because I have this important concept in mind :  If we really want to help SQL Server execute queries, it is very important to pay attention to using "set-based logic" rather than single-line logic .  Why updating a table by making an update for each row when making a single one involving all the rows is certainly faster? But first let me give you a little introduction to the cursors.     Enjoy the post mates ...enjoy it! What is a cursor What is a cursor?  Wi...

SQL Server 2019 for WIndows 11 Vs. SQL Server 2019 for Linux ...who is the fastest? the battle!

Image
 Hi Guys, Welcome to this post.  In the previous posts here and here we have installed Windows 11 and SQL Server 2019 on a virtual machine and Ununtu (Linux) and SQL Server 2019 on another one. This was done to run benchmarks to verify which system is the fastest. Both VM has the same numerber of virtual processors (2), both has the same quantity of RAM (4gb) and both are installed on the same disk, a consumer samsung 1Tb SSD 860 qvo. From the management studio located in my pc we will connect in turn to the VMs with installed windows 11 and the VM with installed Ubuntu 20.04 lts. Enjoy the reading! How to connect to the VMs Connecting to the two VMs is simple! For the VM with windows, with the SQL server developer and express edition you need to enable the TCP/IP protocol : And open the TCP 1433 port in the firewall: To get the IP value simply open the command line and type the IPCONFIG command. For ubuntu VM machine, we need only to get the IP value by opening the terminal...

SQL Server, install Windows 11 and SQL Server 2019 step by step

Image
 Hi Guys, Welcome to the today's post.  In the past posts we have seen how to install ubuntu and SQL Server 2019 for Linux step by step. Right now I'm making the comparison benchmarks between SQL Server 2019 for Windows and the one for Linux (ubuntu 20.04 lts) so today I'll show you how to install Windows 11 and SQL Server 2019 always step by step . In fact, in the next post to make the comparison we will run the same T-SQL command script by launching it from a virtual machine with Windows 11 e SQL Server 2019 and on a Virtual Machine with ubuntu 20.04 lts and SQL Server obviously for Linux. This way the comparison will be even. Same amount of RAM and same disk (SSS). Enjoy the reading.   Windows 11 installation   First of all we need to go on this page of the microsoft site  and download the Windows 11 iso image. As of today this is the file I downloaded :     Run the VMware Player ( we have seen here how to install it ) and from the File Menu cho...