Pogledajte određenu poruku
Staro 18. 03. 2006.   #6
zextra
Boris
Grand Master
 
Avatar zextra
 
Datum učlanjenja: 01.12.2005
Lokacija: Novi Sad
Poruke: 775
Hvala: 5
156 "Hvala" u 2 poruka
zextra is on a distinguished roadzextra is on a distinguished road
Default

Dodatni indeks na tabeli master nije potreban jer mysql automatski pravi relaciju one-to-many izmedju tabela categories i master, jer je polje category_id u tabeli categories primarni kljuc. Dakle problem ne lezi u tome...

Kôd:
mysql> explain select * from categories,master where categories.category_id=master.category_id;
+----+-------------+------------+--------+---------------+---------+---------+-------------------------+-------+-------+
| id | select_type | table      | type   | possible_keys | key     | key_len | ref                     | rows  | Extra |
+----+-------------+------------+--------+---------------+---------+---------+-------------------------+-------+-------+
|  1 | SIMPLE      | master     | ALL    | NULL          | NULL    | NULL    | NULL                    | 40000 |       |
|  1 | SIMPLE      | categories | eq_ref | PRIMARY       | PRIMARY | 4       | test.master.category_id |     1 |       |
+----+-------------+------------+--------+---------------+---------+---------+-------------------------+-------+-------+
2 rows in set (0.00 sec)
Dodatni indeksi ne mogu da poprave performanse upita, jer se i tako i tako citaju svi zapisi iz tabele master.

Mrzelo me da kreiram jos koju tabelu i da vidim sta se onda desava...
__________________
"It’s important to have goals when you pet. Otherwise you’re just rubbing another mammal for no reason." - Scott Adams

Poslednja izmena od zextra : 18. 03. 2006. u 01:44.
zextra je offline   Odgovorite uz citat