Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Jakie indeksy?
robos85
post
Post #1





Grupa: Zarejestrowani
Postów: 466
Pomógł: 11
Dołączył: 21.09.2006
Skąd: Szczecin

Ostrzeżenie: (0%)
-----


Witam, zastanawiam się jakie nadać indeksy dla tabel dla takiego zapytania:
  1. SELECT `q` . * , `qa`.`qa_id` , `qa`.`content` , `qa`.`date` AS `qa_date` , `f`.`id` AS `flag_id`
  2. FROM `exp_questions` AS `q`
  3. LEFT JOIN (
  4.  
  5. SELECT `id` AS `qa_id` , `question_id` AS `question_id` , `content` , `date`
  6. FROM `exp_questions_answers`
  7. WHERE `user_id` = '1'
  8. ORDER BY `date` DESC
  9. LIMIT 1
  10. ) AS `qa` ON q.id = qa.question_id
  11. LEFT JOIN `exp_questions_answers_flags` AS `f` ON qa_id = f.answer_id
  12. WHERE (
  13.  
  14. STATUS = '1'
  15. )
  16. AND (
  17. min_experience <= '66'
  18. )


Go to the top of the page
+Quote Post
erix
post
Post #2





Grupa: Moderatorzy
Postów: 15 467
Pomógł: 1451
Dołączył: 25.04.2005
Skąd: Szczebrzeszyn/Rzeszów




A co mówi EXPLAIN? (IMG:style_emoticons/default/winksmiley.jpg)
Go to the top of the page
+Quote Post
robos85
post
Post #3





Grupa: Zarejestrowani
Postów: 466
Pomógł: 11
Dołączył: 21.09.2006
Skąd: Szczecin

Ostrzeżenie: (0%)
-----


(IMG:http://img4.imageshack.us/img4/6414/explainq.jpg)
a tu struktura tabeli 'q'
(IMG:http://img641.imageshack.us/img641/5146/expquestions.jpg)

O indeksach czytałem trochę i chciałbym sprawdzić czy te co zrobiłem są OK

Ten post edytował robos85 12.02.2010, 15:36:49
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 25.12.2025 - 22:20