phpmyadmin/phpmyadmin

Slow browse page load with multi-column foreign key

Open

#18.728 aperta il 21 set 2023

Vedi su GitHub
 (6 commenti) (0 reazioni) (0 assegnatari)PHP (3454 fork)batch import
Enhancementaffects/5.2affects/6.0confirmed/6.0help wanted

Metriche repository

Star
 (6886 star)
Metriche merge PR
 (Merge medio 2g 17h) (11 PR mergiate in 30 g)

Descrizione

Describe the bug

When browsing a table with a multi-column foreign key phpmyadmin adds links to the values in the foreign key columns. These links only point to that columns part of the foreign key instead of using all parts.

phpmyadmin displays a tooltip for each link, and to get the data it makes one request per column and row in the parent table. This negatively impacts performance on big tables where no index is available for the 2nd, 3rd, ... columns in the foreign key.

To Reproduce

Steps to reproduce the behavior:

  1. create a table with multi-column foreign key where the parent table has a lot of data
  2. browse the table
  3. It takes unusually long to display the data

Expected behavior

The table should be displayed without much delay when the original query is using an index. Ideally the links should point to the exact row (using all the key columns, instead of just the clicked column)

Screenshots

image

Server configuration

  • Operating system: linux
  • Web server: apache2
  • Database version: MySQL 5.7.42
  • PHP version: 8.1.2
  • phpMyAdmin version: 5.2.1

Additional context

In this case the parent table has 2M rows, the page needs half a minute to load, if the number of rows displayed is increased the time needed increases proportionally. It could also make sense to cache the looked up rows, because often the foreign keys are exactly the same. (See the screenshot 2nd and 3rd column)

Guida contributor