Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 695495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:57:55+00:00 2026-05-14T02:57:55+00:00

I have an application (currently written in Python as we iron out the specifics

  • 0

I have an application (currently written in Python as we iron out the specifics but eventually it will be written in C) that makes use of individual records stored in plain text files. We can’t use a database and new records will need to be manually added regularly.

My question is this: would it be faster to have a single file (500k-1Mb) and have my application open, loop through, find and close a file OR would it be faster to have the records separated and named using some appropriate convention so that the application could simply loop over filenames to find the data it needs?

I know my question is quite general so direction to any good articles on the topic are as appreciated as much as suggestions.

Thanks very much in advance for your time,
Dan

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T02:57:55+00:00Added an answer on May 14, 2026 at 2:57 am

    Essentially your second approach is an index – it’s just that you’re building your index in the filesystem itself. There’s nothing inherently wrong with this, and as long as you arrange things so that you don’t get too many files in the one directory, it will be plenty fast.

    You can achieve the “don’t put too many files in the one directory” goal by using multiple levels of directories – for example, the record with key FOOBAR might be stored in data/F/FO/FOOBAR rather than just data/FOOBAR.

    Alternatively, you can make the single-large-file perform as well by building an index file, that contains a (sorted) list of key-offset pairs. Where the directories-as-index approach falls down is when you want to search on key different from the one you used to create the filenames – if you’ve used an index file, then you can just create a second index for this situation.

    You may want to reconsider the “we can’t use a database” restriction, since you are effectively just building your own database anyway.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have an application written in C# .NET that is currently used in production
I have an application written for the UK market that currently only supports English
I am currently working on a distributed processing application written in Python that utilises
I have a simple blog application written in Python, using Django. I use Git
I have a demo application that is written in Python. It uses a lot
So i supose that i have a server application written in python import bottle
I have an application that currently links to Google Maps passing it the required
I currently have an application I'm writing in c# (using .NET) that requires me
We currently have an application that depends largely on stored procedures. There is a
I currently have an application that uses a browserfield to access an internet page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.