首页
\
问答
\
如果我在带有变量的sql server查询中替换hardcode 1 = 0,那么它会慢下来(If I substitue hardcode 1=0 in a sql server query with a variable it slows way down)
如果我在带有变量的sql server查询中替换hardcode 1 = 0,那么它会慢下来(If I substitue hardcode 1=0 in a sql server query with a variable it slows way down)
使用硬编码的1 = 0和1 = 1值测试查询。 当我为它们替换变量时,查询会慢下来。 和建议?
DECLARE @BoxType int SET @BoxType = 2 Select blah from table t INNER JOIN table2 t2 ON (t2.blah = t.blah AND 1=1 OR t2.blah = t.blah AND 1=0)
- 非常快
重写使用:
... INNER JOIN table t ON (t2.blah = t.blah AND @BoxType = 2 OR t2.blah = t.blah AND @BoxType = 1)
- 非常慢
Testing a query using hard coded 1=0 and 1=1 values. When I substitute a variable for them the query slows way down. And suggestions?
DECLARE @BoxType int SET @BoxType = 2 Select blah from table t INNER JOIN table2 t2 ON (t2.blah = t.blah AND 1=1 OR t2.blah = t.blah AND 1=0)
-- very fast
rewrite using:
... INNER JOIN table t ON (t2.blah = t.blah AND @BoxType = 2 OR t2.blah = t.blah AND @BoxType = 1)
-- very slow
原文:https://stackoverflow.com/questions/18921469
更新时间:2022-04-30 06:04
最满意答案
尝试将MenuCommand字段更改为property
public ICommand MenuCommand { get; set; }
希望这对你有用。 我没试过这个。
Try to change MenuCommand field to property
public ICommand MenuCommand { get; set; }
Hope this work for you. I haven't tried this though.
相关问答
更多-
如果您想要以30,60,90秒的间隔重复该动作: intervals.Zip(commands, ValueTuple.Create) .Select(x => Observable.Interval(x.Item1).Select(_ => x)) .Merge() .Subscribe(x => { x.Item2(); // Broken, x is a lon ...
-
这是一个非常古老的课程,可以追溯到JDK 1.0。 那时,没有List 。 It's a very old class, dating back to JDK 1.0. At the time, there was no List.
-
C#WPF中的上下文菜单绑定(Context Menu Binding in C# WPF)[2023-06-04]
使用DisplayMemberPath并将属性的名称放在项目上。 或者您可以使用ItemTemplate属性。 例:Use DisplayMemberPath and put the name of the property on your item. Or you could use the ItemTemplate ... -
使用反射将Observable Collection复制到另一个(Copy Observable Collection to another using reflection)[2022-02-13]
可以使用Enumerable.ToList扩展方法将集合复制到列表。 如果要通过反射检测类型 - Type.IsGenericType和Type.GetGenericTypeDefinition将允许您检测给定对象的类型是否为ObservableCollection。 比Type.GetGenericArguments将给出确切的类型。 此时,您应该能够创建自己的该类型元素集合,并将原始集合中的元素复制到新集合中。 Copying collection to list can be done wit ... -
有关此主题的stackoverflow有很多问题,但没有可靠的答案。 所以我决定发布我的解决方案作为这个问题的答案。 该问题的上下文是检查“ 用户必须在列表框中选择与可观察集合绑定的一个项目 ”。 第一步, ObservableCollection的item(实体)需要IsSelected属性。 public class ProductDecorator : DecoratorBase
{ private string _ProductShortName; privat ... -
尝试将MenuCommand字段更改为property public ICommand MenuCommand { get; set; } 希望这对你有用。 我没试过这个。 Try to change MenuCommand field to property public ICommand MenuCommand { get; set; } Hope this work for you. I haven't tried this though.
-
将onSnapshot传递给Rx.Observable.create ,您将其未绑定地传递给查询。 也就是说,您只是传递Query.prototype.onSnapshot函数。 您可以使用bind ,如下所示: const query = db .collection('conversations') .where('members.' + auth.currentUser.uid, '==', true); let observable = Rx.Observable.create(query. ...
-
IEnumerable使用Observable Collection的优点和缺点(Pros and Cons of using Observable Collection over IEnumerable)[2023-06-21]
您可能决定将IEnumerable作为某些属性的类型,但使用ObservableCollection 作为实际值。 如果你有这样的财产: private IEnumerable collectionOfSomething; public IEnumerable CollectionOfSomething { get { return collectionOfSomething; } set { ... -
您将Button的Command属性绑定到Locator资源返回的视图模型。 您应该将它绑定到ListView绑定的同一实例:
相关文章
更多- SQL Server 压力测试
- Solr: a custom Search RequestHandler
- Becoming a data scientist
- 一个sql查询
- Hadoop+SQL Server+Excel=大数据分析
- Stack Overflow Architecture Update - Now At 95 Million Page Views A Month
- sql问题
- Spark - A Fault-Tolerant Abstraction for In-Memory Cluster Computing
- Drupal Forums instead of phpBB or vBulletin: A casestudy
- 关于mysql 的 sql
最新问答
更多- 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
- 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
- OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
- 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
- codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
- 在计算机拍照在哪里进入
- 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
- No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
- 单页应用程序:页面重新加载(Single Page Application: page reload)
- 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
- System.StackOverflow错误(System.StackOverflow error)
- KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
- 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
- android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
- TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
- 企业安全培训的各项内容
- 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
- C#类名中允许哪些字符?(What characters are allowed in C# class name?)
- NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
- 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
- 将多个行和可变行移动到列(moving multiple and variable rows to columns)
- 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
- 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
- Angular $资源不会改变方法(Angular $resource doesn't change method)
- 在Angular 5中不是一个函数(is not a function in Angular 5)
- 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
- 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
- 常见的python rpc和cli接口(Common python rpc and cli interface)
- Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
- 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)