473,785 Members | 2,811 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

speed: file vs. DB

Hi

I am the administrator of TSEP - The Search Engine Project (www.tsep.info).
We developer are unclear about the speed of two different methods:
Is it faster to
a) write to a file
or
b) update a record in a database

Olaf

--
http://www.team-noehring.de
Jul 17 '05 #1
7 2229
Writing is not the issue, reading is. If you have a text file containing
100,000 records how quickly can you read just one particular record?
Database tables have keys, so it is very easy to read a record with a
particular key value. Text files don't have keys, so you cannot go straight
to a particular record. You have to read serially through the whole file
until you happen to find the record you want.

If you know so little about databases then what makes you think your little
project will be of use to anyone?

--
Tony Marston

http://www.tonymarston.net

"Olaf Noehring" <ol******@tea m-noehring.de(000 0=year)> wrote in message
news:Xn******** *************** ***@195.14.215. 228...
Hi

I am the administrator of TSEP - The Search Engine Project
(www.tsep.info).
We developer are unclear about the speed of two different methods:
Is it faster to
a) write to a file
or
b) update a record in a database

Olaf

--
http://www.team-noehring.de

Jul 17 '05 #2
0000=year wrote:
Hi

I am the administrator of TSEP - The Search Engine Project
(www.tsep.info). We developer are unclear about the speed of two different
methods: Is it faster to
a) write to a file
or
b) update a record in a database

Olaf


Hi Olaf,

Do you only want to write some data away, or do you want to retrieve the
data later?
If you want to retrieve it later: use a database.
A database can use indexing, making retrieval of data much faster.

If you just want to write it away: I do not know. I guess filewriting speed
depends on filesystem you use, HD-speed, fragmentation, and the number of
files already on the filesystem.

My guess is your best bet is a database for most situations.

Regards,
Erwin Moller
Jul 17 '05 #3
Hi

to add some more information what we need this for. Sorry, that I forgot
to throw in this information right away:

We need to write only about 5 lines to the file - or 1 record to the DB.
It's only needed to tell the indexer (of TSEP) which reads the contents of
the files that another instance of the indexer is already running. So, the
first instance started will write to the file / db record when it has been
started and that it is running at time X (every 30 seconds)
The reading (from the file/record) is only done if a instance of the
indexer is started and there IS a record already.

Olaf
I am the administrator of TSEP - The Search Engine Project
(www.tsep.info). We developer are unclear about the speed of two
different methods: Is it faster to
a) write to a file
or
b) update a record in a database

Olaf


--
http://www.team-noehring.de
Jul 17 '05 #4
0000=year wrote:
Hi

to add some more information what we need this for. Sorry, that I forgot
to throw in this information right away:

We need to write only about 5 lines to the file - or 1 record to the DB.
It's only needed to tell the indexer (of TSEP) which reads the contents of
the files that another instance of the indexer is already running. So, the
first instance started will write to the file / db record when it has been
started and that it is running at time X (every 30 seconds)
The reading (from the file/record) is only done if a instance of the
indexer is started and there IS a record already.

Olaf


Use a database. :-)
You ARE accessing the data (files) again, so you better switch to a real
solution (database) right away.

Just think about it: You have 5.000.000 files in a directory on a filesystem
like NTFS. You need a file with the name xyzwtq.txt
How to find it?
The system has to scan through all filenames stored and compare it to your
filename.
If you have some smart indexing going on, this will seriously reduce the
seekspeed.

Maybe there are some fancy filesystems out there that can compete with a
database by using some smart indexing, I do not know to be honest.

Regards,
Erwin Moller
Jul 17 '05 #5
Olaf Noehring wrote:
Hi

I am the administrator of TSEP - The Search Engine Project (www.tsep.info).
We developer are unclear about the speed of two different methods:
Is it faster to
a) write to a file
or
b) update a record in a database

Olaf

Designers of databases have done all the very fast coding for you, why
shouldn't you use it?
Jul 17 '05 #6
In that case I would use a file. Using a database seems overkill.

Jul 17 '05 #7
SOR
<comp.lang.ph p , Tony Marston , to**@NOSPAM.dem on.co.uk>
<da************ *******@news.de mon.co.uk>
<Tue, 5 Jul 2005 11:00:10 +0100>
Writing is not the issue, reading is. If you have a text file containing
100,000 records how quickly can you read just one particular record?
Database tables have keys, so it is very easy to read a record with a
particular key value. Text files don't have keys, so you cannot go straight
to a particular record. You have to read serially through the whole file
until you happen to find the record you want.


