3 Replies Latest reply on Nov 1, 2006 2:30 PM by

    PhP and XML

      I have recently just started using php and understand the concept behind server side scripting. I was arguing with a co worker about which would be better:

      If I were to use php to run a query on some data in MySql and pass the data back to flex...now if I had mutliple queries to run would it be more efficient to run 1 large query on the data and then store that data in an array, lets say, and search through it locally.

      OR

      Call multiple times to a php script that has different queries to the database?

      Is there a right or wrong answer?

      Thanks in advance!

        • 1. Re: PhP and XML
          peterent Level 2
          IMHO, there's no definitive right or wrong answer. You have to look at potential bottlenecks and assets as well as the overall application flow.

          If you are talking about raw throughput, there's a cost associated with making the connection to the server; holding it open to retrieve a lot of data is *probably* less expensive than opening/closing many connections. On the other hand, if you make the user wait for a long download they may perceive the app to be slower than if you got bits at a time.

          If you read up on Flex Data Services and its Data Management you'll see that we address the issue of large amounts of data. Perhaps that might shed more light on your argument, er, discussion.
          1 person found this helpful
          • 2. Re: PhP and XML
            Renaun_Erickson Level 1
            Depends on:
            How large the data is?
            How often the data changes?
            Where you displaying it? will it be paged?
            Does all the data need to be searched, or just one column?

            There is not really a right or wrong answer.
            • 3. Re: PhP and XML
              Thanks for the answer I was thinking the same thing depending on amount of data and such.

              I am not a database guru but I do have a small background in MySQL and the problem is I want to break the data up into tables as much as I can(I like more tables with less data then less tables and more data)...then I would prefer calling multiple queries. While my co-worker wants 1 large table and run 1 query...which I believe is more expensive. The data is quiet large in my opinion, and how 3000-10000 table entries relate to size I am not sure.

              I suppose I should mention I am trying to set up an office intranet using Flex and this is why this topic has come up.

              But if there is no definitive answer we will have to agree to disagree...=)