thanks for responding. I haven't used chat much so forgive me if I miss some etiquette or common practice.
I am the creator of a SQL CLR library of functions to extend what can be done in T-SQL. SQLsharp.com
I had proposed a) including the Free version in SEDE, and b) including SEDE-specific functions (in the Free version, obviously).
Ah, okay. The Contact Us people were a bit off, then. This isn't actually a question for me, but for @nickcraver since it would need his blessing first.
So, again, I am talking about the FREE version so there are no licensing issues no matter which method is chosen..
A) SQL# could be added via the installer SQL script that can be downloaded from the site and added to the GitHub repository in the folder with the other SQL scripts....
The only dependencies would/could be in the queries that people write if they reference the functions.
Since SQL CLR Assemblies are backed up with the database, depending on how the monthly updates are distributed to folks, if an actual SQL backups (instead of CSV export), then it would naturally already be there with nothing more for anyone to do :)
So yes, I or someone else could just add the single SQL script, already edited with whatever DB name you currently have in the other scripts, or none at all if the current DB is assumed
I mention the SAFE permission_set since some folks might have concerns about doing EXTERNAL_ACCESS on the hosted SEDE. But I can't think of any reason those functions would be needed in that context anyway.
19:57
Yeah, that all makes sense. It's mostly just a question of how Nick feels about it, since he has stewardship over the project. I can certainly see the value in what you're proposing from the general perspective of making Data Explorer more powerful out of the box, but I also share his concerns about performance et al on the actual hosted instance.
The mark-down formatting idea was a result of this question and my answer there (which makes less sense once the OP informed us of what he was trying to do): stackoverflow.com/questions/25048739/…
And depending on what work-arounds are being done to handle CURSOR like queries, it could actually lead to performance improvements
So, that is the overall idea. I am always available to answer questions regarding implementation, concerns regarding performance, etc.
SQL# even includes UTC to Server Local Time conversion functions. I assume the data is stored in UTC so this would make it easier to people running it locally to get data in their timezone that is Daylight Savings-aware :).
20:14
Well, in that specific case of allowing user-defined regexes to be executed, it's certainly possible to create a very performance-detrimental statement. With more purpose-built functions that's obviously less of an issue, since they have better defined performance characteristics. But I'll let Nick defend his position, I don't want to put words in his mouth. :P
Understood. I will just say that as MartinSmith pointed out in those comments, it is just as easy to write horribly inefficient T-SQL code. And Nick then mentioned that GC doesn't run on the same schedule as native .Net apps, but I have only ever heard of one problem in that regards where GC didn't run when the server was experiencing memory pressure, but that was in 2008/R2 or 2012 SP1 and there was a Cumulative Update that fixed it that I assume was included in SP2.
I understand. I can just say a) there is no inherent reason to assume performance problems, b) as you just sad, ad hoc T-SQL is just as risky when people can do a LIKE '%...' WHERE clause on a table that is CROSS JOINed to itself ;-) , and c) if it does become a problem then it can be turned off.
Keep in mind also that streaming TVFs (and I tried to make most of the SQL# TVFs to be streamed) are much less tempdb intensive as they release their results as each row is created instead of filling up a table variable.
I realize that people cannot write TVFs in SEDE, but that forces them to do table variable and temp tables that increases contention on tempdb whereas the SQL# stuff might be a way to avoid that usage and reduce that contention..
Granted, for pattern matching that can be done via CHARINDEX / PATINDEX, those will be more efficient than a CLR RegEx (in most cases). But for any sufficiently complicated pattern, a single RegEx will be more efficient than multiple queries or case statements within case statements within CROSS APPLY operators to only maybe possibly get the flexibility of an intermediate-level RegEx. I am not trying to be pushy here, just trying to put everything in its proper context :).
As far as perceived security risk goes, there really are none, especially in the context of assemblies with a
PERMISSION_SET
of SAFE
. I wrote an article that walks the issue through, step-by-step, across various scenarios: sqlservercentral.com/articles/SQLCLR/109905 (free registration required). next day → last day (22 days later) »