Not always , As a newish user I done www.sparesorrepair.co.uk using
flatfiles and each advert is saved on its own and called/displayed by
the advert number .

(obviously not saying its the best way to do it)
Jul 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
6876
by: J. Campbell | last post by:
Hi everyone. I'm sure that this is common knowledge for many/most here. However, it was rather illuminating for me (someone learning c++) and I thought it might be helpful for someone else. I'm sure I'll get scolded for an OT post, but I think issues of this type should be of interest to programmers until they get a handle on them. I was reading some old threads about the relative advantages of using ++i vs i++ (I won't rehash the many...
60
10155
by: Neil | last post by:
I have a situation with an ODBC linked view in an Access 2000 MDB with a SQL 7 back end. The view is scrolling very slowly. However, if I open the view in an ADP file, it scrolls quickly. I needed to use an ODBC link for the view because it needs to be editable. Otherwise, I would have used a pass-through query. In previous discussions about using an MDB file vs. an ADP file as a front end for SQL Server, the impression I got was that...
2
4261
by: Abubakar | last post by:
Hi, I have a small sockets application and I'm adding a feature in it to transfer files. Since I also want to give it a transfer resume feature so this means I'll be transfering in specific bytes per pass. I want to know the local LAN or, if or internet, internet connection speed like 5k/s or 50k/s (as we see in the downloads of IE) so that I can pass that amount of data in write method of networkstream object. So how do I get the speed...
6
2032
by: Ham | last post by:
Yeah, Gotto work with my VB.Net graphic application for days, do any possible type of code optimization, check for unhandled errors and finally come up with sth that can't process 2D graphics and photos at an acceptable speed. I have heard things about the virtual machine of Mr. Net, that it can run my app at a high speed....but could never compare it with Java VM and its speed. Then, what should i do? Go and learn C++ ? Do i have time for...
3
5063
by: Mike Kelly | last post by:
Hi. I've built a page using standard ASP.NET 2.0 features and when I upload a large file (>20MB) to our intranet server, I get a paltry 100KB/s on our 100Mb/s LAN. Simply copying the file, I get around 7MB/s. I'm using a FileUpload control on an .aspx page, and then I'm writing the MyFileUpload.PostedFile.InputStream off to a database. What can I do to speed up this uploading? Thanks in advance
2
6440
by: Mike Kober | last post by:
I am having issues with the File Upload control for sending files to the server via HTTP. The speed of the upload is often between 20kbs and 40kbs. If I use the LAN at work to the server, it runs over 2.3mbs. The slow speeds are when using multiple providers including RoadRunner and DSL. One test instance of a 40mb file showed it running at about 20kbs for about halfway, then it burst up to 500kbs for the rest of the file.
9
6228
by: sturnfie | last post by:
Hi all, I am attempting to write a tool that would get (via something of a stopwatch action) the amount of time it takes to copy a file from a local disk to a connected USB drive on a Windows XP machine. When I run this tool, I am getting average speeds that are faster than what is theoretically possible over a full-speed USB connection (the disk is enumerated at Full speed, not High Speed).
19
3818
by: llothar | last post by:
I must say i didn't expect this. I just did some measures on FreeBSD 6.2 with gcc 3.4.6 and there is absolutely no significant difference between 32 and 64 bit mode - neither in compilation speed, nor in speed of the compiled result. As a benchmark i took a bootstrap of the SmallEiffel Compiler (which has 38 files with around 100 kloc). The times i got were very reliable. The bootstraping (compile the c files from last eiffel compiler...
8
6493
by: SaltyBoat | last post by:
Needing to import and parse data from a large PDF file into an Access 2002 table: I start by converted the PDF file to a html file. Then I read this html text file, line by line, into a table using a code loop and an INSERT INTO query. About 800,000 records of raw text. Later, I can then loop through and parse these 800,000 strings into usable data using more code. The problem I have is that the conversion of the text file, using a...
10
11761
by: Devang | last post by:
Hello, I am using php script to upload file. some times if file size is too big(1GB) it takes too much time to upload. Can someone suggest me the way to increase upload speed. thanks
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10330
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10153
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10093
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8976
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2880
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.