I have a query which needs to filter against the result of a scalar UDF. The query must be sent as a single statement (so I can't assign the UDF result to a local variable) and I cannot use a TVF. I am aware of the performance issues caused by scalar UDFs, which include forcing the entire plan to...
Say we have below query ,
select a.*,b.*
from
a join b
on a.col1=b.col1
and len(a.col1)=10
Assuming above query uses Hash Join and has a residual,probe key will col1 and residual will be len(a.col1)=10
But while going through an example,i could see both probe and residual being the same colu...
"The ask is that you provide me with..."
I started hearing "ask" being used as a noun a few years ago. Is this a recent trend? Is it an East Coast thing, unique to North America, or just unique to the in-house vocabulary of telecommunications companies?
@PaulWhite not really, might encourage some bad design choices :). I tested in 2016. I thought perhaps date would work as well since it did with other "smallish" data types. But it did not.
In computer science, a perfect hash function for a set S is a hash function that maps distinct elements in S to a set of integers, with no collisions. In mathematical terms, it is an injective function.
Perfect hash functions may be used to implement a lookup table with constant worst-case access time. A perfect hash function has many of the same applications as other hash functions, but with the advantage that no collision resolution has to be implemented.
== Application ==
A perfect hash function with values in a limited range can be used for efficient lookup operations, by placing keys from...
The developers are going to hate me this afternoon :) I'm rebuilding a bunch of indexes with compression and I'm starting to see their requests being blocked
There are probably better places to focus your attention. For the fun of it, I tried this particular question which you posed and the query plans were identical.
If you're having performance issues, perhaps get yourself your free copy of the Brent Ozar's tools: https://www.brentozar.com/askbr...
create or alter function stupid_udf (@Id INT) returns bigint with schemabinding as begin RETURN (SELECT val from dbo.map_table where id = @id); --RETURN @Id; end;
@JoeObbish you'll have to wait though, I only have that permission in an SQL Server 2008R2 instance, and apparently I can't see sys.dm_exec_function_stats
@gbn well that's the problem (good to see you). it's not so much that i dislike AWS ... it's that i dislike the direction we're taking it. saying on 1 AZ (good call!) and they're pushing RDS even though i've highlighted many of the drawbacks
performance is worse than a similarly-configured EC2 instance restoring requires creating a new instance (yes. we restore a lot - especially to preprod) minimal control over file layout and other knobs (yes, i'm a control-freak DBA)
Anyone have any intuition as to why a SELECT * FROM .... query would perform worse than a SELECT * FROM .... WHERE x = '' query, when the queries return the same data minus two rows for the second? (SQL Server 2012)
(I don't have actual access to the database this happened on, but if what the person reported is true, that goes against everything I thought I knew.)
@sp_BlitzErik Why's that? Each one returned ~240k rows, the second returned two rows less than the first, but that's the only difference. I assumed that SQL Server used available indexes for the second to avoid a raw table scan, but I honestly have no idea.
@JoeObbish Eh, I wasn't the one who found it, was helping a colleague in a different chat room find out what was going on, I don't have access to any of the database used here.
@sp_BlitzErik That I'm not certain, colleague couldn't post execution plans.
@sp_BlitzErik Unclear, I assume not, but it could have been. What I do know is performance was several orders of magnitude different, like several seconds for SELECT * FROM... and less than half a second for WHERE x = ''.
@JoeObbish I have an actual data-set to test with now, and I'm seeing ~0.2-0.3s faster times for WHERE StrValue3 = '' which only filters two rows (the first two) out of this table. Possibly going to make it a main-site question if you care to comment on it.
@sp_BlitzErik - I love the OPs answer to your question about 27 indexes on individual columns. I don't think he gets it at all, and I don't think he knows about INCLUDE.
>Consider that you execute a query that retrieves data from a clustered columnstore index in Microsoft SQL Server 2014 or 2016. If the data pages are too far apart, you may receive an access violation error.