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

  • Home
  • SEARCH
  • 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 6211927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:25:19+00:00 2026-05-24T06:25:19+00:00

I have a huge data set. The structure looks something like this: K_Field1, K_Field2,

  • 0

I have a huge data set. The structure looks something like this:

K_Field1, K_Field2, K_Field3, K_Field4, D_Field5, D_Field6, D_Field7, D_field8

The problem is that only the first 4 field (K_Field1,K_Field2,K_Field3,K_Field4) together identify a row uniquely. I created one table, using these fields as its fields.

Let’s say I have 1 million rows in the table using that structure. If I import a new record, I have to decide if it’s already in the database. If it is, then I have to update it, if not, then I need to insert a new row.

To do that, I need to put a multiple field index on the first 4 columns, which is – I’m afraid – not the best solution. Is there a better database structure to store and search in that data, or I have to live with the four-fielded index?

I’m using MySQL

  • 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-24T06:25:20+00:00Added an answer on May 24, 2026 at 6:25 am

    There’s nothing wrong with creating an index on the first 4 columns, in fact you should:

    create unique index mytable_key on mytable(K_Field1,K_Field2,K_Field3,K_Field4);
    

    because that is the reality of your situation.

    It is also the “correct” solution.

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

Sidebar

Related Questions

I have a huge set of data of tables in Open Office 3.0 document
I have a repeater which binds a set of data. Within this repeater is
I have two processes one will query other for data.There will be huge amount
I have a huge dictionary of blank values in a variable called current like
Is there any tricky way to implement a set data structure (a collection of
I have a huge set of log lines and I need to parse each
I have a page that has to render a huge set of query results
I have huge 3D arrays of numbers in my .NET application. I need to
I have huge number of Word files I need to merge (join) into one
I have a huge web app that is having issues with memory leak in

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.