Skip to main content

Timeline for How can I make this query sargable?

Current License: CC BY-SA 3.0

13 events
when toggle format what by license comment
Jan 12, 2015 at 19:11 vote accept Mansfield
Jan 9, 2015 at 1:47 history tweeted twitter.com/#!/StackDBAs/status/553367349039202305
Jan 9, 2015 at 0:58 history edited Mansfield
added version tag
Jan 8, 2015 at 21:47 answer added Paul White timeline score: 13
Jan 8, 2015 at 21:23 history edited Paul White CC BY-SA 3.0
Formatting, tags
Jan 8, 2015 at 20:19 comment added Mansfield @AaronBertrand Is it actually possible to perform that conversion in a computed column? I'm getting 'Explicit conversion not allowed', or if I use fn_sqlvarbasetostr it complains about specifying the master database, or not being able to find the function.
Jan 8, 2015 at 20:07 comment added Mansfield @AaronBertrand about 10k. I'm using openquery to limit to the most relevant rows before joining (I found it was faster than trying to join the whole table). The computed column idea is interesting, I'll take a look at that.
Jan 8, 2015 at 20:02 comment added Aaron Bertrand How many rows stored in DB2 (roughly)? Might make sense to pull them into a local table first, apply a function there, then join on like data types. You could also create a computed column locally so that both forms are represented, then join on the computed column.
Jan 8, 2015 at 20:00 comment added Mansfield @JNK Indeed, but I'm talking about running a function on a table with 60k rows (right now) vs one with 1000 (the second table) so I think there's still a performance improvement to be had.
Jan 8, 2015 at 19:59 comment added Mansfield @AaronBertrand Unfortunately, the actual situation is more complicated (as it often is). The second table is actually on a DB2 linked server that can't store a rowversion data type (and even if it could I don't think I could get it changed).
Jan 8, 2015 at 19:58 comment added JNK If you have to run a function on a column on one side of the join, you won't have a sargable query. Period.
Jan 8, 2015 at 19:54 comment added Aaron Bertrand Why do your two tables have the same value stored as two different data types? Can you fix that?
Jan 8, 2015 at 19:31 history asked Mansfield CC BY-SA 3.0