SQL小表在内存中分配 [英] SQL little table allocated in memory

查看:73
本文介绍了SQL小表在内存中分配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种方法可以使SQL Server将具有10 attributes and 10 rows的表存储在内存中?

Is there a way to make SQL Server to store a table with 10 attributes and 10 rows like this on memory?

a1   a2   a3  a4  a5  a6  a7  a8  a9 a10
----------------------------------------
138 498  365 345 500 473 498 125 134 800
448 498  362 348 500 463 498 625 165 700
468 498  625 329 500 435 498 625 345 600
437 701  365 326 500 453 498 625 645 500
438 498  326 329 500 438 498 625 745 400
439 499  626 329 500 438 498 525 685 300
440 500  327 328 500 423 498 627 655 200
444 214  331 334 500 428 498 125 615 100
448 498  362 348 500 463 498 225 165 700
468 498  625 329 500 435 498 425 345 600

有没有办法将此表存储在连续内存中?

Is there a way to store this table in contiguous memory?

我当时正在考虑制作某种向量,并将表做成单行(而不是将10个属性乘以10行来制作一个大小为100的向量. 有办法吗?

I was thinking to make somekind of vector and make the table a single row (instead of 10 attributes by 10 rows make a vector with size 100. Is there a way to do this?

您可能会问我为什么要这样做,这是因为我想在内存中全部进行微积分,以避免写入或使用磁盘,然后访问内存或 vector 在C ++或.NET(也许是C#?)中

You may ask why I want to do this, It is because I would like to make some calculus all in memory avoiding writing or using disk, and then access the memory or vector in C++ or .NET (maybe C#?)

推荐答案

不要试图向SQL Server指示如何处理此类事情的内存.这是一种声明性语言-您告诉它想要的内容,并弄清楚该怎么做.

Don't try to dictate to SQL Server how to handle memory for things like this. It's a declarative language - you tell it what you want and it figures out how to do it.

仅将其保留在内存中将是恢复的问题.话虽如此,一旦创建了表,一旦将其写入磁盘,它将被保留在内存中. SQL Server缓存数据页,而类似的内容将是一个页面,因此对磁盘的大量访问应该不成问题.

Keeping it in memory only would be an issue for recovery. That being said, once you create the table it will be kept in memory once it's written to disk. SQL Server caches data pages, and something like this would be a single page so a lot of disk access shouldn't be a problem.

这篇关于SQL小表在内存中分配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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