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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:59:44+00:00 2026-05-27T01:59:44+00:00

I am writing a fairly simple webapp that pulls data from 3 tables in

  • 0

I am writing a fairly simple webapp that pulls data from 3 tables in a mysql database. Because I don’t need a ton of advanced filtering it seems theoretically faster to construct and then work within large multi-dimensional arrays instead of doing a mysql query whenever possible.

In theory I could just have one query from each table and build large arrays with the results, essentially never needing to query that table again. Is this a good practice, or is it better to just query for the data when it’s needed? Or is there some kind of balance, and if so, what is it?

  • 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-27T01:59:45+00:00Added an answer on May 27, 2026 at 1:59 am

    PHP arrays can be very fast, but it depends on how big are those tables, when the numbers get huge MySQL is going to be faster because, with the right indexes, it won’t have to scan all the data, but just pick the ones you need.

    I don’t recommend you to try what you’re suggesting, MySQL has a query cache, so repeated queries won’t even hit the disk, so in a way, the optimization you’re thinking about is already done.

    Finally, as Chris said, never think about optimizations when they are not needed.

    About good practices, a good practice is writing the simplest (and easy to read) code that does the job.

    If in the end you’ll decide to apply an optimization, profile the performance, you might be surprised, by unexpected results.

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

Sidebar

Related Questions

I am writing a fairly simple MVC3 application that allows a user to retrieve
I'm writing a fairly simple register php script that uses PHP's built in mail()
I have a fairly simple, though expensive, task that I need to run in
I'm writing an application for android and have a fairly simple SQLite3 database (see
I am writing a fairly simple Django application where users can enter string queries.
I am writing a fairly simple WPF desktop application and under build\configuration manager, release
I'm fairly new to Java and am writing an app that needs an XML
I have a fairly complicated installer that I'm writing in Wix that has a
I'm writing a solution around MOSS 2007. And storing fairly large quantities of data
I am writing a fairly simple SQL query in SQL 2005, but am running

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.