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 811431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:02:41+00:00 2026-05-15T01:02:41+00:00

which structure returns faster result and/or less taxing on the host server, flat file

  • 0

which structure returns faster result and/or less taxing on the host server, flat file or database (mysql)?

Assume many users (100 users) are simultaneously query the file/db.
Searches involve pattern matching against a static file/db.
File has 50,000 unique lines (same data type).
There could be many matches.
There is no writing to the file/db, just read.

Is it possible to have a duplicate the file/db and write a logic switch to use the backup file/db if the main file is in use?

Which language is best for the type of structure? Perl for flat and PHP for db?

Addition info:

If I want to find all the cities have the pattern “cis” in their names.
Which is better/faster, using regex or string functions?

Please recommend a strategy

TIA

  • 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-15T01:02:42+00:00Added an answer on May 15, 2026 at 1:02 am

    I am a huge fan of simple solutions, and thus prefer — for simple tasks — flat file storage. A relational DB with its indexing capabilities won’t help you much with arbitrary regex patterns at all, and the filesystem’s caching ensures that this rather small file is in memory anyway. I would go the flat file + perl route.

    Edit: (taking your new information into account) If it’s really just about finding a substring in one known attribute, then using a fulltext index (which a DB provides) will help you a bit (depending on the type of index applied) and might provide an easy and reasonably fast solution that fits your requirements. Of course, you could implement an index yourself on the file system, e.g. using a variation of a Suffix Tree, which is hard to be beaten speed-wise.

    Still, I would go the flat file route (and if it fits your purpose, have a look at awk), because if you had started implementing it, you’d be finished already 😉 Further I suspect that the amount of users you talk about won’t make the system feel the difference (your CPU will be bored most of the time anyway).

    If you are uncertain, just try it! Implement that regex+perl solution, it takes a few minutes if you know perl, loop 100 times and measure with time. If it is sufficiently fast, use it, if not, consider another solution. You have to keep in mind that your 50,000 unique lines are really a low number in terms of modern computing. (compare with this: Optimizing Mysql Table Indexing for Substring Queries )

    HTH,
    alexander

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

Sidebar

Related Questions

I have a simple jquery/ajax request to the server which returns the structure and
I'm requesting JSON file which has an invalid structure: {}&&{ result: { data: 01,
The fopen function returns a pointer to a FILE structure, which should be considered
Which XML structure allows me faster adding,deleting,updating of a node? My assumption is the
I have MySQL database, where I store the following BLOB (which contains JSON object)
I have a LINQ query which returns a set of rows. The structure is:
I'm new to mysql and have a choice regarding mysql database structure for my
I want to build a mySQL query, which returns all nodes in a graph
I have a table in my database which stores a tree structure. Here are
Lets say I have a function which takes some input structure and returns some

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.