Re: Two MySql servers, but very different performances for a SELECT JOIN

2008-04-14 Thread Sebastian Mendel
Tristan Marly schrieb: First, thanks for all your suggestions and for beeing so reactive. @Martin: the explain result was in attachment, but you will have more results in this current mail. @Rob: you are right, the 'show index' shows strange things, cf. below. @Rodolphe: indeed the

why doesn't mysql select the correnct index?

2008-04-14 Thread Changying Li
Hi. there is a table photo and two queries: mysql show index from photo; mysql show index from photo;

Re: why doesn't mysql select the correnct index?

2008-04-14 Thread Sebastian Mendel
Changying Li schrieb: Hi. there is a table photo and two queries: mysql show index from photo; mysql show index from photo;

Re: why doesn't mysql select the correnct index?

2008-04-14 Thread Changying Li
Sebastian Mendel [EMAIL PROTECTED] writes: Changying Li schrieb: Hi. there is a table photo and two queries: mysql show index from photo; mysql show index from

Re: why doesn't mysql select the correnct index?

2008-04-14 Thread Sebastian Mendel
Changying Li schrieb: Sebastian Mendel [EMAIL PROTECTED] writes: Changying Li schrieb: Hi. there is a table photo and two queries: mysql show index from photo; mysql

Importing - Adding Fields Into MySql From A List

2008-04-14 Thread revDAVE
Newbie question! I have a list of field names from another database (not mysql) - like: name phone1 phone2 street city state zip info etc (a bunch more fields) Q: Is there a way I can add these to an existing empty/blank table? Maybe I can use: - phpMyAdmin ? - sql commands with php -

LEFT JOIN problem

2008-04-14 Thread Jerry Schwartz
I have a table, eo_name_table, that has exactly 860 unique titles in it. Each record also has a date field, eo_pub_date: +-+--+--+-+-+---+ | Field | Type | Null | Key | Default | Extra |

Problem attempting to use load data into

2008-04-14 Thread Jason Pruim
Hi Everyone, I am attempting to use this command: load data infile '/volumes/raider/ elks.test.txt' into table elksCurrent fields terminated by '\t' lines terminated by '\n'; My table is created as such: | elksCurrent | CREATE TABLE `elksCurrent` ( `FName` varchar(40) default NULL,

Re: Problem attempting to use load data into

2008-04-14 Thread Rob Wultsch
On Mon, Apr 14, 2008 at 10:29 AM, Jason Pruim [EMAIL PROTECTED] wrote: Hi Everyone, I am attempting to use this command: load data infile '/volumes/raider/elks.test.txt' into table elksCurrent fields terminated by '\t' lines terminated by '\n'; My table is created as such: |

Re: Problem attempting to use load data into

2008-04-14 Thread Rob Wultsch
On Mon, Apr 14, 2008 at 10:47 AM, Rob Wultsch [EMAIL PROTECTED] wrote: It is probably trying to insert a string of no length into the not null field. Try it with: SET SQL_MODE = ''; Above should read into an int field, while the server is in strict mode. -- Rob Wultsch [EMAIL PROTECTED]

Re: LEFT JOIN problem

2008-04-14 Thread Bill Newton
Hi Jerry, I think the problem is that NULL is not less than or greater than your prod_published date. So you probably have eo_pub_date set to NULL in 56 of your rows. so for eo_name_table.eo_pub_date prod.prod_published or eo_name_table.eo_pub_date = prod.prod_published mysql will

RE: LEFT JOIN problem

2008-04-14 Thread Jerry Schwartz
From: Bill Newton [mailto:[EMAIL PROTECTED] Sent: Monday, April 14, 2008 2:09 PM To: Jerry Schwartz Cc: 'Mysql' Subject: Re: LEFT JOIN problem Hi Jerry, I think the problem is that NULL is not less than or greater than your prod_published date. So you probably have eo_pub_date set to NULL in 56

RE: LEFT JOIN problem

2008-04-14 Thread Jerry Schwartz
I've found yet another oddity with this situation. If I leave the date test off of both JOINs they give the same number of rows, but they give me the wrong number! Neither one of them gives me 860 rows returned. I must not understand how a LEFT JOIN works. By the way, the EXPLAIN for both of my

Re: Problem attempting to use load data into

2008-04-14 Thread Jason Pruim
On Apr 14, 2008, at 2:01 PM, Rob Wultsch wrote: On Mon, Apr 14, 2008 at 10:47 AM, Rob Wultsch [EMAIL PROTECTED] wrote: It is probably trying to insert a string of no length into the not null field. Try it with: SET SQL_MODE = ''; Above should read into an int field, while the server is in

Re: Problem attempting to use load data into

2008-04-14 Thread Jason Pruim
Hi again everyone, After taking the advice of someone offlist I tried the IGNORE 1 LINES and that didn't help... Same result. I've tried a tab delimited file, and a comma separated file. Same result with both. Any other ideas? :) On Apr 14, 2008, at 1:29 PM, Jason Pruim wrote: Hi

Re: Problem attempting to use load data into

2008-04-14 Thread Daniel Brown
On Mon, Apr 14, 2008 at 1:29 PM, Jason Pruim [EMAIL PROTECTED] wrote: Hi Everyone, I am attempting to use this command: load data infile '/volumes/raider/elks.test.txt' into table elksCurrent fields terminated by '\t' lines terminated by '\n'; [snip!] The error that I'm getting is: |

Re: Problem attempting to use load data into

2008-04-14 Thread Daniel Brown
On Mon, Apr 14, 2008 at 3:33 PM, Jason Pruim [EMAIL PROTECTED] wrote: On Apr 14, 2008, at 3:29 PM, Daniel Brown wrote: That's because it's attempting to insert the name of the columns from your CSV into MySQL --- and 'Record' is not a valid INT. Replaced field name with 0 and had

RE: LEFT JOIN problem

2008-04-14 Thread Jerry Schwartz
As usual, the computer is right and I am wrong. The only reason that one query was coming out right is that it just happened the WHERE clause was never failing. It was just luck that my data was just so. Regards, Jerry Schwartz The Infoshop by Global Information Incorporated 195 Farmington Ave.

Re: Problem attempting to use load data into

2008-04-14 Thread Jason Pruim
On Apr 14, 2008, at 3:29 PM, Daniel Brown wrote: On Mon, Apr 14, 2008 at 1:29 PM, Jason Pruim [EMAIL PROTECTED] wrote: Hi Everyone, I am attempting to use this command: load data infile '/volumes/raider/elks.test.txt' into table elksCurrent fields terminated by '\t' lines terminated by

RE: Importing - Adding Fields Into MySql From A List

2008-04-14 Thread Garris, Nicole
It sounds like you want to easily create a new MySQL table that is a copy of a table in a different DBMS. The way I would do it is generate a DDL script from the other DBMS (create table etc.) For example, SQL Server has a generate script wizard that does it for you automatically. Then take the

Re: Problem attempting to use load data into

2008-04-14 Thread Daniel Brown
On Mon, Apr 14, 2008 at 3:45 PM, Daniel Brown [EMAIL PROTECTED] wrote: Does your file actually have the characters \t \t \n at the end of each row like that? Send it to me as an attachment off-list and I'll help you figure it out and then post back here for the MySQL archives.

Re: Problem attempting to use load data into

2008-04-14 Thread Jason Pruim
On Apr 14, 2008, at 4:37 PM, Daniel Brown wrote: On Mon, Apr 14, 2008 at 3:45 PM, Daniel Brown [EMAIL PROTECTED] wrote: Does your file actually have the characters \t \t \n at the end of each row like that? Send it to me as an attachment off-list and I'll help you figure it out and

Using Date Functions in Where Clause

2008-04-14 Thread Jamie Madill
Hello, Basically I want to know if this is a good query for indexing. I have the following query: select count(1) as count from session where last = DATE_SUB(NOW(), INTERVAL :from SECOND) Is it safe to assume that the expression calling the function DATE_SUB is evaluated just once to a

Strange performance problem

2008-04-14 Thread Doug Phillips
OK folks, I'm kind of stumped; looking into things a bit more, but thought I'd hit the list and see if anyone had any suggestions for a rock to look under, in case I'm missing it... DB Server: Windows 2003, 8-way CPU, lots of RAM, MySQL 4.1.22-nt binary from MySQL Current Production web server:

Incorrect results from sum

2008-04-14 Thread Jonathan Mangin
Sorry to return to this topic, I haven't found a lot to explain what's happening. I'm trying to total certain nutrients consumed on a given date (though I've removed date temporarily). You'll see I have three items (in two meals) in itemized, and two meal totals in simple. mysql select id,

