Sagewire Logo

Too fast web page for mysql database

12 Message(s) by 3 Author(s) originally posted in mysql discussion


From: MZ Date:   Wednesday, October 24, 2007
Hello!

I am not an admin of my data base, but I care of this database.
I have a web page which inserts records into the mysql database about history of
just viewed banner s.
I have written a script which let my page display banners in order. Every
reloading web page should make different banner display. That`s why I store
history of every banner of every section and I display banner which were viewed
the oldest time ago.
I don`t know why my mysql database sometimes don`t insert data into the database
and that`s why my web page shows every time the same banner. If I leave my
database for a few minutes and then reload the page, there are records added
into the database.

In the past I took care of Microsoft Access databases and there was something as
compact ing. What should I do make my mysql database response quicker? How can I
compact my database and should I do this during working hours when many people
use my web page? Is it needed to do it i.e. at night where fewer people look
into my web page?

Please help me, I really apprieciete your efforts.
Thank you
Marcin


From: K. Date:   Thursday, October 25, 2007
U¿ytkownik "MZ" <marcinzmyslowski@xxxxxxxxxxx> napisa³ w wiadomo¶ci

Hello!
I am not an admin of my database, but I care of this database.
I have a web page which inserts records into the mysql database about
history of just viewed banners.
I have written a script which let my page display banners in order. Every
reloading web page should make different banner display. That`s why I
store history of every banner of every section and I display banner which
were viewed the oldest time ago.
I don`t know why my mysql database sometimes don`t insert data into the
database and that`s why my web page shows every time the same banner. If I
leave my database for a few minutes and then reload the page, there are
records added into the database.
In the past I took care of Microsoft Access databases and there was something as
compacting. What should I do make my mysql database response quicker? How
can I compact my database and should I do this during working hours when
many people use my web page? Is it needed to do it i.e. at night where
fewer people look into my web page?
Please help me, I really apprieciete your efforts.
Thank you
Marcin



OPTIMIZE TABLE name_table


From: Captain Paralytic Date:   Thursday, October 25, 2007
wrote in message:
Hello!
I am not an admin of my database, but I care of this database.
I have a web page which inserts records into the mysql database about history of
just viewed banners.
I have written a script which let my page display banners in order. Every
reloading web page should make different banner display. That`s why I store
history of every banner of every section and I display banner which were viewed
the oldest time ago.
I don`t know why my mysql database sometimes don`t insert data into the database
and that`s why my web page shows every time the same banner. If I leave my
database for a few minutes and then reload the page, there are records added
into the database.
In the past I took care of Microsoft Access databases and there was something as
compacting. What should I do make my mysql database response quicker? How can I
compact my database and should I do this during working hours when many people
use my web page? Is it needed to do it i.e. at night where fewer people look
into my web page?
Please help me, I really apprieciete your efforts.
Thank you
Marcin



Are you testing the response from the statements you are using to
update the database?


From: K. Date:   Thursday, October 25, 2007
Are you testing the response from the statements you are using to
update the database?


No I am testing the statements I am using to insert data into the database.

M.


From: Captain Paralytic Date:   Thursday, October 25, 2007
wrote in message:
> Are you testing the response from the statements you are using to
> update the database?
No I am testing the statements I am using to insert data into the database.
M.



I mean in your code , to you check the return from the statements used
to update the database? Then you'll see if there was a problem with
the update!


From: K. Date:   Thursday, October 25, 2007
Uzytkownik "Captain Paralytic" <paul_lautman@xxxxxxxxxxx> napisal w wiadomosci

wrote in message:
> Are you testing the response from the statements you are using to
> update the database?

No I am testing the statements I am using to insert data into the
database.

M.
I mean in your code, to you check the return from the statements used
to update the database? Then you'll see if there was a problem with
the update!


