[Linux-programlama] Re: MySQL: sorgu analizi

---------

[Linux-programlama] Re: MySQL: sorgu analizi

From: Atýf CEYLAN <atifceylan_at_gmail.com>
Date: Sat, 05 Apr 2008 11:48:19 +0300
Message-ID: <47F73CD3.5050402@gmail.com>

Anýl KARADAÐ yazmýþ:
> Herkese iyi aksamlar MySQL kullanan ve tablolarýnda 300.000 satir ve
> uzeri veriye sahip ve veritabanindan sorumlu uyelerimizin dikkatine
>
> Suan 350.000 satýr veri iceren bir tablom bulunmaktadýr. 1 primary key
> ve 2 tane normal index içermekte. Arama yaptigim diger bircok kolonda
> index bulunmuyor.
>
> 1-SELECT a,b,c FROM tablo1 WHERE a='x' AND
> cast(b as date)= '".$date."' ORDER BY rand() LIMIT 10
>
> 2-SELECT COUNT(*) FROM tablo1 WHERE a='x' and
> cast(b as date)= '".$date."' and (c != '' or c is not null)
>
> 3-SELECT MAX(e) FROM tablo WHERE a= '".$cat." ' and
> cast(b as date)= '".$date."' and (c != '' or c is not null)
>
> ve benzeri sorgulari calistirdigim php sayfasi cok gec yukleniyor. Bu
> duruma nasýl cozum bulabilirim. Belirtmen gereken bir nokta tablonun
> dinamik olusudur. Gunluk ortalama bir sayida kayit girilmektedir.
>
> Kayit girilirken db uzerinde cesitli sorgular yapilmaktadir. Kisacasi
> sistemde veri girisi sorgusu ve goruntuleme sorgularý ayni zaman
> diliminde gerceklesmektedir gunun belirli bir diliminde.
>
> Cluster konusuna bakiyorum. Onerilerinizi bekliyorum.
>
> _______________________________________________
> Linux-programlama mailing list
> Linux-programlama_at_liste.linux.org.tr
> http://liste.linux.org.tr/mailman/listinfo/linux-programlama
>
>
öncelikle mysql üzerinde hem insert-update hemde select query ler
calýþýyorsa myisam tablosunu þiddetle terketmenizi ve innoDB ye
geçmenizi önereceðim. daha sonra

> 1-SELECT a,b,c FROM tablo1 WHERE a='x' AND
> cast(b as date)= '".$date."' ORDER BY rand() LIMIT 10
bu sorgunuzu

1-SELECT a,b,c FROM tablo1 WHERE cast(b as date)= '".$date."' AND a='x' ORDER BY rand() LIMIT 10

þeklinde deðiþtirin. primary,unique veya indexli alanlarýnýzý sorgunuzun en sonuna yazmak suretiyle query oluþturun. oldukça fark ettirecektir.

> 2-SELECT COUNT(*) FROM tablo1 WHERE a='x' and
> cast(b as date)= '".$date."' and (c != '' or c is not null)
>
bu sorguyuda

2-SELECT COUNT(*) FROM tablo1 WHERE cast(b as date)= '".$date."' and (c != '' or c is not null) and a='x'

olarak deðiþtirin ayrýca alanlarý cast edip sonra þart oluþturmak pek
mantýklýca deðil bence mümkünse alan tipinizi tarih yapýn.
> 3-SELECT MAX(e) FROM tablo WHERE a= '".$cat." ' and
> cast(b as date)= '".$date."' and (c != '' or c is not null)
bu sorgunuzuda

3-SELECT MAX(e) FROM tablo WHERE and
cast(b as date)= '".$date."' and (c != '' or c is not null) and a= '".$cat." '

bu þekilde denemenizi öneririm.

kolay gelsin
Atýf CEYLAN
_______________________________________________
Linux-programlama mailing list
Linux-programlama_at_liste.linux.org.tr
http://liste.linux.org.tr/mailman/listinfo/linux-programlama
Received on Sat 05 Apr 2008 - 11:00:44 EEST

---------

Bu arsiv hypermail 2.2.0 tarafindan uretilmistir.