Core Data 中的时间序列建模
我正在考虑编写一个处理时间序列数据的应用程序,并希望将繁重的数据工作推入核心数据中。我的问题是这样的 - 从检索速度和易于操作的角度来看,对实体进行建模是否会更好,或者将时间序列数据点“存储”为数组(我将其存储为可转换对象)可能会更容易(或无论它被称为什么)在核心数据对象中。
例如,假设我有一个时间戳和一个仅与一个对象关联的观察,我可以将该对象建模为一个实体,将一个数据点(具有属性时间戳和观察)建模为另一个实体,并将两者通过一个链接起来-对很多。我的“无知”直觉是,随着添加更多对象及其相应的数据点,这可能最终会导致性能问题,因为检索数据点实际上类似于从巨大的数据点中过滤掉所有实体关系表明它们链接到目标对象。我是否误解了这是如何工作的? Core Data 是否在后台更智能地管理此问题,并有一些聪明的方法来查找内容,以便性能不会随着数据点数量的增长而降低? (我认为整个事情在后台减少到一个非常大的表,以对象作为键,每个时间戳/观察有很多行。)我
可能解决这个问题的另一个想法是简单地使时间序列成为一堆数组或字典元素,然后将数组/字典保存为对象本身的属性。我知道这会剥夺一些核心数据查询功能,并可能使 UI 变得不那么“神奇的自动化”。
对此的任何意见将不胜感激。
谢谢你-C.
I am looking at writing an application that handles time series data and want to shove to heavy lifting data work off into Core Data. My question is this - from a speed of retrieving and ease of manipulation perspective, would it be better to model out the entities or will it likely be easier to 'store' the time series data points as an array that I store as a transformable object (or whatever it's called) in a Core Data object.
For example, assume I have a time stamp and an observation that is associated with only one object I could model the object as one entity, a data point (with attributes time stamp and observation) as another and have the two linked through a one-to-many. My 'uninformed' gut feel is that this may ultimately lead to a performance problem as more objects and their corresponding data points get added since retrieving the data points would effectively be akin to filtering out all entities from the giant pot of data points for which the relationship indicates that they are linked to the target object. Am I misunderstanding how this works? Does Core Data manage this more intelligently in the background and has some clever way to look things up so that performance wouldn't degrade as the number of data points grows? (I presume the whole thing reduces to a very large table in the background, with objects as the key and lots of rows one for each timestamp/observation.)
My other thought to potentially get around the problem is to simply make the time series a bunch of array or dictionary elements and then save the array/dictionary as an attribute on the object itself. I understand that this would take away some Core Data query functionality and may make the UI less 'magic automation'.
Any views on this would be greatly appreciated.
Thank you - C.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里有关于在 Core Data sqlite 存储中存储时间序列数据的讨论:http://www.cocoabuilder.com/archive/cocoa/182936-optimizing-core-data-for-large-time-series.html
There is a discussion about storing time series data in a Core Data sqlite store here: http://www.cocoabuilder.com/archive/cocoa/182936-optimizing-core-data-for-large-time-series.html