Search code examples
phpmysqldatabaseperformancedatabase-performance

Performance: fetching data from Database or replacing it to make new data


I don't want to start a discussion so I am keeping my question to numbers.

I have a table in my MySQL database that has 3099916 records. Now two columns of the table are the same except for a single character.

In my case they are URL and Thumbnail_URL from the same image.

Size of URL string is 72 characters.

     like image URL is  12345sss_a.jpg
while Thumbnail URL is  12345sss_b.jpg

Now what'd be better for me, i.e the most efficient way

  1. To fetch both URL's from table.
  2. To fetch one from table and make 2nd by replacing a character.

Solution

  • Depends on size of your data base.

    Under current circumstances replacing is much much better, because your table is pretty much big.