The result of the query seems to be correct and the server executes it quickly.
But the root node of the execution plan has a warning:
Type conversion in expression (CONVERT_IMPLICIT(nvarchar(128),[o].[name],0)) may affect "CardinalityEstimate" in query plan choice
What does that mean in this context? Is such a complex filter confusing the optimizer? Is it something I should be worried about?
The warning is informational. If your query performed slowly, or you noticed that cardinality estimates were incorrect, the warning would give you information about where to look for a possible cause.
The warning is triggered by the implicit conversion used for the collation change. If using the collation is the easiest way to get correct results, feel free to leave it as it is. Alternatively, if you explain more about why it is needed, someone will advise you.
As an aside, the REPLACE
could be replaced with:
REPLICATE(N'[0-9A-F]', 8);
(This answer is a summary of the comments to the question.)
The warnings you're seeing most likely come from the sys.sysdepends view.
If you script it out using
EXEC sys.sp_helptext @objname = N'sys.sysdepends'
The definition has a bunch of converts and other nonsense going on.
CREATE VIEW sys.sysdepends AS
SELECT
id = object_id,
depid = referenced_major_id,
number = convert(smallint,
case when objectproperty(object_id, 'isprocedure') = 1 then 1 else column_id end),
depnumber = convert(smallint, referenced_minor_id),
status = convert(smallint, is_select_all * 2 + is_updated * 4 + is_selected * 8),
deptype = class,
depdbid = convert(smallint, 0),
depsiteid = convert(smallint, 0),
selall = is_select_all,
resultobj = is_updated,
readobj = is_selected
FROM sys.sql_dependencies
WHERE class < 2
UNION ALL
SELECT -- blobtype dependencies
id = object_id, depid = object_id,
number = convert(smallint, column_id), depnumber = convert(smallint, type_column_id),
status = convert(smallint, 0), deptype = sysconv(tinyint, 1),
depdbid = convert(smallint, 0), depsiteid = convert(smallint, 0),
selall = sysconv(bit, 0), resultobj = sysconv(bit, 0), readobj = sysconv(bit, 0)
FROM sys.fulltext_index_columns
WHERE type_column_id IS NOT NULL
sys.objects, on the other hand, is fairly straightforward.
CREATE VIEW sys.objects AS
SELECT name,
object_id,
principal_id,
schema_id,
parent_object_id,
type,
type_desc,
create_date,
modify_date,
is_ms_shipped,
is_published,
is_schema_published
FROM sys.objects$
The view definition for sys.sysdepends causes the same warnings when queried on its own.
SELECT *
FROM sys.sysdepends
In general, if you want to control datatypes and indexes and have some performance tuning ability when referencing system views or tables, your best bet is to dump them into a temp table first.
Best Answer
Basically, this could mean that the type conversion cannot effectively use an index. Cardinality is a important property of the indexes that you might use. For performance, the ideal is to have the data types match, instead of trying to convert them on the fly.
You will find Thomas LaRock's post on this useful: http://thomaslarock.com/2012/08/why-datatypes-matter-3-ways-they-can-hurt-performance/