Tagged Questions
1
vote
1answer
48 views
datetime vs timestamp in mysql 5.5
What is the difference between datetime and timestamp in MySQL with respect to data being inserted from different timezones? Does anyone have any clues on this?
I have a situation where I am trying ...
0
votes
2answers
79 views
Should I disable triggers, timestamps in a slave in mysql?
We're using MySQL. We have a master that eventually will have 2 slaves. There are triggers in the db that execute when data changes in certain tables. I am wondering whether to disable the triggers in ...
2
votes
1answer
137 views
What happens when changing column type DATETIME to TIMESTAMP in MySQL?
I want to convert a column data type from DATETIME to TIMESTAMP in a table with more than one million of lines.
Is it possible? Is it slow? Will I loose the old information or MySQL can convert this ...
4
votes
1answer
119 views
How can I improve this DB query? it takes too much time
The query is this:
$today = $date->getTimestamp();
SELECT t.*, u.screen_name, u.profile_image_url
FROM table AS t
LEFT JOIN users AS u
ON t.user_id=u.id_str
WHERE ...
4
votes
1answer
91 views
MySQL year 2038 vulnerable
I was studying Drupal and asked this question:
http://drupal.stackexchange.com/questions/45443/why-timestamp-format-was-chosen-for-users-created-field/45446#45446
I decided to check, how the CMS ...
0
votes
2answers
315 views
Dates changed to 0000-00-00
Previously, on my table (~81000 rows), I have had date and time fields set as VARCHAR instead of date/time. All those dates were of the type MM/DD/YY. I changed the type from VARCHAR to DATE and TIME ...
0
votes
2answers
3k views
MySQL Set UTC time as default timestamp
How do I set a timestamp column whose default value is the current UTC time?
MySQL uses UTC_TIMESTAMP() function for UTC timestamp:
mysql> SELECT UTC_TIMESTAMP();
+---------------------+
| ...
0
votes
1answer
2k views
How to compare (in MySQL) a DATETIME value to a TIMESTAMP value?
I'm trying to understand how to compare a DATETIME value (ostensibly inserted as GMT) and a TIMESTAMP value (automatically generated at INSERT time).
As I understand it, the DATETIME is set to ...
0
votes
0answers
113 views
setting timestamp column as pk to prevent concurrent editing of records?
While I was familiarizing myself with all the new data types in MySQL, I noticed the TIMESTAMP data type, and thought "What if I make this TIMESTAMP field and the CustomerID field (the other pk) a ...
2
votes
3answers
373 views
Finding five-minute interval prior to current time
I want to find the five minute interval just before the current time. So if the current time is 8:43 I want to return 8:35 and 8:40. Here is the query that I have written and it is working as ...
5
votes
2answers
2k views
Storing time with milliseconds in database
Just a quick question regarding storing "time" in a database. I'm logging the time of users runs which are in the format 00:00:00:00 (hours, minutes, seconds, milliseconds).
I was originally going to ...
2
votes
3answers
1k views
Sorting by DATETIME slower than by TIMESTAMP?
I have the a DATETIME key on which I sort the results and the query is running quite slow. Will it run faster if I change it to TIMESTAMP ?
Because I noticed that ordering by numbered keys is done ...
2
votes
1answer
299 views
MySQL unclearness about DataType TIMESTAMP with DefaultValue CURRENT_TIMESTAMP
In MySQL InnDB engine I created TableColumn with data type TIMESTAMP and put there as default value CURRENT_TIMESTAMP, but this value are always changed to CURRENT_TIMESTAMP when I update that by ...
4
votes
2answers
530 views
Best way to handle dates prior to 1000 A.D. in MySQL?
I am creating a database for records that extend prior to 1000 AD, but MySQL Date and DateTime fields only support dates starting at 1000.
Is there a way that would be more convenient than either ...
1
vote
2answers
972 views
How to set addtime(current_timestamp, '15:00:00') as MySQL timestamp column default value?
I want to set `addtime(current_timestamp, '15:00:00') as the default value of one MySQL table column. I tried to do this with the following command but failed:
mysql> alter table mytable change c1 ...