Announcement

Announcement Module
Collapse
No announcement yet.

Select slow

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

  • Select slow

    I have two tables - one with around 80,000 rows(27 fields) and the other with 65,000 rows(2 fields).
    When I do a simple select which involves a join, the database hangs. Show processlist displays the status as 'sending data' - this stage exists for indefinite time.

    Select count(tbl1.tbl1_id) from tbl1,tbl2 where tbl1.tbl1_id = tbl2.foreign_key

    Each of the tables have a primary key and no other index.

    What may I do to make the joins faster.

  • #2
    Have you tried defining an index on "tbl2.foreign_key"

    Comment

    Working...
    X