Tema: Re: ilgas sql
Autorius: iga
Data: 2009-02-05 22:30:10
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1257">
<META content="MSHTML 6.00.6000.16788" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>40s&nbsp;nesamon....&nbsp; Arba serveriu dirba 
tavo mobilka arba indeks nra arba terabaitin duombaz...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV>"tobias" &lt;<A 
  href="mailto:oracullusTRINAM@yahoo.com">oracullusTRINAM@yahoo.com</A>&gt; 
  wrote in message <A 
  href="news:gmc593$9aa$1@trimpas.omnitel.net">news:gmc593$9aa$1@trimpas.omnitel.net</A>...</DIV>kaip 
  optimizuoti mysql query - jei jis vykdomas 40 sekundziu!<BR>jokiu fokusu 
  nedarau<BR>paselektinu straipnio id, headline,<BR>is komentaru lenteles 
  suskaiciuoju komentaru skaiciu<BR><BR>aciu uz 
  komentarus<BR><BR><BR>&nbsp;&nbsp;&nbsp;&nbsp; SELECT 
  articles.id,<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
  articles.title,<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
  articles.date,<BR>&nbsp;&nbsp;&nbsp;&nbsp; DATE_FORMAT(date,'%m/%d, %Y') as 
  ArticleDate,<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
  articles.selected_foto,<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
  articles.foto_1,<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
  articles.foto_source,<BR>&nbsp;&nbsp;&nbsp;&nbsp; REPLACE(articles.source, 
  ',', ' ') as source,<BR>&nbsp;&nbsp;&nbsp;&nbsp; LEFT(articles.article,350) as 
  article_intro,<BR>&nbsp;&nbsp;&nbsp;&nbsp; COUNT(comments.id) as 
  artComments<BR>&nbsp;&nbsp;&nbsp;&nbsp; FROM 
  articles<BR>&nbsp;&nbsp;&nbsp;&nbsp; LEFT JOIN comments ON articles.id = 
  comments.object_id<BR>&nbsp;&nbsp;&nbsp;&nbsp; WHERE articles.active&nbsp; = 
  '1'<BR>&nbsp;&nbsp;&nbsp;&nbsp; AND articles.category&nbsp; = 
  '21'<BR>&nbsp;&nbsp;&nbsp;&nbsp; GROUP BY 
  articles.id<BR>&nbsp;&nbsp;&nbsp;&nbsp; ORDER BY 
  articles.id<BR>&nbsp;&nbsp;&nbsp;&nbsp; DESC<BR>&nbsp;&nbsp;&nbsp;&nbsp; LIMIT 
  5 <BR><BR></BLOCKQUOTE></BODY></HTML>