Sackgesicht VIP
Total posts: 1,636
13 Dec 2015 10:54

See screenshot

2015-12-13_18-27-38

Last Modified: 14 Dec 2015


Sackgesicht VIP
Total posts: 1,636
14 Dec 2015 09:44

I looked a little deeper into it ... this is the query which normally gets the "related" record. If no related record is there, it takes it "FALSE". But it should not even do a query.

Even the query before this query to get the record number(s) of the related records is not needed, since this information was queried before through the query of all columns of the displayed records. The needed information is in the JSON string of column "fields" retrieved by:

SELECT r.*,0 as `new`
  FROM hsb0a_js_res_record AS r
  WHERE r.section_id = 1
  ORDER BY r.mtime DESC 
  LIMIT 0, 5

In this case it would save 1 query per child field per displayed record plus queries not executed for empty fields.

I made a test with a section where 1 record has 3 child fields. I displayed 25 records on a page and counted the empty fields. Out of 276 queries, exact 100 queries are unnecessary just by this scenario. ( 3 fields x 25 records + 25 empty fields)


Sergey
Total posts: 13,748
14 Dec 2015 11:37

Working on it.

Powered by Cobalt