Re: Convert unix time to 12:00 AM of that same day

2011-03-01 Thread Bryan Cantwell
That's closer: SELECT UNIX_TIMESTAMP() + 86400 - (UNIX_TIMESTAMP() % 86400); Gives me 6:00 PM today... On 03/01/2011 12:32 PM, Singer X.J. Wang wrote: SELECT unix_timestamp() + 86400 - (unix_timestamp() % 86400); -- -- MySQL General Mailing List For list archives: http://lists.mysql.com/m

Re: Convert unix time to 12:00 AM of that same day

2011-03-01 Thread Bryan Cantwell
PM, Singer X.J. Wang wrote: http://en.wikipedia.org/wiki/Midnight On Tue, Mar 1, 2011 at 13:00, Singer X.J. Wang <mailto:w...@singerwang.com>> wrote: That's cause there's two midnights.. use = 1298999201 + 86400 + (1298999201 % 86400) On Tue, Mar 1, 2011 at 12

Re: Convert unix time to 12:00 AM of that same day

2011-03-01 Thread Bryan Cantwell
It was of course a typo, and even with the correct number isn't the answer On 03/01/2011 11:47 AM, Claudio Nanni wrote: You can start by using 60*60*24=86400 ;) On Mar 1, 2011 6:17 PM, "Bryan Cantwell" <mailto:bcantw...@firescope.com>> wrote: > I'd as

Convert unix time to 12:00 AM of that same day

2011-03-01 Thread Bryan Cantwell
I'd asked before how to convert a unix timestamp to the hour that it is in (and got the perfect answer) : 1298999201 = 3/1/2011 11:06:41 AM (1298999201 - (1298999201 % 3600)) = 3/1/2011 11:00:00 AM Now getting the timestamp converted to midnight of that same day isn't as simple as: 1298999201

Re: Get date from unix_timestamp only up to the hour

2011-02-24 Thread Bryan Cantwell
Yes perfect! Thanks, I knew I was over thinking this. On 02/24/2011 10:56 AM, Nathan Sullivan wrote: Bryan, Maybe something like this would work? select 1296158500 - (1296158500 % 3600) Hope that helps, Nathan On Thu, Feb 24, 2011 at 08:41:58AM -0800, Bryan Cantwell wrote: How would I go

Get date from unix_timestamp only up to the hour

2011-02-24 Thread Bryan Cantwell
How would I go about modifying a unix timestamp to actually represent the 'top of the hour' that it represents? For instance: 1296158500 = 1/27/2011 2:01:40 PM That is in the 2:00 pm hour, how can I find that out and modify it to 1296158400 which = 1/27/2011 2:00:00 PM? -- MySQL General Mai

Super active table optimization

2011-02-19 Thread Bryan Cantwell
I have an innodb table with 200 million rows and growing. It is a highly active table with tons of inserts and updates at all times. I notice a select query I test on that table is 0.01 seconds or less when all the inserts/updates are OFF. But when I throttle up the writes to the table, the selec

RE: Any way to change timezone WITHOUT mysqld restart?

2010-10-02 Thread Bryan Cantwell
work in spite of what the manual says. On Fri, 2010-10-01 at 15:42 -0700, Daevid Vincent wrote: > Did you even look at the manual? > > http://lmgtfy.com/?q=mysql+set+timezone > > First link. > > > > -Original Message----- > > From: Bryan Cantwell [mailto:b

Any way to change tinezone WITHOUT mysqld restart?

2010-10-01 Thread Bryan Cantwell
Any way to change timezone WITHOUT mysqld restart? It would be a lifesaver if there were some way for me not to have to restart because if mysql restarts then I have to go through a lot of other issues with my other apps.

How can I make mysql manager wait longer for mysql to stop

2010-09-28 Thread Bryan Cantwell
I'm using mysql 5.0.51a (yes I know it's old but I cannot upgrade at the moment) on linux. My challenge is that mysql admin does not wait long enough for mysql database(s) which are all innodb and VERY large (billions of rows) and eventually just kills the db. This causes innodb to try and repair

Get max ID of each item in a list

2010-09-10 Thread Bryan Cantwell
I have a simple table mytable id int time_stamp tiemstamp value int tid int I want to find the max id for each individual tid in my table. if I did it one by one it would be: select max(id) from mytable where tid = 12345; but how can I do something more like: select concat(tid,':',id) from my

Re: Reduce dataset but still show anomalies

2010-08-20 Thread Bryan Cantwell
Yes, but I DON'T want eh spikes smoothed out On Fri, 2010-08-20 at 17:16 +0200, Jangita wrote: > On 20/08/2010 5:12 p, Bryan Cantwell wrote: > > I am trying to produce charts for large amounts of data. I already limit > > the user to a smaller time frame in order to redu