Re: why doesn't mysql select the correnct index?

2008-04-14 Thread Changying Li
why does mysql use group_id index ? because in this case group_id would be faster than user_id but in fact group_id is very slow (51.21 sec), user_id is (0.00 sec) ok, at least MySQL does think so I know, but I what I really want to know is how does mysql think so ? how to let mysql choose

Re: Incorrect results from sum

2008-04-14 Thread Perrin Harkins
On Mon, Apr 14, 2008 at 5:40 PM, Jonathan Mangin [EMAIL PROTECTED] wrote: select round(sum(my_menu.carb * units) + sum(simple.carb),2) from itemized inner join simple using (uid) left join my_menu on itemized.personal_id = my_menu.id; Instead of 218.3 this returns 602, which is (52.9

ibbackup apply log getting slower and slower

2008-04-14 Thread huang jayven
Hi all: I'm a first time poster here...and forgive my broken English... These days i am doing some database restore test using ibbackup. The db's original size is about 350GB ( we know that is already too big ), compressed size is about 130GB. Then i ran ibbackup

Create table

2008-04-14 Thread Krishna Chandra Prajapati
Hi, I have created a table name group. CREATE TABLE `group` ( `group_id` int(11) NOT NULL, `group_name` varchar(128) NOT NULL, `date_created` datetime NOT NULL, `created_by` int(11) NOT NULL, `modified_by` int(11) default NULL, `status` char(1) NOT NULL default 'Y', PRIMARY KEY

Re: Create table

2008-04-14 Thread Ananda Kumar
Do a show tables and see what is the actual table name. I think group is a key work and hence its giving you the error. See the table names in that database. regards anandkl On 4/15/08, Krishna Chandra Prajapati [EMAIL PROTECTED] wrote: Hi, I have created a table name group. CREATE TABLE

Re: Create table

2008-04-14 Thread Carlos Proal
Hi. group is a reserved word i think you must enclose the table name with single quotes (as when you created the table) in order to avoid the confusion. Carlos Krishna Chandra Prajapati wrote: Hi, I have created a table name group. CREATE TABLE `group` ( `group_id` int(11) NOT NULL,