简体   繁体   中英

File Reading/Writing vs DB Reading/Writing

Hi was just wondering if anyone could help me.

I have a program that writes out logs from other files to two different file depending on what the log contains (basically if its an error or not). My question is would it better to store these logs like i am (in a file) or in a DB.

Other information that might help:

  • My program writes A LOT of messages out to these files and once the messages are in the file it doesn't change.

  • Later on i plan on reading them back in to another program to do some operations with the data. So does this change if i should use a file or not?

Last question: When using a file is it better to write out each message one at a time or store them and then write a group of them out?

Any help would be great thanks.

  1. With FILE I/O you need to implement all the Qos aspects like Concurrency, Transaction etc by your own to makesure the data inconsistancies

  2. With DB all those aspects are already taken care by the DB

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM