0

EDIT

I selected only one field from all the query, the file size reduced to 433Kb but the display time was 13 seconds.

END OF EDIT

I have the following query:

SELECT *,  DATE(h.hh_date_added) as dateOnly FROM unit u 
                    INNER JOIN househ h
                    ON u.unit_id=h.unit_id
                    LEFT JOIN location l
                    ON l.location_id_auto=u.location_id_auto
                    LEFT JOIN user us
                    ON us.user_id = h.user_id
                    ORDER BY dateOnly DESC

When running it on phpmyadmin, it is executed within 0.233 seconds returning 11331 row with nearly 20 fields.

If I export the data into csv or excel, the size of it would be 830Kb.

When returning this result using php to angular 6's httpclient service to display it in an angular material table:

getDataByType(){
    this.showSpinner=true;
    this.auth.getDataByType(this.dataType).subscribe(
      (data)=>
      {
        console.log(data)
        this.dataSource = new MatTableDataSource(Object.values(data));
        this.dataSource.paginator = this.paginator;
        this.dataSource.sort=this.sort;
        this.showSpinner=false;
      },
      (error)=>
      {
        console.log("Error: "+error)
      }
    )


  }

It would take more than 30 seconds (As displayed in the content-download time) to the data to be displayed in the table and shown to the user.

The timing was displayed on the timing tab of google chrome network tab with a file size of 15.9 Mb.

Why the file size is so huge ?

  1. Is the problem from the material table that took too much time to display data after receiving them:

I don't think so, as testing it on postman returned the same file size with different time of 20 seconds.

  1. or because of a query error which is returning a huge data set:

which I don't think so as on server computer, the result was returned within less than seconds with an excel file less than 1 Mb of size.

  1. Is it because I am returning it as json encoded data and chrome is taking some time to handle it ?

No, because I try to send the data within an array without the use of json_encode function and still giving the same size even bigger (17Mb).

So is it local area network/router problem making the download time huge or other thing ?

Please refer to my previous question on stack to check the connection scripts to the local server.

Isaac Bennetch
  • 11,830
  • 2
  • 32
  • 43
alim1990
  • 4,656
  • 12
  • 67
  • 130

0 Answers0