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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:04:50+00:00 2026-05-11T05:04:50+00:00

I have a MySQL indexing question for you guys. I’ve got a very large

  • 0

I have a MySQL indexing question for you guys.

I’ve got a very large table (~100Million Records) in MySQL that contains information about files. Most of the Queries I do on it involve substring operations on the file path column.

Here’s the table ddl:

CREATE TABLE `filesystem_data`.`$tablename` (                 `file_id` INT( 14 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,                 `file_name` VARCHAR( 256 ) NOT NULL ,                 `file_share_name` VARCHAR ( 100 ) NOT NULL,                 `file_path` VARCHAR( 900 ) NOT NULL ,                 `file_size` BIGINT( 14 ) NOT NULL ,                 `file_tier` TINYINT(1) UNSIGNED NULL,                  `file_last_access` DATETIME NOT NULL ,                 `file_last_change` DATETIME NOT NULL ,                 `file_creation` DATETIME NOT NULL ,                 `file_extension` VARCHAR( 50 ) NULL ,                 INDEX ( `file_path`, `file_share_name` )                  ) ENGINE = MYISAM               }; 

So for example ill have a row with a file_path like:

'\\Server100\share2\Home\Zenshai\My Documents\' 

And I’ll extract the User’s name (Zenshai in this example) with something like

SELECT substring_index(substring_index(fp.file_path,'\\',6),'\\',-1) as Username FROM (SELECT '\\\\Server100\\share2\\Home\\Zenshai\\My Documents\\' as file_path) fp 

It gets a bit ugly, but that’s not really my concern right now.

What I’d like some advice on is what kind of index (if any at all) can help speed up these types of queries on this table. Any other suggestions are welcome too.

Thanks.

PS. Although the table gets very large there is enough space for indexes.

  • 1 1 Answer
  • 1 View
  • 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. 2026-05-11T05:04:51+00:00Added an answer on May 11, 2026 at 5:04 am

    You cannot use indices with your current table design.

    You may add a column called USERNAME, fill it in the INSERT/UPDATE trigger with the expression you use in SELECT, and search on this column.

    P. S. Just curious, you really have 100 mln+ files on your server?

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

Sidebar

Related Questions

I have a large MySQL photos table, and even with full-text indexing, normal indexing,
I have mysql table that has a column that stores xml as a string.
I have a MySQL table containing phone numbers that may be formatted in many
I need help in indexing in MySQL. I have a table in MySQL with
This is a MySQL question: I have a table with the following structure. reference
I have a table in a Mysql db that I want to use multicolumn
I have MySQL InnoDB table utf-8 encoded. This table has only id and name
I have MySQL running such that I can open a client command line and
I have mysql database structure like below: CREATE TABLE test ( id int(11) NOT
I have a couple of questions regarding MySQL indexing: 1) Is there any speed

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.