I have such code. I have made a mistake, I make update and insert, but I am
interested in the table banner_view_history,
where I store data about banners` views. My function returns nothing. I do
"OPTIMIZE TABLE banner_view_history" and
"OPTIMIZE TABLE banner_items" and I think that problem disappeared. But I am
not sure for 100%.

function UpdateBannerCount($id) {
$this->_clearDBError();
if(!$this->_connect()) {
return false;
}
$sql = "SELECT id_banner_locations FROM
".$this->dbconfig["prefix"]."banner_items WHERE id_banner_items=".$id;

$resultat = @xxxxxxxxxxx($sql);
$assoc = @xxxxxxxxxxx($resultat);

$this->query = "UPDATE ".$this->dbconfig["prefix"]."banner_items bi SET
banner_view_count = banner_view_count+1 WHERE id_banner_items=".$id;
$this->result = @xxxxxxxxxxx($this->query);

$data = array(
"referer" => isset($_SERVER["HTTP_REFERER"])?$_SERVER["HTTP_REFERER"]:"",
"useragent" =>
isset($_SERVER["HTTP_USER_AGENT"])?$_SERVER["HTTP_USER_AGENT"]:"",
"cookies_name"
=>(isset($_COOKIE['test_cookie'])?$_COOKIE['test_cookie']:$_SESSION["test_cookie_session"]),
"view_date" => date("Y-m-d H:i:s"),
"id_banner_locations"=>$assoc["id_banner_locations"],
"id_banner_items" => $id
);
$this->addElement($this->dbconfig["prefix"]."banner_view_history", $data);

}

Marcin


From: Captain Paralytic Date:   Thursday, October 25, 2007
wrote in message:
Uzytkownik "Captain Paralytic" <paul_laut...@xxxxxxxxxxx> napisal w wiadomo=


sci
wrote in message:
> Are you testing the response from the statements you are using to
> update the database?
No I am testing the statements I am using to insert data into the
database.
M.
> I mean in your code, to you check the return from the statements used
> to update the database? Then you'll see if there was a problem with
> the update!
I have such code. I have made a mistake, I make update and insert, but I =
am
interested in the table banner_view_history,
where I store data about banners` views. My function returns nothing. I do
"OPTIMIZE TABLE banner_view_history" and
"OPTIMIZE TABLE banner_items" and I think that problem disappeared. But I=
am
not sure for 100%.
function UpdateBannerCount($id) {
$this->_clearDBError();
if(!$this->_connect()) {
return false;
}
$sql =3D "SELECT id_banner_locations FROM
".$this->dbconfig["prefix"]."banner_items WHERE id_banner_items=3D".$id;
$resultat =3D @xxxxxxxxxxx($sql);
$assoc =3D @xxxxxxxxxxx($resultat);
$this->query =3D "UPDATE ".$this->dbconfig["prefix"]."banner_items bi S=
ET
banner_view_count =3D banner_view_count+1 WHERE id_banner_items=3D".$id;
$this->result =3D @xxxxxxxxxxx($this->query);
$data =3D array(
"referer" =3D> isset($_SERVER["HTTP_REFERER"])?$_SERVER["HTTP_REFERER"=
]:"",
"useragent" =3D>
isset($_SERVER["HTTP_USER_AGENT"])?$_SERVER["HTTP_USER_AGENT"]:"",
"cookies_name"
=3D>(isset($_COOKIE['test_cookie'])?$_COOKIE['test_cookie']:$_SESSION["te=
st_c=ADookie_session"]),
"view_date" =3D> date("Y-m-d H:i:s"),
"id_banner_locations"=3D>$assoc["id_banner_locations"],
"id_banner_items" =3D> $id
);
$this->addElement($this->dbconfig["prefix"]."banner_view_history", $dat=
a);
}
Marcin



What do you mean "my function returns nothing"?

I cannot see anywhere in this code where you check for the success of
any of your database updates or an error messages returned.


From: K. Date:   Thursday, October 25, 2007
Uzytkownik "Captain Paralytic" <paul_lautman@xxxxxxxxxxx> napisal w wiadomosci

wrote in message:
Uzytkownik "Captain Paralytic" <paul_laut...@xxxxxxxxxxx> napisal w
wiadomosci
wrote in message:
> Are you testing the response from the statements you are using to
> update the database?
No I am testing the statements I am using to insert data into the
database.
M.
> I mean in your code, to you check the return from the statements used
> to update the database? Then you'll see if there was a problem with
> the update!
I have such code. I have made a mistake, I make update and insert, but I
am
interested in the table banner_view_history,
where I store data about banners` views. My function returns nothing. I do
"OPTIMIZE TABLE banner_view_history" and
"OPTIMIZE TABLE banner_items" and I think that problem disappeared. But I
am
not sure for 100%.
function UpdateBannerCount($id) {
$this->_clearDBError();
if(!$this->_connect()) {
return false;
}
$sql = "SELECT id_banner_locations FROM
".$this->dbconfig["prefix"]."banner_items WHERE id_banner_items=".$id;
$resultat = @xxxxxxxxxxx($sql);
$assoc = @xxxxxxxxxxx($resultat);
$this->query = "UPDATE ".$this->dbconfig["prefix"]."banner_items bi SET
banner_view_count = banner_view_count+1 WHERE id_banner_items=".$id;
$this->result = @xxxxxxxxxxx($this->query);
$data = array(
"referer" =>
isset($_SERVER["HTTP_REFERER"])?$_SERVER["HTTP_REFERER"]:"",
"useragent" =>
isset($_SERVER["HTTP_USER_AGENT"])?$_SERVER["HTTP_USER_AGENT"]:"",
"cookies_name"
=>(isset($_COOKIE['test_cookie'])?$_COOKIE['test_cookie']:$_SESSION["test_c­ookie_session"]),
"view_date" => date("Y-m-d H:i:s"),
"id_banner_locations"=>$assoc["id_banner_locations"],
"id_banner_items" => $id
);
$this->addElement($this->dbconfig["prefix"]."banner_view_history",
$data);
}
Marcin



What do you mean "my function returns nothing"?

I cannot see anywhere in this code where you check for the success of
any of your database updates or an error messages returned.

-----------------------------------
I mean that I don`t have such code

function name_function
{
//operations on database
....
return $result;
}

by writing "my function returns nothing".

I don`t want to return anything because I use JAVAscript SWFObject class to
display flash banners and I call URL i.e. banner.php?id=22.
banner.php file contains two things:
1) the above function update and insert into the database - to increase the
number of banner (id=22) views
and add visit trace into the banner_view_history table.
2) return needed data about the flash banner to make it display on the page

<script type="text /JAVAscript">
// <![CDATA[
var so = new SWFObject("banner.php?id=22", "fl_top22_f", "770", "100",
"7", "#ffffff");
so.addVariable("quality", "high");
so.addVariable("clickTag", "bannerclick.php%3Fid%3D22");
so.write ("fl_top"+22);
// ]]>

</script>

Marcin


From: Captain Paralytic Date:   Thursday, October 25, 2007
wrote in message:
Uzytkownik "Captain Paralytic" <paul_laut...@xxxxxxxxxxx> napisal w wiadomo=


sci
wrote in message:
> Uzytkownik "Captain Paralytic" <paul_laut...@xxxxxxxxxxx> napisal w
> wiadomosci
wrote in message:
> > Are you testing the response from the statements you are using to
> > update the database?
> No I am testing the statements I am using to insert data into the
> database.
> M.
> > I mean in your code, to you check the return from the statements used
> > to update the database? Then you'll see if there was a problem with
> > the update!
> I have such code. I have made a mistake, I make update and insert, but I
> am
> interested in the table banner_view_history,
> where I store data about banners` views. My function returns nothing. I=
do
> "OPTIMIZE TABLE banner_view_history" and
> "OPTIMIZE TABLE banner_items" and I think that problem disappeared. But=
I
> am
> not sure for 100%.
> function UpdateBannerCount($id) {
> $this->_clearDBError();
> if(!$this->_connect()) {
> return false;
> }
> $sql =3D "SELECT id_banner_locations FROM
> ".$this->dbconfig["prefix"]."banner_items WHERE id_banner_items=3D".$id;
> $resultat =3D @xxxxxxxxxxx($sql);
> $assoc =3D @xxxxxxxxxxx($resultat);
> $this->query =3D "UPDATE ".$this->dbconfig["prefix"]."banner_items bi=
SET
> banner_view_count =3D banner_view_count+1 WHERE id_banner_items=3D".$id;
> $this->result =3D @xxxxxxxxxxx($this->query);
> $data =3D array(
> "referer" =3D>
> isset($_SERVER["HTTP_REFERER"])?$_SERVER["HTTP_REFERER"]:"",
> "useragent" =3D>
> isset($_SERVER["HTTP_USER_AGENT"])?$_SERVER["HTTP_USER_AGENT"]:"",
> "cookies_name"
> =3D>(isset($_COOKIE['test_cookie'])?$_COOKIE['test_cookie']:$_SESSION["=


test_c=AD=ADookie_session"]),
> "view_date" =3D> date("Y-m-d H:i:s"),
> "id_banner_locations"=3D>$assoc["id_banner_locations"],
> "id_banner_items" =3D> $id
> );
> $this->addElement($this->dbconfig["prefix"]."banner_view_history",
> $data);
> }
> Marcin
What do you mean "my function returns nothing"?
I cannot see anywhere in this code where you check for the success of
any of your database updates or an error messages returned.
-----------------------------------
I mean that I don`t have such code
function name_function
{
//operations on database
....
return $result;
}
by writing "my function returns nothing".
I don`t want to return anything because I use JAVAscript SWFObject class=
to
display flash banners and I call URL i.e. banner.php?id=3D22.
banner.php file contains two things:
1) the above function update and insert into the database - to increase t=
he
number of banner (id=3D22) views
and add visit trace into the banner_view_history table.
2) return needed data about the flash banner to make it display on the pa=
ge
<script type=3D"text/JAVAscript">
// <![CDATA[
var so =3D new SWFObject("banner.php?id=3D22", "fl_top22_=
f", "770", "100",
"7", "#ffffff");
so.addVariable("quality", "high");
so.addVariable("clickTag", "bannerclick.php%3Fid%3D22");
so.write("fl_top"+22);
// ]]>

</script>
Marcin- Hide quoted text -
- Show quoted text -



So write any errors to a log file. Then you can see what's happening.
You do not have to output them to the browser.


From: K. Date:   Thursday, October 25, 2007
<script type="text/JAVAscript">
// <![CDATA[
var so = new SWFObject("banner.php?id=22", "fl_top22_f",
"770", "100",
"7", "#ffffff");
so.addVariable("quality", "high");
so.addVariable("clickTag", "bannerclick.php%3Fid%3D22");
so.write("fl_top"+22);
// ]]>

</script>
Marcin- Hide quoted text -
- Show quoted text -



So write any errors to a log file. Then you can see what's happening.
You do not have to output them to the browser.OK but what about the speed of inserts into database. I don't think that`s
the problem of
errors while inserting or updating the data, because data during every
reloading the page
are the same and the only difference is that view_date is changing.

M.


From: Captain Paralytic Date:   Thursday, October 25, 2007
wrote in message:
> <script type="text/JAVAscript">
> // <![CDATA[
>
var so = new SWFObject("banner.php?id=22", "fl_top22_f",
> "770", "100",
> "7", "#ffffff");
> so.addVariable("quality", "high");
> so.addVariable("clickTag", "bannerclick.php%3Fid%3D22");
> so.write("fl_top"+22);
> // ]]>
> </script>
> Marcin- Hide quoted text -
> - Show quoted text -
So write any errors to a log file. Then you can see what's happening.
You do not have to output them to the browser.
OK but what about the speed of inserts into database. I don't think that`s
the problem of
errors while inserting or updating the data, because data during every
reloading the page
are the same and the only difference is that view_date is changing.
M.



You are guessing that "speed" is the problem. You've no evidence as
to what the problem is. Outputting the results of your update
operations gives you evidence of what is happening.


From: K. Date:   Thursday, October 25, 2007
You are guessing that "speed" is the problem. You've no evidence as
to what the problem is. Outputting the results of your update
operations gives you evidence of what is happening.



OK Thank you

Wish you a nice evening
M.



Next Message: Renaming an object


Blogs related to Too fast web page for mysql database

How can i ecommerce use Dejavu Mono font on urxvt I tried to use ...
I’ve tried apt-get –reinstall install mysql-server, but it won’t create /var/lib/mysql/* - How do I get apt to recreate it? while proceeding through the configuration druid of ekiga, i can select usb2.0 camera but the detecting the ...

Hey all I php5 have a database of all my albums and corresponding ...
i read those articles too; then i tried; mysql on freebsd died for me under load, mysql on linux flies. Habbie i understand. i prefer freebsd; but when a box needs mysql, i install linux. freebsd is the bestestest everrs ...

100 great free and open source tools and applications for web ...
MySQL is the world’s most popular open source database software, with over 100 million copies of its software downloaded or distributed throughout its history. With superior speed, reliability, and ease of use, MySQL has become the ...

Developersor anyone else dedicated ip for that matterhow big ...
DDragon , are you good with MYSQL ? would u be able to help me ? on wich page it gives utf-8 ? depends on what you need to do. SNow or Surya ? Im getting this error upon installation Critical Error Could not connect to the database ...

Feisty 32-bit & internet gnome after suspend or hibernate many ...
LAMP is an acronym for Linux-Apache-MySQL-PHP. However, the term is often used for setups using alternative but different software, such as Perl or Python instead of PHP, and Postgres instead of MySQL. For help with setting up LAMP on ...

How do I website delete all but the top 10 posts in a table I have ...
that’s running very very fast, but the issues will come later when someone asks to find a company in certain category so I guess I’ll add that index too. Kronuz, you know, MySQL can only use one index per table (at least I don’t know of ...


Programming | Sports | Autos

copyright 2006
Valid XHTML 1.0 Transitional