Zum Inhalt springen

Testbernd

Mitglieder
  • Gesamte Inhalte

    3
  • Benutzer seit

  • Letzter Besuch

  1. Für alle die das Ganze interessiert hier die letzte Version des SQL-Satzes: SELECT a.post_id AS post_id, a.ref AS title, CONCAT(' (', a.hits, ')') AS note FROM keywordfire_refsAS a INNER JOIN ( SELECT post_id, Max(hits) as maxhits FROM keywordfire_refs WHERE (issearchengine =1) AND (keywordfire_date > '$date') AND (post_id > 0) AND (hits>1) GROUP BY post_id ) AS sub ON ( (a.post_id = sub.post_id) AND (a.hits=sub.maxhits) ) WHERE (issearchengine =1) AND (a.keywordfire_date > '$date') AND (a.post_id > 0) AND (a.hits>1) GROUP BY a.post_id ORDER BY a.hits DESC LIMIT 0 , $maxresults"; Dieser Satz ist nun im Faktor 3 bis 4 schneller. Der Tipp mit Explain und den Indizies war hilfreich, aber konnte zur Geschwindigkeitserhöhung leider nicht beitragen. Gruß Tim
  2. Hab nun einen Teil des generischen Vergleich ausgelagert in eine weitere Spalte und ORDER BY im INNER JOIN entfernt: SELECT a.post_id AS post_id, a.ref AS title, hits AS note, gen_id AS posthits FROM wpneu_keywordfire_refs AS a INNER JOIN ( SELECT CONCAT( post_id, '_', MAX( hits ) ) AS posthits FROM wpneu_keywordfire_refs WHERE issearchengine =1 AND keywordfire_date > '2009-01-01' GROUP BY post_id ) AS sub ON ( posthits = sub.posthits ) WHERE issearchengine =1 AND a.keywordfire_date > '2009-01-01' GROUP BY a.post_id ORDER BY a.hits DESC LIMIT 0 , 10; @Amstelchen Ein EXPLAIN zeigt nun: id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY a ref date,is is 1 const 44 Using where; Using temporary; Using filesort 1 PRIMARY <derived2> ALL NULL NULL NULL NULL 25 Using where 2 DERIVED wpneu_keywordfire_refs ref date,is is 1 44 Using where; Using temporary; Using filesor Insgesamt scheinen alle Anfragen (auch simple), die das Plugin betreffen langsam zu sein. Muss ich irgend etwas besonderes beachten bzgl. Feldern, Indizies und deren Nutzung? So eine Arbeit und am Ende läuft das Ganze nicht, weil es zu langsam ist bzw. die Server zu stark beansprucht. Klasse :upps Habt Ihr noch einen Tipp? Gruß Tim
  3. Hallo Boardies, ich habe ein WP-Plugin geschrieben. Eine der Abfragen ist ein INNER JOIN. Die Abfrage erstellt eine generische ID, weil ich mit GROUP BY das Problem nicht lösen konnte. Jetzt braucht diese eine Abfrage jedoch 0,2 sec auf meinem Root und auf normalen Hostingpaketen wahrscheinlich mehr Zeit. Hat jemand von Euch eine Idee, wie ich die Abfrage beschleunigen kann? SELECT a.post_id AS post_id, a.ref AS title, CONCAT( ' (', a.hits, ')' ) AS note FROM wp_fire_refs AS a INNER JOIN ( SELECT CONCAT( post_id, '_', MAX( hits ) ) AS posthits FROM wp_fire_refs WHERE issearchengine =1 AND fire_date > '2009-01-01' GROUP BY post_id ORDER BY posthits DESC ) AS sub ON ( CONCAT( a.post_id, '_', a.hits ) = sub.posthits ) WHERE issearchengine =1 AND a.fire_date > '2009-01-01' GROUP BY a.post_id ORDER BY a.hits DESC LIMIT 0 , 10; Grüße Timbob

Fachinformatiker.de, 2024 by SE Internet Services

fidelogo_small.png

Schicke uns eine Nachricht!

Fachinformatiker.de ist die größte IT-Community
rund um Ausbildung, Job, Weiterbildung für IT-Fachkräfte.

Fachinformatiker.de App

Download on the App Store
Get it on Google Play

Kontakt

Hier werben?
Oder sende eine E-Mail an

Social media u. feeds

Jobboard für Fachinformatiker und IT-Fachkräfte

×
×
  • Neu erstellen...