Posts

Showing posts from December, 2019

Draw with SQL Server, plot the Mandelbrot set!

Image
Carissimi lettori, Siamo giunti all'ultimo articolo di quest'anno. Primi 5 mesi di vita di questo blog e circa 65 articoli che spero vi siano tutti piaciuti! Il mio impegno per essere il più chiaro possibile ce l'ho messo tutto! Come vi avevo anticipato questo sarà un articolo più curioso e divertente. Vediamo come disegnare con SQL Server. Hi guys! We have reached the last article of this year.  First 5 months of life of this blog and about 65 articles that I hope you enjoyed!  I put my best effort into being as clear as possible!  As I anticipated, this will be a more curious and fun article.  Let's see how to draw with SQL Server.   Introduction Già ma cosa disegniamo? Disegnamo l'insieme di Mandelbrot che è l'insieme dei numeri complessi c per i quali la funzione:   quando iterata da Z=0 non diverge. Questa funzione prende il nome dal matematico Benoit Mandelbrot ed è un esempio di frattale. Ora sia Z che c sono due numeri co

SQL Server, A problematic Query with a Nested Loop and a huge list of ID

Image
Cari lettori, Oggi parliamo ancora una volta di prestazioni analizzando un caso pratico che mi è capitato recentemente. Solo con una buona conoscenza del funzionamento interno di SQL server possiamo far si che le nostre Query siano il più veloce possibile! Hi Guys, Today we speak about performance seeing a real case just occoured to me. Only by knowing well the inner workings of SQL server we can run our queries as fast as possible!   Introduction Recentemente mi sono trovato di fronte ad questa Query:     Select A.ID, [...] From <Tabella> A JOIN [...] Where A.Id in (4,5, .. <elenco di migliaia di ID> .. ,44174) and A.codice Like N'0031537%' La prima condizione dopo la clausola WHERE conteneva migliaia di valori di ID e la sua esecuzione impiegava ben 20 secondi! Vediamo di capire perchè questa Query è poco performante? Per farlo partiamo osserviamo il piano di esecuzione! Recently I found mysel

SQL Server, Il vostro "super cliente" è bloccato! (MSQL_DQ e PREEMPTIVE_COM_QUERYINTERFACE Wait states)

Image
Carissimi lettori, Intanto ben ritrovati! Oggi continuamo con la serie che ha riscosso tante visualizzazioni qualche mese fa:  La megaditta è bloccata!   parlandovi di un recente problema che mi si è presentato. Sarà l'occasione per tornare a parlare di Wait States ovvero dei tipi di attesa . " Guardare ai tipi di attesa è un po come leggere le analisi del sangue. Certo non basta ma ci fornisce davvero tante indicazioni " P.S. Probabilmente seguirà anche l'articolo in inglese per tutti gli amici che mi seguono all'estero! Buona lettura! Il vostro "super cliente è bloccato"! Un caso reale! Driiin… Arriva la segnalazione! Il vostro "super cliente" titolare della nota "Megaditta" ieri che non riesce più a lavorare! Sperimenta dei blocchi ed inoltre, parecchie delle funzioni del vostro gestionale, sono diventate estremamente lente! Prima ancora che la pressione inizi a salire e che l’ ambiente inizi a riscaldarsi

SQL Server, Math and Applications

Image
Hi Guys! It's been a while since I wanted to write an article like this. I had it in my head and it reminded me of one of those articles I read in computer magazines many years ago. Many years ago computer science, at least for me, always had a background of mystery and excitement due to the discovery of something new. Look what you can do with the computer! people said! In the last article we saw how in SQL Server, using a float data type, when we store a number very often we store a slightly different one. This is the reason why rounding problems arise during certain operations. You can read it here: SQL Server, DECIMAL and FLOAT data types. Are you ready to deep dive into the secrets of SQL Server? Today we totally change the subject ..  Let's see some mathematical concepts and then we will try to put into practice through SQL Server in order to get a new functionality that will be very useful! Carissimi lettori, E' un po che volevo scrivere un arti