且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Java文件IO与本地数据库

更新时间:2022-10-14 21:55:35

问题可以通过两种方式解决,但它取决于几个因素



go for FileIO


  1. 如果您不要像Jon Skeet这样的复杂查询说出

  2. 如果您的引用获取行是通过使用hte文件夹名称:DataSource作为键

转到DB b


  1. 如果您看到您的计划读取数百万条记录

  2. ,您可以进行复杂的选择

  3. 如果您知道为数据库创建基本表结构,则
  4. I am working on a project that involves parsing through a LARGE amount of data rapidly. Currently this data is on disk and broken down into a directory hierarchy:

    (Folder: DataSource) -> (Files: Day1, Day2, Day3...Day1000...)
    (Folder: DataSource2) -> (Files: Day1, Day2, Day3...Day1000...) 
    ...
    (Folder: DataSource1000) -> ...
    ...
    

    Each Day file consists of entries that need to be accessed very quickly.

    My initial plans were to use traditional FileIO in java to access these files, but upon further reading, I began to fear that this might be too slow.

    In short, what is the fastest way I can selectively load entries from my filesystem from varying DataSources and Days?

    The issue could be solved both ways but it depends on few factors

    go for FileIO.

    1. if the volume is < millons of rows
    2. if your dont do a complicated query like Jon Skeet said
    3. if your referance for fetching the row is by using hte Folder Name: "DataSource" as the key

    go for DB

    1. if you see your program reading through millions of records
    2. you can do complicated selection, even multiple rows using a single select.
    3. if you have knowledge of creating a basic table structure for DB