服务器端 SQL 库 [英] server-side SQL library

查看:47
本文介绍了服务器端 SQL 库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.net 中是否存在可以在服务器端执行查询的库?

我问的原因是尽管我使用了许多技巧来最大化数据库性能,例如 SELECTing 和 JOINing 在 PRIMARY 上>,使用INT作为PRIMARY,固定LENGTHs,UPDATE代替DELETEing,没有 NULLs 列被 UPDATEd 和 UPDATEing 表使用 INT> 状态"列(例如活动"、非活动"等),但延迟时间从 <10 毫秒到 >100 毫秒,只需使用几个 SELECT 和 1 个 JOIN 每个都使用上述技术.

我将开始使用服务器来JOIN,因为我已经成功地将延迟降低了 <10 毫秒,但我想知道是否已经有可以执行此操作的库或内置功能.<​​/p>

一个例子是将单个 JOIN 查询分解为多个查询:

  1. SELECT 基于 PRIMARY 键的 table1 中的特定行
  2. SELECT 基于 table1
  3. 中的 PRIMARY 来自 table2 的特定行

而且复杂性只会从那里增加..net 是否存在这样的库/功能?

非常感谢!

解决方案

听起来您正在寻找类似于 ADO.NET 实体框架.使用 LINQ,您可以通过以下方式查询代码中的数据:将查询表达式转换为 SQL 并进行优化(尽可能优化)以获取您要查询的数据.

Does a library exist in .net that can perform queries server-side?

The reason I ask is even though I've used many tricks to maximize database performance such as SELECTing and JOINing on the PRIMARY, using INTs as the PRIMARY, fixed LENGTHs, UPDATEing instead of DELETEing, no NULLs for columns to be UPDATEd, and UPDATEing tables by using an INT "state" column (such as "active", "inactive", etc), but latency times go from <10ms to >100ms just by using a few SELECTs with 1 JOIN each using the techniques above.

I'm going to start using the server to JOIN instead because I've had lots of success with driving lag back down <10ms doing so, but I'm wondering if there's already a library or built-in feature that can do this.

An example would be breaking a single JOIN query into multiple queries:

  1. SELECT a specific row from a table1 based upon the PRIMARY key
  2. SELECT a specif row from table2 based upon the PRIMARY located in table1

And the complexity only increases from there. Does such a library/feature exist for .net?

Many thanks in advance!

解决方案

It sounds like you're looking for something like the ADO.NET Entity Framework. Using LINQ, you can query data in code in such a way that the query expressions are converted to SQL and optimized (as best as possible) to get the data you're querying.

这篇关于服务器端 SQL 库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