Announcement Module
No announcement yet.

Slow query (i think)

Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Slow query (i think)


    I have a query: select * from articulos_stock;

    and the log for slow queries show this:

    # Query_time: 4 Lock_time: 0 Rows_sent: 179529 Rows_examined: 179529
    select * from articulos_stock;

    So more complex queries involving that table are really slow (like left joining other tables), for eg:

    # Query_time: 8 Lock_time: 0 Rows_sent: 179529 Rows_examined: 718116
    SELECT articulos.* FROM `articulos_stock`
    LEFT JOIN `articulos_talles` ON `articulos_stock`.`Código_Talle` = `articulos_talles`.`Código`
    LEFT JOIN `articulos_colores` ON `articulos_stock`.`Código_Color` = `articulos_colores`.`Código`
    LEFT JOIN `articulos` ON `articulos_stock`.`Código` = `articulos`.`Código`;

    Where is the problem? TCP communication is slow? I dont think so because it is on localhost and if in the second query I change SELECT articulos.* with SELECT COUNT(*) it tooks 2 seconds... too much for about 180000 rows when some people manages millons.

    Machine is Pentium 4 1.8ghz 1,5gb. ram

    Best regards,
    Mauro H. Leggieri