Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MYSQL


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Seconds Between 2 Dates - Why Does Seconds Jump By 40 Seconds?


I have a table for my sessions and basically i wanna check seconds between NOW() and when it was created.

I noticed that at every minute the seconds would jump by at least 40 seconds for every minute.

So if i created a new sesson on my site and Log NOW() into created

then i try doin SELECT (NOW() - created) AS created_sec

I was monitoring it because my site would log me out all the time. So I noticed at every minute it seems that it always jump 40seconds or more for every minute.

Here is table:...




View Complete Forum Thread with Replies

Related Forum Messages:
Slow Log File Has Times In Whole Seconds But Mysqldumpslow Has Fractions Of Seconds?
When I look at the mysql-slow.log file itself that I've set up, it lists times in whole seconds. However, when i run mysqldumpslow to parse that same log file, it shows times in fractions of seconds. The info from mysqldumpslow seems correct, but I can't figure out where it gets its info. Where is it coming from?

View Replies !
Difference Between Two Dates Including Seconds
1) I have mySQL 3.23 installed. I have a record with two date/times fields in YYYY-MM-DD HH:MM:SS format. How do I find the difference between those two date/times? (I would also like to know it with seconds left off.)

2) Let's say I have two records each with a date/time field in YYYY-MM-DD HH:MM:SS format. How do I find the difference in date/times when each field is in a different record?

View Replies !
How Many Seconds Query Took?
I'm sure this is one of the easiest questions to answer, but how to you know how many seconds it took to query the database? I noticed it on the command-line client and on a lot of forums.

View Replies !
Convert From Seconds To HH:MM:SS
Is there an easy way of converting a number (integer) into it's equivalent hh:mm:ss,

e.g. if the entry is 5400 then it would convert to 01:30:00 (e.g. one and a half hours).

View Replies !
Changing Value After 30 Seconds?
Is there a way to change a value after 30 seconds of it being changed? So if I change it to 1 from an external script, I want to 30 seconds later to change to 0. Is this possible without a script (or a script in sql of some sort?)?

View Replies !
Minutes & Seconds Only
I only want to store minutes & seconds for DVD chapter times, i.e., 3:10, or :24.

Should I use TIME,

View Replies !
Adding Seconds In TimeStamp
I have a table that contains an "interval" column and a timestamp column. I want to set the default value for the timestamp column to be the current timestamp plus the interval column which is a value in seconds.

View Replies !
Add Seconds To Current Time
I am trying to create a statment to add a given time in second to the current time like this:

update tags.triggers set next_interval=(addtime(curtime(),300)) where id=1;

This statment adds 3 minutes to the current time. How can I add 300 seconds to the current time?

View Replies !
SELECT Takes 20 Seconds
I am having trouble speeding up a SELECT statement from a table with 1,764 records.
I tried myisamchk --sort-index --sort-records=1 but this did not help (is a Primary key enough?).

Things were fine at around 1200 records but went downhill after 1700. I am using MySQL 3.23.42 on HP/UX 11.11 and PHP 4.3.4. Any tips on how to speed things up?

View Replies !
Mysql Does Not Respond For Several Seconds.
I have created a new database-driven website. I've installed php 5.1.1 and mysql 5.0
I'm working with the Mysqli connector.

Everything works fine. Except when a user starts tampering the website by continuously hitting the F5 button.

On the intro-page of the website, a lot of queries are being fired against the database. When the user hits F5 quickly for, let's say, 50 times the database times out and I get the ugly error:

"Warning: mysqli::mysqli() [function.mysqli]: (HY000/2003): Can't connect to MySQL server on 'localhost' (10048) in..."

After the database 'hangs' and I am unable to connect to it for at least 30 seconds...

Any idea why the tampering makes my database go down for a few secs ?

View Replies !
Is It Possible To Bypass 30 Seconds Time Out
hello im importing quite a large amount of .sql scripts into mysql and everytime i get this error

Fatal error: Maximum execution time of 30 seconds exceeded in www.*******

is it possible to alter this default timeout to a longer timeperiod and if so how is it done,

im using MySQL v5.0.27, together with PHP v5 and phpmyadmin v2.9.03

View Replies !
Insert Row With NOW() Plus Twenty Seconds?
Is there any way you can state in your INSERT command through mysql to add twenty or so seconds onto the NOW() function?

View Replies !
Mysql Killing The Connection After X Seconds
I'm running mysql 4.0.20a on Windows XP Pro. I have a java web
application that connects to the database for storing persistent java
classes.