Reduce dataset but still show anomalies

2010-08-20 Thread Bryan Cantwell
I am trying to produce charts for large amounts of data. I already limit the user to a smaller time frame in order to reduce the possible data points, but still can end up with far more data points than are clearly plottable on a chart. Does anyone have an idea of how I can drop insignificant poin

Replication: ignore specified columns?

2010-07-23 Thread Bryan Cantwell
I know that you can ignore certain databases and tables in mysql replication, but is it possible to replicate all but a certain column or two from a table? This is 5.1.48 on linux. Thanks, Bryancan -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:

Archive data from a single partition

2010-07-23 Thread Bryan Cantwell
I have a very large table (over 2 billion rows) which is partitioned by day. I'd like to archive all the data in the oldest partition to another table before I drop that partition. Is there some way other than a simple select statement that has parameters that match those of the partition whic will

Select ROW_COUNT() INTO a variable

2010-07-19 Thread Bryan Cantwell
I have a stored procedure in mysql 5.1.48 that deletes old data from my tables. I would like to keep a running count while it does this. Here is what I try now: ... DECLARE dropCnt INT DEFAULT 0; ... SET @sql = CONCAT('DELETE FROM myTable WHERE itemid = ', iID, ' AND clock BETWEEN 0 AND ', histUni

deletes from a VERY large table

2010-07-16 Thread Bryan Cantwell
I have to delete old records from a very large table (1.6billion rows) in a stored procedure. CREATE TABLE mytable( id BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, unix_time INT(11) NOT NULL DEFAULT 0, value DOUBLE (20, 4) NOT NULL DEFAULT 0., UNIQUE INDEX history_1 USING BTREE (id, unix_ti

combined or single indexes?

2010-07-06 Thread Bryan Cantwell
Is there a benefit to a combined index on a table? Or is multiple single column indexes better? If I have table 'foo' with columns a, b, and c. I will have a query like: select c from foo where a in (1,2,3) and b < 12345; Is index on a,b better in any way than an a index and a b index? An explain

Fancy partitioning scheme

2010-06-02 Thread Bryan Cantwell
Perhaps someone has already accomplished this: I have a simple table with 3 columns: mytable( myid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, myunixtime INT(11) NOT NULL DEFAULT 0, myvalue BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 ) It is collecting millions of rows. The myunixtime column is a un

file per table performance

2010-01-12 Thread Bryan Cantwell
Anyone have information they can provide on the performance hit of using innodb_file_per_table? I'd assume that since there are many individual tables that this would slow performance, but perhaps not. In a huge database, is this not a good idea, or a better one? -- MySQL General Mailing List

Use stored proc result set from another stored proc without temp table?

2009-12-09 Thread Bryan Cantwell
I have a stored proc I need to call from yet another stored proc, which then needs to use the results from the called proc ... I could probably use temp table but really dont want to do that unless absolutely required. I cant use OUT parameters, because the called stored proc returns multiple r

Mysql version of database link?

2009-12-07 Thread Bryan Cantwell
Does anyone have a suggestion on how a database link (like in Oracle) could be established between two Mysql databases on different servers? It would be awesome if I could write sql that will query both databases in one query... -- MySQL General Mailing List For list archives: http://lists.mys

How can I know if Mysql Crashed or stopped gracefully

2009-10-27 Thread Bryan Cantwell
I have an environment where upon boot of a machine I need to know if mysql shutdown nicely or if it crashed. How can I know for sure which was the case so that I can take action if needed? I notice that issuing a reboot or shutdown -r now command, (in Linux) that the 'service mysql stop' is nev

Re: Mysql service will not stop

2009-10-14 Thread Bryan Cantwell
...@eds.com Pager mail:9884430...@nma.vodafone.in -Original Message- From: Bryan Cantwell [mailto:bcantw...@firescope.com] Sent: Wednesday, October 14, 2009 8:40 PM To: mysql@lists.mysql.com Subject: Mysql service will not stop I have mysql 5.0.51a running on a linux 2.6.26 box. The service

Mysql service will not stop

2009-10-14 Thread Bryan Cantwell
I have mysql 5.0.51a running on a linux 2.6.26 box. The service my6sql stop command fails and all that appears in the log or err log is the following... what can I do to repair this? 091014 17:00:24guardian: instance 'mysqld' is running, set state to STARTED. 091014 17:07:40The instanc

Re: Replication recovery

2009-10-07 Thread Bryan Cantwell
easy to detect and repair with a daemon script. Even if both machines die, it'll be a similar scenario. Regards, Gavin Towey -Original Message----- From: Bryan Cantwell [mailto:bcantw...@firescope.com] Sent: Wednesday, October 07, 2009 10:47 AM To: mysql@lists.mysql.com Subject: R

Replication recovery

2009-10-07 Thread Bryan Cantwell
I have 2 - 5.0.51a mysql databases setup in a dual master scenario. A is master of B and vise versa... In Linux 2.6.26 (if that matters). Everything is great while all is running normally. But, when I am testing the system by creating disasterous scenarios, I find some challenges I hope to get

Debug Stored Proc

2008-05-06 Thread Bryan Cantwell
Is there no way to step thru a stored proc in order to debug it and see what it is doing? -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

create cursor from dynamic sql

2008-05-05 Thread Bryan Cantwell
I need to create a cursor using dynamic sql. Below is a short example of what I am trying to use in order to get the correct resultset... ignore the rest of the proc, I just need to know how to make the cursor declaration from @vsql Thanks DELIMITER $$ DROP PROCEDURE IF EXISTS `firescope`.`trigg

RE: Crashed InnoDB

2008-02-13 Thread Bryan Cantwell
on for your distribution on how to do that. Number of processes running now: 0 From: Dan Rogart [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 13, 2008 12:27 PM To: Bryan Cantwell; mysql list Subject: Re: Crashed InnoDB Have you tried starting mysqld with innodb_force_r

RE: Crashed InnoDB

2008-02-13 Thread Bryan Cantwell
No input on this one? -Original Message- From: Bryan Cantwell [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 12, 2008 11:51 AM To: mysql@lists.mysql.com Subject: Crashed InnoDB We had a power outage, now the mysql wont start at all. Here is the err file output... Any help on how to

Crashed InnoDB

2008-02-12 Thread Bryan Cantwell
We had a power outage, now the mysql wont start at all. Here is the err file output... Any help on how to recover? 080212 11:35:50 mysqld started 080212 11:35:50 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd fi

Mysql innodb commandline check and repair

2007-10-01 Thread Bryan Cantwell
I have Mysql 5.0.45 using innodb tables. Occasionally, I get corrupted tables. I can go into Mysql administrator gui and see the bad table and I can repair the index or whatever is wrong from the gui. I need a command line way to periodically detect for issues and if it finds one the I need a comma

Ugly sql optimization help?

2007-09-25 Thread Bryan Cantwell
I have the following horrible sql. I need one result that has all the data in one row. I am currently using 3 sub queries and figure it must be a better way... SELECT 'FS_DEV', ifnull(a.severity, 0) AS aseverity, ifnull(a.

dynamic sql in proc

2007-06-28 Thread Bryan Cantwell
I have the following proc... when I run it I get a response that says "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 'NULL' at line 1". I just want a programatic way to upgrade db engine to innodb where I don't

RE: string to timestamp conversion

2007-05-21 Thread Bryan Cantwell
I see no string to date function that does this conversion... -Original Message- From: Bryan Cantwell Sent: Monday, May 21, 2007 2:08 PM To: MySQL General Subject: string to timestamp conversion I have a table with a varchar column that contains a timestamp like this: 'Thu May

string to timestamp conversion

2007-05-21 Thread Bryan Cantwell
I have a table with a varchar column that contains a timestamp like this: 'Thu May 17 09:15:47 2007' I need to grab this and include it in an insert sql that puts that value in a table as a timestamp... -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:

Complex sql help

2007-04-02 Thread Bryan Cantwell
I have a need to output a recordset that shows the record with the higest value for severity within a date range. That is easy enough, but, in the same query, I need to show that data 3 times in the same query. Once where event_avail = 1, then again where event_perf = 1 and finally where even_sec =

RE: Need sql optimization help

2007-03-03 Thread Bryan Cantwell
day, March 03, 2007 1:40 PM To: Bryan Cantwell Cc: mysql@lists.mysql.com Subject: Re: Need sql optimization help Bryan, A 'Not Exists' query <http://www.artfulsoftware.com/infotree/queries.php#41> is usually faster when coded as an exclusion join, eg for max-some-value per key, left

Need sql optimization help

2007-03-03 Thread Bryan Cantwell
I have the following sql that works for what I want to see but is terribly slow due to the subquery. Any suggestions on how to get same result faster? I have tried group by and cant seem to get the correct results that way Also is there a product that can help optimize sql and indexing? SELEC

return all dates between two dates

2007-02-26 Thread Bryan Cantwell
055 06:01 AM0.02 2/24/2007 06:02:02055 06:02 AM0.08 Bryan Cantwell Director, Development (M) 469.361.1272 [EMAIL PROTECTED] www.FireScope.net

MySql 5 replacement for computed default column value

2006-01-02 Thread Bryan Cantwell
Trying to migrate to MySql 5 from Sybase asa. I have a tables that have column values that are calculated based on other columns in the table. How can I accomplish the same in MySql?   Here is sample of my asa table: CREATE TABLE "DBA"."OpptyDetail" (     "OpptyDetailID"