Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is NULL reads so high in my SQL trace?

I have inserted data from a sql trace in a table and I have a problem interpreting the data in table.

In the attached image the reads related to my SP are very low but on the next line for a value of NULL in Text Data column the reads are very high.

How do i interpret this.? Why the NULL rows have so high read values?

Edit: I have updated the image file. Now it has all the column names for initial 10 rows of my trace I could not find any EventType column, but there is an EventClass column which has value : 15 for every NULL row.

Screenshot

Profiler Screenshot

like image 306
Pawan Pillai Avatar asked Dec 22 '11 18:12

Pawan Pillai


People also ask

How do I fix NULL in SQL?

The ISNULL Function is a built-in function to replace nulls with specified replacement values. To use this function, all you need to do is pass the column name in the first parameter and in the second parameter pass the value with which you want to replace the null value.

Why am I getting NULL values in SQL?

A null value in a relational database is used when the value in a column is unknown or missing. A null is neither an empty string (for character or datetime data types) nor a zero value (for numeric data types).

Why should we avoid NULL values in SQL?

They should be avoided to avoid the complexity in select & update queries and also because columns which have constraints like primary or foreign key constraints cannot contain a NULL value.

Does NULL take up memory in SQL?

seems obvious, the answer would be no, null values don't take up space in pl/sql table in memory.


1 Answers

Check out the SQL Server Event Class reference. You determine the EventType by EventClass value. Some EventClass types come with a NULL value for TextData.

Also, here's a query that might help you out mapping the EventClass ID to the actual event type:

SELECT   te.name
FROM     dbo.Trace t 
         JOIN sys.trace_events te ON t.EventClass = te.trace_event_id

where dbo.Trace is the table where you save the EventClass values.

like image 56
TheBoyan Avatar answered Sep 22 '22 16:09

TheBoyan