I am running into a problem when I leave my application running
overnight... I try to log in to my page in the morning and it gives
me a JDBC Exception. If I restart the web server (not the mysql
server) and then try to log in to my app runs fine.

In trying to troubleshoot I've used the mysql control center to show
the processes of the mysql server and it shows that my web app doesn't
really disconnect after running a query, it just sleeps.

Does mysql kill a connection if it has been sleeping for a long time?
How do I change this? How do I find out how many seconds of sleeping
before mysql kills the connection?

View Replies !
3 Seconds To Run A Select That Returns Empty Set?
I have recently created a very simple table with 2 VARCHAR fields. I have then created a quick php script to loop through some inserts (inserted 600000 rows) and then deleted all the rows by doing "delete from Table where field1="abc" which should delete all rows. I then did a select * from Table and the query took 3 seconds! The return result set is empty!

Later I found out that if I do a delete * from Table, without a where clause. And then after tat do a select * from Table, it will take 0.0 seconds. Why is this? How to fix?

View Replies !
Delete Inactive Sessions Every 60 Seconds?
I have a session table, where I stored user sessions in the database in a memory table. My question is, performance wise, would it be smarter to delete inactive sessions every 60 seconds via client http requests, or would it be wiser to select active sessions via a select that uses a where clause and searches a timestamp index column for active sessions, and then a cron job is scheduled to delete every 30 minutes.

Which of these would be the better choice? On each page request I am going to have to select the number of sessions that exist and a second query that displays the active users. So if I go with my second choice, I will have to include a WHERE clause that scans the index on both those queries. But if I am issuing a delete every 60 seconds, then I won't have to do that, but then the delete is taking place every 60 seconds on a client request.


View Replies !
DATETIME :: Total Elapsed Seconds
I need to find out the total elapsed seconds between two DATETIME fields.

View Replies !
Sql Error - Shuts Down The Website In 5 Seconds
There is a program called as D4 and it sends a huge data to the sql database and it slows down the website in the first 2-3 seconds and then in a few seconds it shuts down
the website until s/he stops using the program. We made a huge research over
the internet, but we couldn't find any solutions for this. It can shut down
any website, that's having a sql based database. I hope you can help us with
this problem. Thank you for your attention and time.

if the site admins want to get the program, they can contact us. However, they should be aware that this is a dangerous program so it shoudn't be distrubuted.

View Replies !
Avoid Duplicate Records In Within 30 Seconds
I'm working with php. I have a auction site, more or less. I want to create all-time rankings. The idea is to display where a seller ranks (all time) in the number of sales.

So for example, I'd display
John Doe All Time Sales Ranking: #138

I'm not exactly sure how to go about this.

$query = "SELECT count(*) as counter, SellerName FROM sales GROUP BY Sellername ORDER BY counter DESC";

This query would give me the data to list all of the Sellers in desc order by the number of sales.

In php, I could probably count until the Sellername was equal to $Sellername (already defined in their profile page), but I was hoping there would be a way to do this entirely in MySQL.


View Replies !
Every 30 Seconds -- Reconnecting After A Failed Master Event Read
Every 30 seconds -- Reconnecting after a failed master event read ....

