Re: strange select/join/group by with rollup issue....

2012-02-08 Thread Andy Wallace
Thanks, it seems to be working now. I just discovered WITH ROLLUP. It made me very happy on this project... On 2/8/12 2:54 AM, Arthur Fuller wrote: I'm not sure your method isn't working, but try changing changing the to date part to '2012-02-08' and see what you get. HTH, Arthur --

strange select/join/group by with rollup issue....

2012-02-07 Thread Andy Wallace
I am having a problem with select results that I don't understand. It seems to be tied up with a GROUP BY statement. Forgive the complexity of the SQL, I inherited some problematic data structuring. If I use this statement: SELECT lu_rcode_bucket.bucket AS 'BUCKET', CP_PKG.value

Select data from large tables

2011-11-15 Thread Adarsh Sharma
`idx_dtstamp` (`dt_stamp`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 Now I need to select distict category from content_table of size 90Gb. Simple select command can take days to complete I donot think creating index on that column is a good idea. Please let me know any ideas to do that. Thanks

Re: Select data from large tables

2011-11-15 Thread Adarsh Sharma
` (`dt_stamp`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 Now I need to select distict category from content_table of size 90Gb. Simple select command can take days to complete I donot think creating index on that column is a good idea. Please let me know any ideas to do that. Thanks

Re: Select data from large tables

2011-11-15 Thread Johan De Meersman
:41 AM Subject: Re: Select data from large tables More than 20163845 rows are there and my application continuously insert data in the table. daily i think there is a increase in 2.5 Gb in that table. Thanks -- Bier met grenadyn Is als mosterd by den wyn Sy die't drinkt, is eene kwezel

Re: How to select the id of 2+ records for given user?

2011-10-20 Thread Hal�sz S�ndor
; 2011/10/19 17:06 -0500, Basil Daoust For me given the sample data the following worked. The inner select says find all first messages, the outer says give me all messages that are thus not first messages. select * from table1 where messageID NOT IN ( select messageID from table1 group

Re: How to select the id of 2+ records for given user?

2011-10-20 Thread Dotan Cohen
2011/10/20 Halász Sándor h...@tbbs.net: Well done--but Although, it seems, it is everyone s experience that the desired order is the order that MySQL yields, all guarantee of that is explicitly deny'd (look up 'GROUP BY'). It is better to be safe and to use MIN: select * from table1

How to select the id of 2+ records for given user?

2011-10-19 Thread Dotan Cohen
Assuming a table such this: | ID | messageID | userID | ||-|| | 1 | 345 | 71 | | 2 | 984 | 71 | | 3 | 461 | 72 | | 4 | 156 | 73 | | 5 | 441 | 73 | | 6 | 489 | 73 | | 7 | 483 | 74 |

Re: How to select the id of 2+ records for given user?

2011-10-19 Thread Michael Dykman
I'm afraid that what you are looking for simply cannot be done with MySQL alone. You will need to pare your results at the application layer. Remember that rows have no inherent order except for conforming to any ORDER BY clause contained within the query. - md On Wed, Oct 19, 2011 at 1:27

Re: How to select the id of 2+ records for given user?

2011-10-19 Thread Derek Downey
You could do a GROUP_CONCAT to get you close: SELECT userID, SUBSTRING_INDEX(GROUP_CONCAT(messageID), ',', 1) messageList FROM table GROUP BY userID | userID | messageList | |--|---| | 71| 984| | 73| 441, 489| | 74

Re: How to select the id of 2+ records for given user?

2011-10-19 Thread Basil Daoust
For me given the sample data the following worked. The inner select says find all first messages, the outer says give me all messages that are thus not first messages. select * from table1 where messageID NOT IN ( select messageID from table1 group by userID ) Some times just playing

Re: How to select the id of 2+ records for given user?

2011-10-19 Thread Derek Downey
, and not something I need to run everyday. -- Derek Downey On Oct 19, 2011, at 6:06 PM, Basil Daoust wrote: For me given the sample data the following worked. The inner select says find all first messages, the outer says give me all messages that are thus not first messages. select * from table1

Re: How to select the id of 2+ records for given user?

2011-10-19 Thread Dotan Cohen
On Thu, Oct 20, 2011 at 00:06, Basil Daoust bdao...@lemonfree.com wrote: For me given the sample data the following worked. The inner select says find all first messages, the outer says give me all messages that are thus not first messages. select * from table1 where messageID

Re: How to select the id of 2+ records for given user?

2011-10-19 Thread Dotan Cohen
On Thu, Oct 20, 2011 at 00:11, Derek Downey de...@orange-pants.com wrote: Ah-hah! :) Actually, I did something similar to that a month or so ago. I ran into a speed limitation on a not-small database (~3mill rows). So be careful. Luckily in my case, I put all the 'minimum' ids in a memory

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-07 Thread Johan De Meersman
time, so i'm not sure about this but.. is the INSERT locked due to the SELECT queries that have been running for so long? And are the rest of the selects (with 8s running time) locked by the INSERT? Yes, because MyISAM doesn't have a mechanism for keeping multiple concurrent consistent views

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Joey L
/ any thoughts or help would be appricated. thanks On Mon, Oct 3, 2011 at 1:22 PM, Eric Bergen eric.ber...@gmail.com wrote: Can you run show processlist in another connection while the select count(*) query is running and say what the state column is? On Mon, Oct 3, 2011 at 7:00 AM, Joey L mjh2

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Joey L
/ any thoughts or help would be appricated. thanks On Mon, Oct 3, 2011 at 1:22 PM, Eric Bergen eric.ber...@gmail.com wrote: Can you run show processlist in another connection while the select count(*) query is running and say what the state column is? On Mon, Oct 3, 2011 at 7:00 AM, Joey L mjh2

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Johnny Withers
with '.cnf', otherwise they'll be ignored. # !includedir /etc/mysql/conf.d/ any thoughts or help would be appricated. thanks On Mon, Oct 3, 2011 at 1:22 PM, Eric Bergen eric.ber...@gmail.com wrote: Can you run show processlist in another connection while the select count(*) query is running

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Joey L
be ignored. # !includedir /etc/mysql/conf.d/ any thoughts or help would be appricated. thanks On Mon, Oct 3, 2011 at 1:22 PM, Eric Bergen eric.ber...@gmail.com wrote: Can you run show processlist in another connection while the select count(*) query is running and say what the state column

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Johnny Withers
...@gmail.com wrote: Can you run show processlist in another connection while the select count(*) query is running and say what the state column is? On Mon, Oct 3, 2011 at 7:00 AM, Joey L mjh2...@gmail.com wrote: this is not a real query on the site - it is just a way i am measuring performance on mysql

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Johan De Meersman
I keep finding it extremely peculiar that a count(*) on a MyISAM table would take that long. InnoDB needs to effectively *count* the records, but MyISAM keeps accurate statistics and can just read it from the metadata. This suggests to me that not all your metadata (ie., table descriptors et

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Rik Wasmus
thanks for the response - but do not believe queries are the issue because - Like I said - i have other websites doing the same exact queries as I am doing on the site with the 9gig table. Contrary to popular believe, size DOES matter... And having a table large enough so it doesn't fit in

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Joey L
0.5/s1.48 Slow 10 s 68 0.0/s0.14 %DMS: 0.55 Log: OFF DMS12.28k 8.2/s 24.46 SELECT 11.09k 7.4/s 22.10 90.36 UPDATE 539 0.4/s1.07 4.39 INSERT 384 0.3/s

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Andrew Moore
3.21k 2.1/s6.39 COM_QUIT 2.89k 1.9/s5.76 -Unknown745 0.5/s1.48 Slow 10 s 68 0.0/s0.14 %DMS: 0.55 Log: OFF DMS12.28k 8.2/s 24.46 SELECT 11.09k 7.4/s

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Andrew Moore
24.46 Com_ 3.21k 2.1/s6.39 COM_QUIT 2.89k 1.9/s5.76 -Unknown745 0.5/s1.48 Slow 10 s 68 0.0/s0.14 %DMS: 0.55 Log: OFF DMS12.28k 8.2/s 24.46 SELECT 11.09k 7.4

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Joey L
    0.5/s            1.48 Slow 10 s          68     0.0/s            0.14  %DMS:   0.55  Log: OFF DMS            12.28k     8.2/s           24.46  SELECT       11.09k     7.4/s           22.10         90.36  UPDATE          539     0.4/s            1.07          4.39  INSERT          384     0.3

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Michael Dykman
5.76 -Unknown745 0.5/s1.48 Slow 10 s 68 0.0/s0.14 %DMS: 0.55 Log: OFF DMS12.28k 8.2/s 24.46 SELECT 11.09k 7.4/s 22.10 90.36 UPDATE 539 0.4/s1.07

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Andrew Moore
...@singerwang.comwrote: Okay, lets hold on for a minute here and go back. We're side tracking too much. Lets state the facts here: 1) MyISAM stores the row count internally, a 'select count(*) from table' DOES NOT DO A FULL TABLE SCAN 2) hell, a software RAID6 of 2 MFM drives could do a seek

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Joey L
| root | localhost | NULL | Query |0 | NULL | show processlist | | 2507 | p_092211 | localhost | p_092211 | Query |5 | Locked | SELECT oldurl, dateadd FROM w6h8a_sh404sef_urls WHERE newurl = 'index.php?option=com_communityItemi | | 2508

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Johnny Withers
I've sent this email a few times now, mysql list kept rejecting it due to size, sorry for any duplicates I think you need to examine this query in particular: | 2567 | p_092211 | localhost | p_092211 | Query | 11 | Sending data | select oldurl, newurl, id, dateadd from

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Jan Steinman
From: Joey L mjh2...@gmail.com i did google search - myisam is faster...i am not really doing any transaction stuff. That's true for read-only. But if you have a mix of reads and writes, MYISAM locks tables during writes, which could be blocking reads. In a museum in

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Joey L
Guys - I wanted to thank you all very much for your help I found the offending code on the website ! thank you very very very much... what did it for me was a combination of show processlist and show full processlist. I saw the full queries and the main thing was that it was doing a query

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Andrew Moore
Glad you got to the bottom of it Joey. On 7 Oct 2011 01:23, Joey L mjh2...@gmail.com wrote: Guys - I wanted to thank you all very much for your help I found the offending code on the website ! thank you very very very much... what did it for me was a combination of show processlist and

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-03 Thread Joey L
Thanks for the input - 1. I will wait 48 hours and see what happens. 2. can you tell me what are some performance tests I can do to help me better tune my server ? 3. I am concerned about this table : | w6h8a_sh404sef_urls | MyISAM | 10 | Dynamic| 8908402 |174

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-03 Thread Andrés Tello
have you tried select count(yourindex) instead of select count(*) ? On Mon, Oct 3, 2011 at 7:53 AM, Joey L mjh2...@gmail.com wrote: Thanks for the input - 1. I will wait 48 hours and see what happens. 2. can you tell me what are some performance tests I can do to help me better tune my

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-03 Thread Joey L
:58 AM, Andrés Tello mr.crip...@gmail.com wrote: have you tried select count(yourindex) instead of select count(*) ? On Mon, Oct 3, 2011 at 7:53 AM, Joey L mjh2...@gmail.com wrote: Thanks for the input - 1. I will wait 48 hours and see what happens. 2. can you tell me what are some

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-03 Thread Eric Bergen
Can you run show processlist in another connection while the select count(*) query is running and say what the state column is? On Mon, Oct 3, 2011 at 7:00 AM, Joey L mjh2...@gmail.com wrote: this is not a real query on the site - it is just a way i am measuring performance on mysql - I do

4 minute slow on select count(*) from table - myisam type

2011-10-02 Thread Joey L
I have having issues with mysql db - I am doing a select count(*) from table -- and it take 3 to 4 min. My table has about 9,000,000 records in it. I have noticed issues on my web pages so that is why i did this test. I have about 4 gig of memory on the server. Is there anything I can do to fix

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-02 Thread Andrew Moore
Is your table MyISAM or InnoDB? A On Sun, Oct 2, 2011 at 2:44 PM, Joey L mjh2...@gmail.com wrote: I have having issues with mysql db - I am doing a select count(*) from table -- and it take 3 to 4 min. My table has about 9,000,000 records in it. I have noticed issues on my web pages so

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-02 Thread Joey L
? A On Sun, Oct 2, 2011 at 2:44 PM, Joey L mjh2...@gmail.com wrote: I have having issues with mysql db - I am doing a select count(*) from table -- and it take 3 to 4 min. My table has about 9,000,000 records in it. I have noticed issues on my web pages so that is why i did this test. I have about 4

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-02 Thread Bruce Ferrell
I'd suggest mysqltuner. You can get it by using: wget http://mysqltuner.pl See what suggestions that makes On 10/02/2011 06:44 AM, Joey L wrote: I have having issues with mysql db - I am doing a select count(*) from table -- and it take 3 to 4 min. My table has about 9,000,000 records

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-02 Thread Andrew Moore
L mjh2...@gmail.com wrote: I have having issues with mysql db - I am doing a select count(*) from table -- and it take 3 to 4 min. My table has about 9,000,000 records in it. I have noticed issues on my web pages so that is why i did this test. I have about 4 gig of memory on the server

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-02 Thread Joey L
The section called: Variables to adjust: --when it says -- does this mean I have to set it higher in my.cnf file ?? and if I have a -- does this mean I have to set it lower ?? thanks...here is the info below you both asked for : mysql select count(*) from w6h8a_sh404sef_urls

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-02 Thread Joey L
this mean I have to set it lower ?? thanks...here is the info below you both asked for : mysql select count(*) from w6h8a_sh404sef_urls ; +--+ | count(*) | +--+ | 8908193 | +--+ 1 row in set (2 min 5.53 sec) | w6h8a_session | MyISAM | 10

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-02 Thread Bruce Ferrell
The meaning is: increase max_connections reduce wait_timeout -- 28800 is wait 8 hours before closing out dead connections same for interactive_timeout increase key_buffer_size ( 7.8G) increase join_buffer_size -- This keeps mysql from having to run to disk constantly for keys -- Key buffer

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-19 Thread Dotan Cohen
On Mon, Sep 19, 2011 at 04:00, Hank hes...@gmail.com wrote: I agree with Brandon's suggestions, I would just add when using numeric types in PHP statements where you have a variable replacement, for instance: $sql=INSERT into table VALUES ('$id','$val'); where $id is a numeric variable in

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-19 Thread Dotan Cohen
On Mon, Sep 19, 2011 at 07:47, Reindl Harald h.rei...@thelounge.net wrote: what ugly style - if it is not numeric and you throw it to the database you are one of the many with a sql-injection because if you are get ivalid values until there you have done no sanitize before and do not here

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-19 Thread Hank
what ugly style - if it is not numeric and you throw it to the database you are one of the many with a sql-injection because if you are get ivalid values until there you have done no sanitize before and do not here It's a matter of opinion. I never said the data wasn't sanitized (it is).

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-19 Thread Reindl Harald
Am 19.09.2011 16:55, schrieb Hank: what ugly style - if it is not numeric and you throw it to the database you are one of the many with a sql-injection because if you are get ivalid values until there you have done no sanitize before and do not here It's a matter of opinion. I never said

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-19 Thread Dotan Cohen
On Mon, Sep 19, 2011 at 18:11, Reindl Harald h.rei...@thelounge.net wrote: it is not because it is clear that it is sanitized instead hope and pray thousands of layers somewhere else did it - for a inline-query the best solution, if you are using a framework you will never have the insert into

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-19 Thread Hank
Best of both worlds: $username=$_POST['username']; // do some stuff with username here $M=array(); // Array of things to be inserted into MySQL $M[username]=mysql_real_escape_string($username); // Everything that goes into $M is escaped $query=INSERT INTO table (username) VALUES

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-19 Thread Dotan Cohen
On Tue, Sep 20, 2011 at 01:11, Hank hes...@gmail.com wrote: Best of both worlds: $username=$_POST['username']; // do some stuff with username here $M=array();  // Array of things to be inserted into MySQL $M[username]=mysql_real_escape_string($username); // Everything that goes into $M is

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-19 Thread Reindl Harald
Am 20.09.2011 00:39, schrieb Dotan Cohen: On Tue, Sep 20, 2011 at 01:11, Hank hes...@gmail.com wrote: Best of both worlds: $username=$_POST['username']; // do some stuff with username here $M=array(); // Array of things to be inserted into MySQL

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-19 Thread Hank
I want to be sure that all variables in the query are escaped. I don't trust myself or anyone else to do this to every variable right before the query: $someVar=mysql_real_escape_string($someVar); But you're doing exactly that right before the query anyway with:

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-19 Thread Dotan Cohen
On Tue, Sep 20, 2011 at 02:09, Hank hes...@gmail.com wrote: I want to be sure that all variables in the query are escaped. I don't trust myself or anyone else to do this to every variable right before the query: $someVar=mysql_real_escape_string($someVar); But you're doing exactly that

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-19 Thread Dotan Cohen
On Tue, Sep 20, 2011 at 01:48, Reindl Harald h.rei...@thelounge.net wrote: i would use a samll class holding the db-connection with insert/update-methods pass the whole record-array, lokk what field types are used in the table and use intval(), doubleval() or mysql_real_escape-String so you

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-19 Thread Dotan Cohen
On Tue, Sep 20, 2011 at 01:48, Reindl Harald h.rei...@thelounge.net wrote: i would use a samll class holding the db-connection with insert/update-methods pass the whole record-array, lokk what field types are used in the table and use intval(), doubleval() or mysql_real_escape-String By the

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-19 Thread Reindl Harald
Am 20.09.2011 01:23, schrieb Dotan Cohen: On Tue, Sep 20, 2011 at 01:48, Reindl Harald h.rei...@thelounge.net wrote: i would use a samll class holding the db-connection with insert/update-methods pass the whole record-array, lokk what field types are used in the table and use intval(),

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-18 Thread Brandon Phelps
Personally I don't use any quotes for the numeric types, and single quotes for everything else. Ie: UPDATE mytable SET int_field = 5 WHERE id = 3; SELECT id FROM mytable WHERE int_field = 5; UPDATE mytable SET varchar_field = 'Test' WHERE id = 3; SELECT id FROM mytable WHERE varchar_field

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-18 Thread Dotan Cohen
On Sun, Sep 18, 2011 at 17:44, Brandon Phelps bphe...@gls.com wrote: Personally I don't use any quotes for the numeric types, and single quotes for everything else.  Ie: Thanks, Brandon. I understand then that quote type is a matter of taste. I always use double quotes in PHP and I've only

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-18 Thread Hank
On Sun, Sep 18, 2011 at 12:28 PM, Dotan Cohen dotanco...@gmail.com wrote: On Sun, Sep 18, 2011 at 17:44, Brandon Phelps bphe...@gls.com wrote: Personally I don't use any quotes for the numeric types, and single quotes for everything else. Ie: Thanks, Brandon. I understand then that

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-18 Thread Reindl Harald
Am 19.09.2011 03:00, schrieb Hank: I agree with Brandon's suggestions, I would just add when using numeric types in PHP statements where you have a variable replacement, for instance: $sql=INSERT into table VALUES ('$id','$val'); where $id is a numeric variable in PHP and a numeric field

Re: select ... into local outfile ... ???

2011-09-03 Thread Dennis
Thanks, Tyler,  That's very helpful. Dennis --- On Sat, 9/3/11, Tyler Poland tpol...@engineyard.com wrote: From: Tyler Poland tpol...@engineyard.com Subject: Re: select ... into local outfile ... ??? To: mysql@lists.mysql.com Date: Saturday, September 3, 2011, 3:45 AM Dennis, The following

Re: select ... into local outfile ... ???

2011-09-03 Thread Hal�sz S�ndor
2011/09/03 03:40 +0800, Dennis But it seems that there is no select ... into LOCAL file statement. Any suggestion is appreciated. Indeed: you can use only standard output. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http

select ... into local outfile ... ???

2011-09-02 Thread Dennis
hi, there, the following is my sql statement: SELECT   HIGH_PRIORITY   SQL_BIG_RESULT   SQL_NO_CACHE   tb.url_sign,  m_url,    m_title,   m_weight    INTO OUTFILE   '/tmp/a.csv'  FIELDS TERMINATED BY ','  ENCLOSED BY '\'   LINES  TERMINATED BY '\n' STARTING BY '=' FROM d_local.ta, d_news.tbWHERE

Re: select ... into local outfile ... ???

2011-09-02 Thread Tyler Poland
/\\t/\t/g' ' output.txt Tyler * *On 9/2/11 3:40 PM, Dennis wrote: hi, there, the following is my sql statement: SELECT HIGH_PRIORITY SQL_BIG_RESULT SQL_NO_CACHE tb.url_sign, m_url,m_title, m_weightINTO OUTFILE '/tmp/a.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '\' LINES

Re: How select all records exact x days ago ?

2011-08-01 Thread Shawn Green (MySQL)
On 7/31/2011 13:18, yavuz maslak wrote: I don't want all records during 5 days ( 24*5days ) . Only I need records at 5 days ago ( for instance 24 hours on 26 th July 2011) ? How can I do that ? Show us your table definition (the CREATE TABLE ... form, please), tell us which column you

Re: How select all records exact x days ago ?

2011-08-01 Thread Johan De Meersman
- Original Message - From: yavuz maslak mas...@ihlas.net.tr I don't want all records during 5 days ( 24*5days ) . Only I need records at 5 days ago ( for instance 24 hours on 26 th July 2011) ? Which is what I gave you. You may want to read the fine documentation online before

How select all records exact x days ago ?

2011-07-31 Thread yavuz maslak
Hi How can I get all records exact 5 days ago from a table, neither 6 days nor 4 days ? Could you give me an example ? Thanks -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org

Re: How select all records exact x days ago ?

2011-07-31 Thread Johan De Meersman
, 2011 11:46:14 AM Subject: How select all records exact x days ago ? Hi How can I get all records exact 5 days ago from a table, neither 6 days nor 4 days ? Could you give me an example ? Thanks -- Bier met grenadyn Is als mosterd by den wyn Sy die't drinkt, is eene kwezel Hy

RE: How select all records exact x days ago ?

2011-07-31 Thread yavuz maslak
I don't want all records during 5 days ( 24*5days ) . Only I need records at 5 days ago ( for instance 24 hours on 26 th July 2011) ? How can I do that ? Depends on how your table is set up (you're going to need a date in the data...) but probably something along the lines of where

Re: How select all records exact x days ago ?

2011-07-31 Thread shawn wilson
mysql select day(now())-5; +--+ | day(now())-5 | +--+ | 26 | +--+ 2011/7/31 yavuz maslak mas...@ihlas.net.tr: I don't want all records during 5 days ( 24*5days ) . Only I need  records at 5 days ago ( for instance 24 hours on 26 th July 2011

Re: SELECT records less than 15 minutes old

2011-06-21 Thread walter harms
is the offset to UTC (what is used internaly of cause). see also: http://www.mysqlfaqs.net/mysql-faqs/General-Questions/How-to-manage-Time-Zone-in-MySQL btw: please notice the difference between: mysql select @@session.time_zone ; +-+ | @@session.time_zone

RE: SELECT records less than 15 minutes old

2011-06-21 Thread Jerry Schwartz
snip -Original Message- From: sono...@fannullone.us [mailto:sono...@fannullone.us] Sent: Monday, June 20, 2011 6:01 PM To: mysql@lists.mysql.com Cc: wha...@bfs.de; Jerry Schwartz Subject: Re: SELECT records less than 15 minutes old On Jun 20, 2011, at 10:11 AM, Jerry Schwartz wrote

Re: SELECT records less than 15 minutes old

2011-06-20 Thread walter harms
Am 19.06.2011 21:06, schrieb sono...@fannullone.us: On Jun 19, 2011, at 11:11 AM, Claudio Nanni wrote: just a quick debug: Thanks, Claudio. It turned out to be that NOW() was using the server's time and my timestamp was based on my timezone. After fixing that, the SELECT

RE: SELECT records less than 15 minutes old

2011-06-20 Thread Jerry Schwartz
-Original Message- From: walter harms [mailto:wha...@bfs.de] Sent: Monday, June 20, 2011 7:07 AM To: sono...@fannullone.us Cc: mysql@lists.mysql.com Subject: Re: SELECT records less than 15 minutes old Am 19.06.2011 21:06, schrieb sono...@fannullone.us: On Jun 19, 2011, at 11:11 AM

Re: SELECT records less than 15 minutes old

2011-06-20 Thread sono-io
() to use UTC instead of the server timezone? (The server is not mine, so I can't change the my.cnf.) Here's my statement: SELECT * FROM `log` WHERE `id` = $_id AND ( `time_stamp` = DATE_SUB(NOW(), INTERVAL 30 MINUTE) ) Earlier in my PHP script I've used date_default_timezone_set

SELECT records less than 15 minutes old

2011-06-19 Thread sono-io
Hi, I'm trying to write a statement that will return all records that match a particular order_id and that have a timestamp within the last 15 minutes. I thought that this should work: SELECT * FROM `records` WHERE `order_id` = $order_id AND (`time_stamp` = DATE_SUB(NOW(), INTERVAL

Re: SELECT records less than 15 minutes old

2011-06-19 Thread Claudio Nanni
just a quick debug: SELECT time_stamp,DATE_SUB(NOW(), INTERVAL 15 MINUTE) FROM `records` WHERE `order_id` = $order_id order by time_stamp desc limit 10; what do you get? 2011/6/19 sono...@fannullone.us Hi, I'm trying to write a statement that will return all records that match

Re: SELECT records less than 15 minutes old

2011-06-19 Thread sono-io
On Jun 19, 2011, at 11:11 AM, Claudio Nanni wrote: just a quick debug: Thanks, Claudio. It turned out to be that NOW() was using the server's time and my timestamp was based on my timezone. After fixing that, the SELECT statement works properly. Marc -- MySQL General Mailing List

Re: Fastest Select

2011-06-08 Thread Anupam Karmarkar
I am loading data using LOAD DATA as source is csv file. My selection is very simple with like select * from XYZ where key = 123; for 1 million sample record I created innodb table with key, to load data from csv it took nearly 1 and 1/2 hour on modest PC I created MyISAM table with key

Re: Fastest Select

2011-06-08 Thread Johan De Meersman
- Original Message - From: Anupam Karmarkar sb_akarmar...@yahoo.com select * from XYZ where key = 123; Now if i have to load data feed of 10 million once in week i need to consider loading time also Yes, On InnoDB you can't disable the primary key, as the data is index-organized

Fastest Select

2011-06-07 Thread Anupam Karmarkar
Hi All, We have very big table with few column contains nearly 10 million records, We need to tune this table for simple select statement where we check record exists in table or not and  requirement is response time should be less than 10 million second for nearly 1000 concurrent requests

Re: Fastest Select

2011-06-07 Thread Claudio Nanni
Hi Anupam, how do you load data? is it naturally ordered in any way? Claudio 2011/6/7 Anupam Karmarkar sb_akarmar...@yahoo.com Hi All, We have very big table with few column contains nearly 10 million records, We need to tune this table for simple select statement where we check record

Re: Fastest Select

2011-06-07 Thread Johan De Meersman
- Original Message - From: Claudio Nanni claudio.na...@gmail.com how do you load data? is it naturally ordered in any way? Also, what's the record structure, and what are the criteria you use to check if a record exists? If you only need to know wether a given record exists, your

Re: upgraded from 5.1-5.5. now getting a mysqldump ERROR 1142: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances' when using LOCK TABLES. a bug or my config?

2011-06-06 Thread Johan De Meersman
I haven't bothered to look for the bug, but it seems to me to be quite reasonable default behaviour to lock the whole lot when you're dumping transactional tables - it ensures you dump all tables from the same consistent view. I would rather take this up with the ZRM people - it should just

Re: upgraded from 5.1-5.5. now getting a mysqldump ERROR 1142: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances' when using LOCK TABLES. a bug or my config?

2011-06-06 Thread agd85
On Mon, 06 Jun 2011 12:44 +0200, Johan De Meersman vegiv...@tuxera.be wrote: I haven't bothered to look for the bug, but it seems to me to be quite reasonable default behaviour to lock the whole lot when you're dumping transactional tables - it ensures you dump all tables from the same

Re: upgraded from 5.1-5.5. now getting a mysqldump ERROR 1142: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances' when using LOCK TABLES. a bug or my config?

2011-06-06 Thread Johan De Meersman
that contains realtime information about the database, intended to replace a lot of show tables parsing and similar mayhem with simple select statements. I believe that's an Amanda 3.3 release you're referring to. ZRM is still at 2.2, No, I do mean 3.3. Apparently the free downloadable version

Re: upgraded from 5.1-5.5. now getting a mysqldump ERROR 1142: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances' when using LOCK TABLES. a bug or my config?

2011-06-06 Thread agd85
On Mon, 06 Jun 2011 18:54 +0200, Johan De Meersman vegiv...@tuxera.be wrote: Excluding 'performance_schema' appears to eliminate the error. And it seems does NOT cause a reliability-of-the-backup problem. Hah, no, backing that up is utterly pointless. that's a useful/final confirmation.

upgraded from 5.1-5.5. now getting a mysqldump ERROR 1142: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances' when using LOCK TABLES. a bug or my config?

2011-06-05 Thread agd85
-insert --create-options --default-character-set=utf8 --routines --host=localhost --port=3306 --socket=/var/cache/mysql/mysql.sock --databases drupal6 performance_schema /var/mysql-bkup/manual/20110605131003/backup.sql mysqldump: Got error: 1142: SELECT,LOCK

Re: upgraded from 5.1-5.5. now getting a mysqldump ERROR 1142: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances' when using LOCK TABLES. a bug or my config?

2011-06-05 Thread Reindl Harald
/cache/mysql/mysql.sock --databases drupal6 performance_schema /var/mysql-bkup/manual/20110605131003/backup.sql mysqldump: Got error: 1142: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances' when using LOCK TABLES

Re: upgraded from 5.1-5.5. now getting a mysqldump ERROR 1142: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances' when using LOCK TABLES. a bug or my config?

2011-06-05 Thread agd85
'@'localhost' IDENTIFIED BY PASSWORD '*D...D' | | GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON `drupal6`.* TO 'drupal_admin

Re: upgraded from 5.1-5.5. now getting a mysqldump ERROR 1142: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances' when using LOCK TABLES. a bug or my config?

2011-06-05 Thread Reindl Harald
the grant statements does nobody interest maybe use phpmyadmin for a clearer display mysql select * from mysql.user where user='root' limit 1

Re: upgraded from 5.1-5.5. now getting a mysqldump ERROR 1142: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances' when using LOCK TABLES. a bug or my config?

2011-06-05 Thread agd85
fwiw, others are seeing this. e.g., in addition to the two bugs i'd already referenced, http://www.directadmin.com/forum/showthread.php?p=202053 and one http://qa.lampcms.com/q122897/Can-t-backup-mysql-table-with-mysqldump-SELECT-LOCK-TABL-command claims a solution Add --skip-add-locks

Re: upgraded from 5.1-5.5. now getting a mysqldump ERROR 1142: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances' when using LOCK TABLES. a bug or my config?

2011-06-05 Thread Reindl Harald
referenced, http://www.directadmin.com/forum/showthread.php?p=202053 and one http://qa.lampcms.com/q122897/Can-t-backup-mysql-table-with-mysqldump-SELECT-LOCK-TABL-command claims a solution Add --skip-add-locks to your mysqldump command which, having added as i mentioned above

Re: upgraded from 5.1-5.5. now getting a mysqldump ERROR 1142: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances' when using LOCK TABLES. a bug or my config?

2011-06-05 Thread Reindl Harald
/showthread.php?p=202053 and one http://qa.lampcms.com/q122897/Can-t-backup-mysql-table-with-mysqldump-SELECT-LOCK-TABL-command claims a solution Add --skip-add-locks to your mysqldump command which, having added as i mentioned above, to the [mysqldump] section of /etc/my.cnf, does

Re: upgraded from 5.1-5.5. now getting a mysqldump ERROR 1142: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances' when using LOCK TABLES. a bug or my config?

2011-06-05 Thread agd85
On Sun, 05 Jun 2011 23:30 +0200, Reindl Harald h.rei...@thelounge.net wrote: BTW WHY is everybody ansering to the list AND the author of the last post? this reults in get every message twice :-( Reply - sends to ONLY the From == h.rei...@thelounge.net Reply to all sends to BOTH the From ==

Re: upgraded from 5.1-5.5. now getting a mysqldump ERROR 1142: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances' when using LOCK TABLES. a bug or my config?

2011-06-05 Thread agd85
On Sun, 05 Jun 2011 23:29 +0200, Reindl Harald h.rei...@thelounge.net wrote: i would use a replication slave and stop him for consistent backups because dumb locks are not really a good solution independent if this works normally unfortunately, i have no idea what that means. something's

Re: upgraded from 5.1-5.5. now getting a mysqldump ERROR 1142: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances' when using LOCK TABLES. a bug or my config?

2011-06-05 Thread Reindl Harald
Am 05.06.2011 23:49, schrieb ag...@airpost.net: On Sun, 05 Jun 2011 23:29 +0200, Reindl Harald h.rei...@thelounge.net wrote: i would use a replication slave and stop him for consistent backups because dumb locks are not really a good solution independent if this works normally

Re: upgraded from 5.1-5.5. now getting a mysqldump ERROR 1142: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances' when using LOCK TABLES. a bug or my config?

2011-06-05 Thread agd85
i still have no idea why this is necessary. there seems to be a but, problem, misconfiguration, etc. wouldn't it make some sense to try to FIX it, rather than setting up a completely different server? perhaps someone with an idea of the problem and its solution will be able to chime in. --

<    1   2   3   4   5   6   7   8   9   10   >