Re: Large table

2011-01-14 Thread Krishna Chandra Prajapati
partitioning will help u Krishna On Fri, Jan 14, 2011 at 4:18 AM, Sairam Krishnamurthy kmsram...@gmail.comwrote: All, I have a very large table. It has about 1 billion rows. Initially everything was fine. But now the table is a bit slow. Loaded takes a lot of time. I usually load in chunks

Rewrite SQL to stop table scan

2011-01-14 Thread Bruce Ferrell
How would you rewrite the following SQL so that is doesn't do a full table scan. It does in fact do a full scan in spite of the time clause. It's been making me nuts for months. select count(*) as count from alerts where (unix_timestamp(stamp) (unix_timestamp(now()) - '300' ) ) and devid =

Re: Rewrite SQL to stop table scan

2011-01-14 Thread Johan De Meersman
The problem is that you're using a function on your indexed field, which prevents the index from being used (I'm assuming you have an index on stamp). Store stamp directly as unixtime (use a time field) or if that's not an option, add a column that does - if you want you can autofill it with a

Incorrect key file for table

2011-01-14 Thread Jørn Dahl-Stamnes
Hello, While doing a select query I got the following error in the error-log file: Incorrect key feil for table '/tmp/#sql_5f8_0.MYI'; try to repair it It seem rather meaningless to try to repair a temporary table... So is this a bug in MySQL, or? The database I'm using has only InnoDb

Re: Rewrite SQL to stop table scan

2011-01-14 Thread Yogesh Kore
can you send DDL of the table? On Fri, Jan 14, 2011 at 4:22 PM, Bruce Ferrell bferr...@baywinds.orgwrote: How would you rewrite the following SQL so that is doesn't do a full table scan. It does in fact do a full scan in spite of the time clause. It's been making me nuts for months.

Re: Rewrite SQL to stop table scan

2011-01-14 Thread Yogesh Kore
Hey, Try making `id` as primary key. That will keep data in sorted manner and scan will look only the data required in-spite of full table scan. On Fri, Jan 14, 2011 at 4:22 PM, Bruce Ferrell bferr...@baywinds.orgwrote: How would you rewrite the following SQL so that is doesn't do a full

Re: Rewrite SQL to stop table scan

2011-01-14 Thread Peter Brawley
On 1/14/2011 4:52 AM, Bruce Ferrell wrote: How would you rewrite the following SQL so that is doesn't do a full table scan. It does in fact do a full scan in spite of the time clause. It's been making me nuts for months. select count(*) as count from alerts where (unix_timestamp(stamp)

Re: Incorrect key file for table

2011-01-14 Thread Johan De Meersman
Check your free diskspace on your temp location. On Fri, Jan 14, 2011 at 1:31 PM, Jørn Dahl-Stamnes sq...@dahl-stamnes.netwrote: Hello, While doing a select query I got the following error in the error-log file: Incorrect key feil for table '/tmp/#sql_5f8_0.MYI'; try to repair it It

Re: Rewrite SQL to stop table scan

2011-01-14 Thread Steve Meyers
On 1/14/11 3:52 AM, Bruce Ferrell wrote: select count(*) as count from alerts where (unix_timestamp(stamp) (unix_timestamp(now()) - '300' ) ) and devid = '244'; Bruce - The problem is that the index is useless, because you're running a function on the timestamp. What you want is this:

RE: Incorrect key file for table

2011-01-14 Thread Jerry Schwartz
-Original Message- From: Jørn Dahl-Stamnes [mailto:sq...@dahl-stamnes.net] Sent: Friday, January 14, 2011 7:31 AM To: mysql@lists.mysql.com Subject: Incorrect key file for table Hello, While doing a select query I got the following error in the error-log file: Incorrect key feil

RE: Rewrite SQL to stop table scan

2011-01-14 Thread Jerry Schwartz
-Original Message- From: Bruce Ferrell [mailto:bferr...@baywinds.org] Sent: Friday, January 14, 2011 5:53 AM To: mysql@lists.mysql.com Subject: Rewrite SQL to stop table scan How would you rewrite the following SQL so that is doesn't do a full table scan. It does in fact do a full scan

Hello-NEED ASSISITANCE URGENT!!!!

2011-01-14 Thread leece320
I wondered if you can get me started on selling MANY mailing list to potential clients who are in need of millions of e-mail names and addresses. This has collected for some time. I am needing to start a business doing this Here in the United States and out of country yet I am not sure how

Re: Large table

2011-01-14 Thread Sairam Krishnamurthy
Yogesh, The type is MyISAM. So i guess size is not a matter for now. I am well over the limit for MyISAM. I will partition the table and check. Thanks, Sairam Krishnamurthy +1 612 859 8161 On 01/14/2011 01:27 AM, Yogesh Kore wrote: What is the table type for Table? Firstly check with

Re: Incorrect key file for table

2011-01-14 Thread Jørn Dahl-Stamnes
On Friday 14 January 2011 14:03, Johan De Meersman wrote: Check your free diskspace on your temp location. About 900+ Mb free. But I don't think that a full filesystem was the problem (I don't think the mysqld server was able to fill the disk with 900 Mb in 1-2 seconds). After some debugging

Re: Incorrect key file for table

2011-01-14 Thread Johnny Withers
The result of your query without the join probably exceeded your tmp_table_size variable. When this occurs, MySQL quit writing the temp table to disk thus producing an incorrect table file. (I think). JW On Fri, Jan 14, 2011 at 3:48 PM, Jørn Dahl-Stamnes sq...@dahl-stamnes.netwrote: On Friday

Re: linking to mysql in C

2011-01-14 Thread Luciano Furtado
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 What's the output of mysql_config --libs for you? On 11-01-08 00:06, Delan Azabani wrote: Hi all, This is a novice problem I'm having with compiling a C CGI program with MySQL on my Gentoo box. I have a simple source so far: *

Re: Rewrite SQL to stop table scan

2011-01-14 Thread Bruce Ferrell
On 01/14/2011 08:19 AM, Steve Meyers wrote: On 1/14/11 3:52 AM, Bruce Ferrell wrote: select count(*) as count from alerts where (unix_timestamp(stamp) (unix_timestamp(now()) - '300' ) ) and devid = '244'; Bruce - The problem is that the index is useless, because you're running a

Install Error - How to Fix

2011-01-14 Thread AndrewMcHorney
Hello At one time I had (or at least partially) installed mysql on my laptop. I went to install a new version and I am getting the following error: A windows service with the name MySql already exists. Please uninstall this service correctly or choose a different name for the new service.

Re: Incorrect key file for table

2011-01-14 Thread Jørn Dahl-Stamnes
On Saturday 15 January 2011 00:28, Johnny Withers wrote: The result of your query without the join probably exceeded your tmp_table_size variable. When this occurs, MySQL quit writing the temp table to disk thus producing an incorrect table file. (I think). Yes, part of this was my fault (the