View Replies !
Converting A TIME Field Into Seconds : Error Message
CREATE TABLE `m010` (`date` date NOT NULL, `hour` time NOT NULL, `duration` time default NULL, `cs` int(11) default NULL, `id` bigint(20) NOT NULL auto_increment,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC

the field 'duration' is in TIME format (thus 00:00:00) .. I want to convert it in seconds.

I've read that I can do something like this:

mysql> select duration, TIME_TO_SEC (m010.duration) AS 'ts' from m010 WHERE id = 736;

Problem is, I get this error :
ERROR 1305 (42000): FUNCTION m010.TIME_TO_SEC does not exist

View Replies !
DATETIME Difference In Years, Months, Days, Hours, Seconds
I am looking for a solution to compute a difference between two datetimes.

Example :
Select SEC_TO_TIME
(UNIX_timestamp('2009-2-2 10:1:2')-
UNIX_TIMESTAMP('2009-2-1 10:00:00'))

Returns 24:01:02

There is no SEC_TO_DATE nor SEC_TO_DATETIME
How could have a result like 1day 1minute 2seconds ?

View Replies !
MySQL 4.0.18 On Dual AMD64 Opteron Causing Thread Zombie Even When Timeout Is Set To 60 Seconds
We have a problem with Dual AMD64 Opteron/MySQL 4.0.18/Mandrake 10
for a very high volume site. We are evaluating the performance on our
new server AMD64 and it seems it's slow compared to Dual Xeon/MySQL
4.0.15/RedHat8 and Dual Xeon/MySQL 4.0.18/Mandrake 10.

And it seems there are zombie threads. 570 threads in 1 hour and we
didn't even use JDBC connection pooling at all. These threads are
supposed to be gone within 60 seconds, since we set that option in
mysqld. Note that we run many SELECT queries (can be up to 150
queries/seconds), but the system does not indicate any slow query:
it's 0!

Our configuration is Apache 2.0.48 + Tomcat 5.0.27 + MySQL 4.0.18 with
MySQL connector/J 3.0.14 (latest stable). The Redhat 8 runs on Apache
2 + Tomcat 4.0 + MySQL 4.0.15. The old Redhat 8 on Xeon was fine. We
have another machine running Mandrake 10 on Xeon and they were fine
under the same load.

I have set the wait_timeout to 60 seconds, and it appears to be fine
within 10 minutes, all the threads that are in "sleep" mode
disappeared after 60 seconds. After a few minutes though, it's back
like it was before.

Is this Mandrake problem? MySQL problem? I read in here than Mandrake
win hands down on AMD64 compared to FreeBSD. Code:

View Replies !
Maximum Execution Time Of 300 Seconds Exceeded (was "MYSQL Error")
I have a huge database 400mb+ in size which i have exported into a .sql file. I tried to run this export script into a new database and it runs fine until three quarters into the scripts execution and the following error appears:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '<br / >
<b>Fatal error</b>: Maximum execution time of 300 seconds exceeded in <b' at li ne 1
I believe this error may relate to "delayed_insert_timeout = 300". How do I increase this limit in mysql - maybe it may solve the problem but then again it may not .

Any advice is most gratefully appreciated - As you can imagine if the script runs fine for 3/4 of it and then an error appears, stating the error is on line 1, it will take me days to go through the whole script (hundreds of thousands of rows) to find the error as I assume the error does not reside on line 1 as this line would have been executed.

I am running the script on mysql 5, and via source /path/****.sql on linux.

View Replies !
Unable To Jump To Row
What is wrong with my QUERY?
PHP Code:

 $result = mysql_query("SELECT * FROM $table WHERE ( LAT_1 BETWEEN '".$x_min."' AND '".$x_max."' ) AND ( LONG_1 BETWEEN '".$y_min."' AND '".$y_max."' )");

$total  = mysql_result($result, 0, 0); 

View Replies !
Unable To Jump To Row 0 On MySQL
I have got a Php remote application that worked perfectly with mySQL DB.

I putted, truough this application, many many rows in DB but now, when I try with another application's instance to access DB rows, only some of them comes visible, for the other ones i read "Unable to jump to row 0 on MySQL result index ... in ..." (after in, I got the URI for the Query function php file).

View Replies !
MySQL Threads Significant Jump
My website hit a time when the only thing coming up
was the "can't connect to local mySQL server" error from PHP. When I
ran a mysqladmin -status, my threads were anywhere from 120-160. The
site uses Xoops as its CMS, therefore the homepage everyone sees loads
from mySQL. I made a couple of changes to reduce the content being seen
on the front page and my threads dropped to 4-6.

My main question to this group is: what are these threads and what would
cause so many to be used? It can't be connections because even after we
simplified the home page, we still had many users. The mySQL manual
doesn't describe well what the threads are and what would cause them to
increase.

View Replies !
How To Jump Into Auto Increment Values
I have used auto increment for inserting value id. Now i want to jump this for example i want insert the values 200,201 or 200,202,204 instead of 2,3,4..

How can i jump or swap....

View Replies !
Converting MS Access Dates To MySQL Dates During LOAD DATA INPUT ?
My insert code is below. The MySQL server is on my local machine and is version 4.1.22. I am exporting from an access table with 6 fields to a mysql table with those 6 plus 5 more fields. The main problem I am having SO FAR, is converting dates. The data file dates are formated like:
2/2/2006 0:00:00, 12/20/2006 9:22:05

Any ideas how to format those into mysql friendly dates?

Also, how do I convert currency fields in the load data process? I know you use SET by what kind of formula?

===========================================

LOAD DATA INFILE 'C:Documents and Settingspath_to_filedata.txt'
INTO TABLE auto
(field2, field3, field4, field5, currency_field6, field7, date_field8, date_field9)
SET id = MD5(UUID())
FIELDS TERMINATED BY ','
LINES TERMINATED BY '
'

View Replies !
Update String Dates Into Mysql Dates
I've got a table that someone created with varchar fields for month, day, and year. I've added a DATE field to the table, and now I want to combine all three of these strings into one DATE and stick it into the DATE field. Once I've got this done, I can delete those three varchar fields and just have the nice DATE field.

Here's the command I've tried in several variations but no luck--syntax errors every time:

UPDATE SET OCR_Entry_Date = date_format(str_to_date(concat_ws('-', OCR_MM, OCR_DD , OCR_YYYY) ,"%b-%d-%Y"), "%m-%d-%Y") WHERE OCR_YYYY = '1974'

OCR_Entry_Date is a DATE field and the others are the varchar fields. My logic is basically:

1. concatenate the separate field values into a single string
2. convert the string into a date
3. format the date in the way I'd like it in the table

View Replies !
Select Into Two Tables, One With Dates Second With Events For Those Dates
I'm havin' a headache supplying the right query for the following situation:...

View Replies !
MSSQL Dates -&gt; MySQL Dates Automatically?
We're using data feeds that were originally meant for MS SQL and the dates in the data feed (tab delimited text files) are formated like:

Oct 21 2007

In MySQL, the date fields are formatted as datetime fields and when we do an import the dates all come through as 0000-00-00 00:00:00.

We're importing using the MySQL "LOAD DATA LOCAL INFILE" command and just dumping the text files right into freshly truncated tables.

Is there a way when loading the files to find and replace the dates maybe? Can MySQL convert the dates?

I have a shell script downloading an archive and uncompressing, then it runs a PHP script that loops through the files runningt he LOAD DATA command.

Any advice would be appreciated... I'm just looking for the easiest (and least server-intensive) way to get the date issue fixed. We've already tried begging the vendor but they're not yet ready to start supporting other date formats (even though their MS SQL db can output a date format friendly to MySQL).

Thanks!

View Replies !
"Unable To Jump To Row"
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 4 in /home/chilipie/public_html/icook/index.php on line 29

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 4 in /home/chilipie/public_html/icook/index.php on line 30

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 4 in /home/chilipie/public_html/icook/index.php on line 31<?php

require("includes/header.inc.php"); // Include Header

$current_page=$_GET['page']; // Define "current_page"

$query_pages="SELECT * FROM pages WHERE url_title='$current_page'"; // Define "query_pages" (MySQL Query)

$result_pages=mysql_query($query_pages); // Define "result_pages"

switch($_GET['page']) { // Get Page ID

Code:

View Replies !
List All Dates Between 2 Diff Dates
I have a database which stored financial data daily exclude weekend, however sometimes i tend to forget to upload data into the database. How do i write a sql query that would detect the missing dates between from last updated date until the current date.

View Replies !
Dates Pre 1970 And Dates After 2050
i have MySQL version: 4.1.16-nt,

when i try to insert a date pre 1970 or after 2050 into a timestamp field, the date is stored as all 0's,

how can i save a date pre 1970 and after 2050 into a mysql field?

View Replies !
List All The Dates Between 2 Given Dates Using SELECT
how I can list all the dates between 2 dates (inclusive) using SELECT sql statement in mysql?

I have a member table with the following columns:
id int autoincrement
name varchar(40)
join_date date

I want the following output (date, count of members joined on that date):
1 April 2009...... (2 members joined)
2 April 2009...... (0 members joined)
3 April 2009...... (3 members joined)
.....so on ...upto
30 April 2009.....(1 members joined)

For the above output I need the SQL command that is valid in mysql. Is there anyone who can produce the above result with a single SELECT command. Please don't suggest that is possible using php for loop or creating a mysqlorary table first and then inserting all the dates into it. Then make a join between mysql table and members table using date as GROUP by column etc. etc.

I know this is possible using some user variables as I searched through the various SQL tutorial sites. But I am unable to figure out how I can produce a list of all dates between 2 given dates.

View Replies !
Stroring Dates Perior To 1 AD, BC Dates
I need to store some dates that can be BC, However I received a problem indicating Incorrect Datetime.

I have read the documentation, and it says that Date&DateTime types can store from 1000-9999 AD, and Timestamp stores less year ranges. What other options do I have to store dates before 1000 AD !

View Replies !
How To List All Missing Dates Between 2 Dates
I have a database which stored financial data daily exclude weekend, however sometimes i tend to forget to upload data into the database. How do i write a sql query that would detect the missing dates between from last updated date until the current date.

View Replies !
Dates, Dates, Dates - Syntax Help Please!
OK, I have a MySQL table which contains, among others, a field called date which stores dates in the format YYYY-MM-DD HH:MM:SS.

What I'd like to do is select a list of all the months present (without repetition), preferably in the format YYYY-mm

View Replies !
Between Dates Using NOW()
I have a query that I build that will grab all the rows it finds that have a drop_time in the last 48 hours. Below is my query.

Code: ....

View Replies !
Using Between For Dates
I use a query like this:

[MYSQL]AND `updatedate` BETWEEN '2008-10-26' AND '2008-11-01'[/MYSQL]
While that works, it does not display the records on Nov 1.

I could use this:

[MYSQL]AND `updatedate` BETWEEN '2008-10-26' AND '2008-11-02'[/MYSQL]
but that includes all of the records on both Nov 1 and Nov 2.

Anyway, how to get it only display records that have dates from Sept 26 to Nov 1 and excluding the rest?

View Replies !
Dates Between Dates
Is it possible to query dates between two dates straight from mysql database? Example: I have two dates in my database that function as start of an event and end of an event.

I can get results when I seek an event that starts 2006-07-30 and ends at 2006-08-06 with following sql-query:

select eventid from database where (startdate between '2006-07-30' and '2006-08-06') or (enddate between '2006-07-30' and '2006-08-06');

Or by using any date values that go "over" the specified dates in database. Problem is that I would like to get the event also when it's active between these dates. Like from 2006-07-31 to 2006-08-02, but no result will be returned with this example query:

select eventid from database where (startdate between '2006-07-31' and '2006-08-02') or (enddate between '2006-07-31' and '2006-08-02');

View Replies !
BETWEEN Two Dates
I am making a calendar function in php and i need to know if an appointment already exists between two dates. I am trying to use some like below but with no avail, any other ideas?

SELECT id FROM appoit WHERE UNIX_TIMESTAMP(day) BETWEEN '$date' AND '$until' AND room='$room'

Note:
`day` is actaully stored as a datetime value
$date is the wished start date and time in the format of php's mktime
$until - as above but when the appointment will end

View Replies !
When Should I Use Int For Dates?
I'm thinking about storing dates in my databases as unix timestamps in int fields. Since I use PHP I'm thinking it would be convenient to have timestamps rather than datetime fields.

But someone told me I can't store dates earlier than 1970 as timestamps. So do I have to decide from application to application if I expect to be using dates earlier than 1970, or is there a way around this rule?

View Replies !
Dates Between
I want to write a query that gets all the dates between 2 specific days (not the difference between them).

View Replies !
Between Dates
SELECT * FROM Bookings WHERE PropertyID = 1 AND ((StartDate BETWEEN 1122854400 AND 1125532799 )OR (EndDate BETWEEN 1122854400 AND 1125532799))
Thats my SQL statement, this is my end date 1124037406 which unless my maths is failing me, is between the 2 values but my sql query returns no results.

View Replies !
BETWEEN X AND X For Dates
I'm trying to find all records that fall between two dates. BETWEEN only seems to be for integers so I was wondering there was a similar construct for dates.

View Replies !
Dates In SQL??
I'm having some trouble with dates in MySQL.

I'm developing a site that has an area for news. I've created a table that's called NEWS and it has 3 columns: id, date, news_text.
For the date I've given these properties: datatype:timestamp, default:current_timestamp.

The problem arises when I retrieve the news. I want the date to be printed as well in the form of YYYY-MM-DD, but I guess due to the current_timestamp, I get YYYY-MM-DD HH:MM:SS.

1) Is there a way to ommit the time??
2) How can I change the format and make it DD-MM-YYYY??

View Replies !
List Of Dates
i need a jsp program code for date generation.(mssql-back end)

Fields are fromdate and todate both field are datetime datatype.

Button:-save,cancel,exit

both dates are given by the user

how to generate the date between these two date.

ie.lists of date between the fromdate and todate with datatype datetime

View Replies !
Average Between Two Dates
I am trying to figure out how to find the avg in between two dates in the work_date field. For example, let's say I want the avg from 2007-01-24 to 2007-05-06, I would have to find the avg by taking the values in the daily_typing_pages columns and add up all the columns between the the dates provided. (E.G. (100+220+350+250+170)/5).

View Replies !
Add Dates In Loop
but I can´t get it to work.
I have an table with columns named like this:

2004-12-01, 2004-12-02 and so on,

So I need to get the dates between two dates and update with the new values the columns with the same name as the dates I got.

$date = 2004-12-01;
$enddate = 2004-12-10;
for($date<=$enddate; $sSQL++
{
$sSQL = "SELECT DATE_ADD('$date', INTERVAL 1 DAY) date";
$sSQL = mysql_query($sSQL);
echo "$date";
then I should update my table like this:
$sSQLsql = mysql_query("UPDATE `disponibilidad` SET `$s` = 'w' WHERE `property` = 'Banana_Beach_3' ");

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved