Closed Bug 288973 Opened 20 years ago Closed 20 years ago

Front page queries are sub-optimized

Categories

(addons.mozilla.org Graveyard :: Public Pages, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ma1, Assigned: ma1)

References

()

Details

Attachments

(1 file, 1 obsolete file)

Front page is obviously the most hit one of the entire site, hence its SQL
queries should be as optimized as possible.
index.php contains 3 queries wich extract unneeded fields and rows, followed by
PHP loops which emulate functionality easily achieved with sane SQL.
Looking at

http://lxr.mozilla.org/mozilla/source/webtools/update/index.php#141
http://lxr.mozilla.org/mozilla/source/webtools/update/index.php#182
and
http://lxr.mozilla.org/mozilla/source/webtools/update/index.php#224

needed changes are easily spotted:
1. don't extract TV.* fields, since they are not used
2. put a DISTINCT clause (depending on step 1)
3. add a LIMIT 5 clause
4. eliminate all the PHP code which emulate the above SQL from the data
consuming loops

I'll post a patch as soon as bug #287159 (which work on the same code) is fixed.
Attached patch fixes queries and loops (obsolete) — Splinter Review
Also coalesces redundant calls to uriparams() and ucwords()
Attachment #179709 - Flags: first-review?(mike.morgan)
Status: NEW → ASSIGNED
Comment on attachment 179709 [details] [diff] [review]
fixes queries and loops

Fix the two instances where a "$" was missing before uriparams -- then we can
call it good.
Attachment #179709 - Flags: first-review?(mike.morgan) → first-review-
Attachment #179709 - Attachment is obsolete: true
Attachment #179830 - Flags: first-review?(mike.morgan)
Comment on attachment 179830 [details] [diff] [review]
Fixed as morgamic said

Sometime later we can examine why uriparams is there at all.  Until we have
time for that, this is a good improvement.  Thanks for fixing those two lines.
Attachment #179830 - Flags: first-review?(mike.morgan) → first-review+
This has been committed.  Thanks, Mao.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: