sqlite的清单输入什么时候有用? [英] When is sqlite's manifest typing useful?

查看:119
本文介绍了sqlite的清单输入什么时候有用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

sqlite使用的东西被作者称为"清单输入",这基本上意味着sqlite是动态类型的:如果需要,可以将varchar值存储在"int"列中.

sqlite uses something that the authors call "Manifest Typing", which basically means that sqlite is dynamically typed: You can store a varchar value in a "int" column if you want to.

这是一个有趣的设计决定,但是每当我使用sqlite时,我就将其像标准RDMS一样使用,并将类型视为静态.确实,在其他系统中设计数据库时,我什至都不希望使用动态类型的列.

This is an interesting design decision, but whenever I've used sqlite, I've used it like a standard RDMS and treated the types as if they were static. Indeed, I've never even wished for dynamically typed columns when designing databases in other systems.

那么,此功能何时有用?有人在实践中找到了很好的用处,而用静态类型的列却做不到这么好用吗?

So, when is this feature useful? Has anybody found a good use for it in practice that could not have been done just as easily with statically typed columns?

推荐答案

它确实使类型更易于使用.您无需担心该字段在数据库级别上需要再多大,或者您的整数可以有多少个diget.或多或少是一个为什么不呢?"事物.

It really just makes types easier to use. You don't need to worry about how big this field needs to be at a database level anymore, or how many digets your intergers can be. More or less it is a 'why not?' thing.

另一方面,SQL Server中的静态类型使系统可以更好地进行搜索和索引,在某些情况下还可以更好地建立索引,但是对于所有应用程序的一半,我怀疑数据库性能的提高是否会很重要,否则它们的性能会很差.出于其他原因(每次选择都会创建临时表,指数选择等).

On the other side, static typing in SQL Server allows the system to search and index better, in some cases much better, but for half of all applications, I doubt that database performance improvements would matter, or their performance is 'poor' for other reasons (temp tables being created every select, exponential selects, etc).

我一直将SqLite用作我的.NET项目的客户端缓存,因为它太容易使用了.现在,如果他们只能让它像SQL Server一样使用GUID,那我将是一个快乐的露营者.

I use SqLite all the time for my .NET projects as a client cache because it is just too easy too use. Now if they can only get it to use GUIDs the same as SQL server I would be a happy camper.

这篇关于sqlite的清单输入什么时候有用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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