RE: Considering migration from MyISAM to InnoDB

2005-06-15 Thread Stembridge, Michael
Thank you.  I know how to migrate tables using ALTER TABLE - my question has
more to do with *whether* I should migrate.  For smaller databases (10mb in
size) is it really beneficial?  Details in my original post quoted below. 

Thanks again, 
Michael 

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, June 14, 2005 7:00 PM
 To: Stembridge, Michael
 Cc: mysql@lists.mysql.com
 Subject: Re: Considering migration from MyISAM to InnoDB
 
 see the my.cnf examples in the install dir, and look at innodb* variables.
 you can migrate each table just using :
 
 alter table toto engine=innodb;
 
 Mathias
 
 
 Selon Stembridge, Michael [EMAIL PROTECTED]:
 
  I currently use MyISAM on an internal web application server; our data
 takes
  up 10mb at this time, though this is likely to grow substantially in the
  coming year.  The database sees moderate heavy read and moderate write
 usage
  from 50 users.
 
  We're upgrading our sever from Red Hat 7.3 to SuSE Linux Enterprise 9.0
 soon
  and have considered migrating to InnoDB as part of our upgrade.I
 like
  the performance increases I've seen documented here
  http://www.innodb.com/bench.php, though I'm not sure our environment
 calls
  for InnoDB.   Thoughts?


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Considering migration from MyISAM to InnoDB

2005-06-14 Thread Stembridge, Michael
I currently use MyISAM on an internal web application server; our data takes
up 10mb at this time, though this is likely to grow substantially in the
coming year.  The database sees moderate heavy read and moderate write usage
from 50 users.  

 

We're upgrading our sever from Red Hat 7.3 to SuSE Linux Enterprise 9.0 soon
and have considered migrating to InnoDB as part of our upgrade.I like
the performance increases I've seen documented here
http://www.innodb.com/bench.php, though I'm not sure our environment calls
for InnoDB.   Thoughts?

 



SET question - @ or @@?

2005-03-25 Thread Stembridge, Michael
While I was RTFM to find out how long SET variables last, I noticed that my
book uses @@VarName but the sample code I'm using has @ VarName.  I didn't
see a reference to the single @ in the SET section of my book.   

 

So, what is the difference between @@ and @?

 

Thank you.



SELECT rows from the previous business day

2005-03-22 Thread Stembridge, Michael
A table exists with id and datetime columns; I need to SELECT records from
the previous business day. I began with this: 

 

SELECT id FROM table WHERE TO_DAYS(NOW()) - TO_DAYS(datetime) =1 

 

But if NOW() is a Monday, it pulls records from Sunday (there are none since
records are inserted M-F only).I thought of using something like this in
my WHERE clause: 

 

AND DAYOFWEEK(datetime) != 6

 

Though this doesn't seem like an operable solution (If I'm not mistaken this
would return 0 rows if no records were inserted on a Sunday).  

 

Does MySQL include a specifier for business day?   

 

Thank you, 

Michael 



SELECT assistance

2005-03-15 Thread Stembridge, Michael
I have a table containing three columns:

 Int   intint 
++-++
| id | serialbegin | serialend  |
++-++
|  1 | 10  | 20 |
++-++


And say we have serial number 11. 

Is there a way to SELECT any rows where $my_serial is greater than/equal to
serialbegin and less than/equal to serialend?  

I tried this query: 

SELECT id FROM numbers WHERE serialbegin = '11' AND serialend = '11';

Empty set (0.00 sec)


Is this a little more complicated than I'm making it out to be (or am I
missing something obvious)?  

Thanks, 
Michael

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Optimising COUNT()

2005-03-14 Thread Stembridge, Michael
I noticed another listmember used COUNT(fieldname) instead of COUNT(*).  

Is there a noticeable performance increase with COUNTing a column name
instead of all columns?   (ie, like SELECTing specific columns instead of
using SELECT *)

Thanks!

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: select date_format('2004-10-03 15:06:14','%m/%d/%y %T');

2005-03-09 Thread Stembridge, Michael
RE: Import Access Data...

 I'll try and import using ODBC.  Is there any good web sites
 about ODBC and its operations that I can learn about it?
 
 Scott

If you haven't found this by now: 

http://forums.mysql.com/list.php?65 - MySQL forum for Access conversion.
Many people use ODBC to migrate from Access to MySQL, as such there is much
information to be found here.  


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Illegal mix of collations - new twist on a familiar problem...

2005-03-04 Thread Stembridge, Michael
When running this simple query:   
SELECT fileid FROM test WHERE ecn='0'


MySQL yields this error:
#1267 - Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and
(utf8_general_ci,COERCIBLE) for operation '='


The table collation is latin1_swedish_ci.  

I ran SHOW CREATE TABLE fileid and found this:  DEFAULT CHARSET=latin1 at
the end. 

Here is the table layout: 

fileid  int(10)
datereceiveddate
scn varchar(11) latin1_swedish_ci
ecn varchar(11) latin1_swedish_ci


Here is the problem:  The table collation was once utf8_general_ci (due to
mistake), it was switched back to latin1_swedish_ci.   Ever since then I've
had this error.  

Suggestions for getting the table back in line?  

Thanks, 
Michael

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



mysqldump vs. 'mysql [db] file.sql'

2005-03-04 Thread Stembridge, Michael
mysqldump vs. 'mysql [db]  file.sql'

I stumbled across the latter method early on but notice that most folks
suggest using mysqldump instead; are there performance benefits with using
mysqldump, or some other reason?   

The same question could be applied to using mysqlimport vs. 'mysql [db] 
tablename.sql'.  

Thoughts? 

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Upgrading bundled ver of mysql included with php 4.3.1

2004-11-29 Thread Stembridge, Michael
What steps are needed to upgrade (or remove) the builtin mysql [3.23.49]
included with php 4.3.1 source?  

I have mysql 4.x installed and working by itself, but php continues to use
3.23.49.

I have tried recompiling php 4.3.1 without --with-mysql on the configure
line.  Doing so did not remove the builtin 3.23.49 package. 

Any tips? 

Thanks, 
Michael

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



PHP reports 3.23.49, command line reports 4.0.1

2004-09-23 Thread Stembridge, Michael
I installed PHP 4.3.1 via source and used the following option when
configuring:

./configure --with-mysql 

The database has worked great for a couple of years, however I noticed a
problem today.  

Phpinfo() returns MySQL Version 3.23 from a php script.  

Client API version  3.23.49  
MYSQL_MODULE_TYPE   builtin  
MYSQL_SOCKET/var/lib/mysql/mysql.sock  
MYSQL_INCLUDE   no value  
MYSQL_LIBS  no value  

However, issuing 'mysql -V' at the command line returns version 4.0.1.  


So I assume the version of MySQL bundled with PHP 4.3.1 is in fact 3.23.49
and this is overriding my standalone installation. 

Without recompiling, is there a way to upgrade the bundled client?

Thanks!

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: PHP reports 3.23.49, command line reports 4.0.1

2004-09-23 Thread Stembridge, Michael
 I installed PHP 4.3.1 via source and used the following option when
 configuring:
 
 ./configure --with-mysql
 
 The database has worked great for a couple of years, however I noticed a
 problem today.
 
 Phpinfo() returns MySQL Version 3.23 from a php script.
 
   Client API version  3.23.49
   MYSQL_MODULE_TYPE   builtin
   MYSQL_SOCKET/var/lib/mysql/mysql.sock
   MYSQL_INCLUDE   no value
   MYSQL_LIBS  no value
 
 However, issuing 'mysql -V' at the command line returns version 4.0.1.
 
 
 So I assume the version of MySQL bundled with PHP 4.3.1 is in fact 3.23.49
 and this is overriding my standalone installation.
 
 Without recompiling, is there a way to upgrade the bundled client?



I need to restate my question to the list.


First of all, is there a config file that tells PHP where to look for MySQL
client files?  

If not, and I need to recompile PHP, how should I phrase my configuration
option to use the standalone MySQL installation (now upgraded to 4.1.5 GA)?

% ./configure --with-mysql=/what/directory/do/I/path/to?/
--with-apache=../apache-1.3.29 --with-informix=/opt/Informix

'mysql' is located in /usr/bin - is that the obvious answer?  

Thanks much.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: PHP reports 3.23.49, command line reports 4.0.1

2004-09-23 Thread Stembridge, Michael
  So I assume the version of MySQL bundled with PHP 4.3.1 is in fact
 3.23.49
  and this is overriding my standalone installation.
 
 It's not overriding anything, it's doing what you asked: in your configure
 you told PHP to use its built-in (MYSQL_MODULE_TYPE) MySQL support.
 
  Without recompiling, is there a way to upgrade the bundled client?
 
 No - I believe you need to recompile PHP (this path assumes an RPM
 installation of MySQL):

Yes, MySQL is installed via RPM.  

So, when I recompile PHP I should leave -off- the '--with-mysql'
configuration option altogether?

If yes, how does PHP know MySQL exists on the system, or is this handled
automatically behind the scenes? 



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



SELECT a percentage range of a given value

2004-09-22 Thread Stembridge, Michael
Hello, 

 

I have a music database containing song BPM (Beats Per Minute) data values
stored as FLOAT.   I need to pull a range of BPM values based on a
user-supplied integer.   The range should pull all records which are 8%
higher and lower than the given integer.  

 

I tried this query for starters:

 

SELECT 

  * 

FROM 

  test

HAVING 

  (

bpm  SUM(100 * 1.08)

  ) OR (

bpm  SUM(100 * .92)

  )

 

 

No errors appeared however only one row returned (with bpm value 55.03).  

 

There are approximately 100 records that have a bpm value between 92.00 and
108.00 in the test database. 

 

 

Am I overlooking something obvious?

 

 



RE: SELECT a percentage range of a given value

2004-09-22 Thread Stembridge, Michael
Ah, this is not as complex as I imagined.  Thanks!


 -Original Message-
 From: gerald_clark [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, September 22, 2004 4:52 PM
 To: Stembridge, Michael
 Cc: [EMAIL PROTECTED]
 Subject: Re: SELECT a percentage range of a given value
 
 SELECT * FROM test
 WHERE bpm  ( 100 * 1.08 ) AND bpm  (100*.92)
 

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



MySQL Gamma 4.0 - safe for production?

2003-02-26 Thread Stembridge, Michael
I've been researching the possibilities of upgrading from MySQL 3.23 to 4.0
and have read opinions supporting why I should stay with what I have,
upgrade, or move to another DB altogether.   I thought it would be in my
best interests to ask this list the same question.

I'm not interested in migrating to a new database platform, however I am
still interested in possibly upgrading what I have.   My reasons for wanting
to upgrade are related to enhanced FULLTEXT searching features with the
Gamma version.   

Would 4.0 be reasonably safe for production?  


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



Sluggish performance on medium sized table.. EXPLAIN SELECT's included.

2002-06-03 Thread Stembridge, Michael

A database is being used to log support calls for a call center. There are
around 25,000 clients in the database. The existing call notes were imported
from flat text files. 

One table (call_notes) contains the call time, ticketid, noteid, ect..
Another table (call_notes_text) only contains noteid and note_text. 

When I query the call_notes table for a specific noteid, the info is
returned instantly. However when I query the call_notes_text table for a
specific noteid it takes 15-17 seconds to return the data.  The table has
around 15,000 rows with each row containing a field about the size of a
small newspaper article.   

The server is a dual processor intel333 with 256k ram (RH7.2) running MySQL
3.23.41.   When running the queries outline below CPU usage is only around
15% or so.   

Each table contains an id which is key.   I've copied and pasted results
from some EXPLAIN table queries below.



mysql explain call_notes;
+--++--+-+-+
+
| Field| Type   | Null | Key | Default | Extra
|
+--++--+-+-+
+
| noteid   | int(10)|  | PRI | NULL|
auto_increment |
| ticketid | int(10)|  | | 0   |
|
| userid   | int(5) |  | | 0   |
|
| contactid| int(5) |  | | 0   |
|
| call_start   | datetime   |  | | -00-00 00:00:00 |
|
| call_end | datetime   |  | | -00-00 00:00:00 |
|
| call_elapsed | time   |  | | 00:00:00|
|
| call_seconds | int(10)|  | | 0   |
|
| entered_statusid | tinyint(2) |  | | 0   |
|
| datemodified | datetime   |  | | -00-00 00:00:00 |
|
+--++--+-+-+
+
10 rows in set (0.00 sec)


mysql explain call_notes_text;
+---+-+--+-+-++
| Field | Type| Null | Key | Default | Extra  |
+---+-+--+-+-++
| noteid| int(10) |  | PRI | NULL| auto_increment |
| note_text | text|  | | ||
+---+-+--+-+-++
2 rows in set (0.00 sec)


mysql explain facility_contact;
+--+-+--+-+-+---
-+
| Field| Type| Null | Key | Default | Extra
|
+--+-+--+-+-+---
-+
| contactid| int(10) |  | PRI | NULL|
auto_increment |
| fnum | varchar(8)  |  | | |
|
| contact  | varchar(30) |  | | |
|
| contactadded | datetime|  | | -00-00 00:00:00 |
|
+--+-+--+-+-+---
-+
4 rows in set (0.00 sec)


mysql explain users;
+--+--+--+-+-+--
--+
| Field| Type | Null | Key | Default | Extra
|
+--+--+--+-+-+--
--+
| userid   | int(10)  |  | PRI | NULL|
auto_increment |
| username | varchar(50)  |  | | |
|
| password | varchar(50)  |  | | |
|
| deptid   | tinyint(4)   |  | | 0   |
|
| jobtitleid   | int(2)   |  | | 0   |
|
| namefirst| varchar(50)  |  | | |
|
| namelast | varchar(50)  |  | | |
|
| ext  | int(5)   |  | | 0   |
|
| email| varchar(100) |  | | |
|
| level| int(1)   |  | | 1   |
|
| senior   | char(3)  |  | | |
|
| dateadded| datetime |  | | -00-00 00:00:00 |
|
| datemodified | datetime |  | | -00-00 00:00:00 |
|
| active   | tinyint(1)   |  | | 1   |
|
+--+--+--+-+-+--
--+
14 rows in set (0.00 sec)





Here is the actual query that is being used in the script.  (I've broken
down so it's easier to read)


SELECT 
call_notes.call_elapsed, 
call_notes.call_seconds, 
call_notes.call_start, 
call_notes.call_end, 
call_notes_text.note_text, 
users.username, 
users.namefirst, 
users.email, 
facility_contact.contactid, 

Sluggish performance on medium sized table.. EXPLAIN SELECT's i ncluded.

2002-06-03 Thread Stembridge, Michael

A database is being used to log support calls for a call center. There are
around 25,000 clients in the database. The existing call notes were imported
from flat text files. 

One table (call_notes) contains the call time, ticketid, noteid, ect..
Another table (call_notes_text) only contains noteid and note_text. 

When I query the call_notes table for a specific noteid, the info is
returned instantly. However when I query the call_notes_text table for a
specific noteid it takes 15-17 seconds to return the data.  The table has
around 15,000 rows with each row containing a field about the size of a
small newspaper article.   

The server is a dual processor intel333 with 256k ram (RH7.2) running MySQL
3.23.41.

Each table contains an id which is key.   I've copied and pasted results
from some EXPLAIN table queries below.

Here is the actual query that is being used in the script.  (I've broken
down so it's easier to read)

SELECT 
call_notes.call_elapsed, 
call_notes.call_seconds, 
call_notes.call_start, 
call_notes.call_end, 
call_notes_text.note_text, 
users.username, 
users.namefirst, 
users.email, 
facility_contact.contactid, 
facility_contact.contact 
FROM 
call_notes, 
call_notes_text, 
users, 
facility_contact 
WHERE 
call_notes.ticketid = '1'  
call_notes.userid = users.userid  
call_notes.contactid = facility_contact.contactid  
call_notes_text.noteid = call_notes.noteid 
ORDER BY 
call_notes.call_start DESC;

(results snipped)

1 row in set (17.89 sec)


Now I go to command line and run this query:

mysql SELECT * FROM call_notes_text WHERE noteid='1';
(results snipped)
1 row in set (0.00 sec)



I ran an EXPLAIN SELECT on my main query.   (fyi, ticketid 1 has a noteid of
1)

EXPLAIN SELECT 
call_notes.call_elapsed, 
call_notes.call_seconds, 
call_notes.call_start, 
call_notes.call_end, 
call_notes_text.note_text, 
users.username, 
users.namefirst, 
users.email, 
facility_contact.contactid, 
facility_contact.contact 
FROM 
call_notes, 
call_notes_text, 
users, 
facility_contact 
WHERE 
call_notes.ticketid = '1'  
call_notes.userid = users.userid  
call_notes.contactid = facility_contact.contactid  
call_notes_text.noteid = call_notes.noteid 
ORDER BY 
call_notes.call_start DESC;


+--++-+-+-+-
---+---+-+
| table| type   | possible_keys   | key | key_len |
ref| rows  | Extra   |
+--++-+-+-+-
---+---+-+
| call_notes_text  | ALL| PRIMARY,noteid,noteid_2 | NULL|NULL |
NULL   | 14682 | Using temporary; Using filesort |
| call_notes   | eq_ref | PRIMARY,noteid,noteid_2 | PRIMARY |   4 |
call_notes_text.noteid | 1 | where used  |
| users| eq_ref | PRIMARY,userid  | PRIMARY |   4 |
call_notes.userid  | 1 | |
| facility_contact | eq_ref | PRIMARY,contactid   | PRIMARY |   4 |
call_notes.contactid   | 1 | |
+--++-+-+-+-
---+---+-+
4 rows in set (0.00 sec)


Note the number of rows returned from call_notes_text.   This matches the
total number of rows in that table.   

It appears to be a problem with the query, but I can't see where the problem
is.  Thanks for any help you can provide.  

- Mike

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




All records returne with JOIN

2002-06-03 Thread Stembridge, Michael

The following query takes a very long time to process.  It finally returns
only the row I'm wanting, but when I run an EXPLAIN SELECT on it, it looks
like all 14687 rows are being examined for the record -- instead of mysql
honing in on the desired row immediately.

SELECT 
call_notes.call_elapsed, 
call_notes.call_seconds, 
call_notes.call_start, 
call_notes.call_end, 
call_notes_text.note_text, 
users.username, 
users.namefirst, 
users.email, 
facility_contact.contactid, 
facility_contact.contact 
FROM 
call_notes, 
call_notes_text, 
users, 
facility_contact 
WHERE 
call_notes.ticketid = '1'  
call_notes.userid = users.userid  
call_notes.contactid = facility_contact.contactid  
call_notes_text.noteid = call_notes.noteid 
ORDER BY 
call_notes.call_start DESC;

(results snipped)
1 row in set (17.89 sec)

A variable called $ticketid is passed to this query (and is placed where the
'1' is above).  The ticketid is the key  I use across several tables.   It
is a field in call_notes and that is how I'm getting the noteid (which is
the primary key of call_notes and call_notes_text).   I will post details on
the tables if needed.

Any help or guidance appreciated.

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: Sluggish performance on medium sized table.. EXPLAIN SELECT's i ncluded.

2002-06-03 Thread Stembridge, Michael

First of all, sorry for the multiple mailings of the same message.   I was
receiving bounce messages, so I thought they weren't going through.

On to the reply...

I saw that a while ago and decided to try reversing, but I still have the
same delay.   

Mike

 -Original Message-
 From: Brent Baisley [mailto:[EMAIL PROTECTED]]
 Sent: Monday, June 03, 2002 2:18 PM
 To: Stembridge, Michael; [EMAIL PROTECTED]
 Subject: Re: Sluggish performance on medium sized table.. EXPLAIN
 SELECT's i ncluded.
 
 
 Try changing your WHERE clause from:
 WHERE 
 call_notes.ticketid = '1' 
 call_notes.userid = users.userid 
 call_notes.contactid = facility_contact.contactid 
 call_notes_text.noteid = call_notes.noteid
 
 To
 WHERE 
 call_notes.ticketid = '1' 
 call_notes.userid = users.userid 
 call_notes.contactid = facility_contact.contactid 
 call_notes.noteid = call_notes_text.noteid
 
 Note only the last line is changed and is reversed.
 
 
  A database is being used to log support calls for a call 
 center. There are
  around 25,000 clients in the database. The existing call 
 notes were imported
  from flat text files.
  
  One table (call_notes) contains the call time, ticketid, 
 noteid, ect..
  Another table (call_notes_text) only contains noteid and note_text.
  
  When I query the call_notes table for a specific noteid, the info is
  returned instantly. However when I query the 
 call_notes_text table for a
  specific noteid it takes 15-17 seconds to return the data.  
 The table has
  around 15,000 rows with each row containing a field about 
 the size of a
  small newspaper article.
  
  The server is a dual processor intel333 with 256k ram 
 (RH7.2) running MySQL
  3.23.41.
  
  Each table contains an id which is key.   I've copied and 
 pasted results
  from some EXPLAIN table queries below.
  
  Here is the actual query that is being used in the script.  
 (I've broken
  down so it's easier to read)
  
  SELECT 
  call_notes.call_elapsed,
  call_notes.call_seconds,
  call_notes.call_start,
  call_notes.call_end,
  call_notes_text.note_text,
  users.username, 
  users.namefirst, 
  users.email, 
  facility_contact.contactid,
  facility_contact.contact
  FROM 
  call_notes, 
  call_notes_text, 
  users, 
  facility_contact 
  WHERE 
  call_notes.ticketid = '1' 
  call_notes.userid = users.userid 
  call_notes.contactid = facility_contact.contactid 
  call_notes_text.noteid = call_notes.noteid
  ORDER BY 
  call_notes.call_start DESC;
  
  (results snipped)
  
  1 row in set (17.89 sec)
  
  Now I go to command line and run this query:
  
  mysql SELECT * FROM call_notes_text WHERE noteid='1';
  (results snipped)
  1 row in set (0.00 sec)
  
  I ran an EXPLAIN SELECT on my main query.   (fyi, ticketid 
 1 has a noteid of
  1)
  
  EXPLAIN SELECT 
  call_notes.call_elapsed,
  call_notes.call_seconds,
  call_notes.call_start,
  call_notes.call_end,
  call_notes_text.note_text,
  users.username, 
  users.namefirst, 
  users.email, 
  facility_contact.contactid,
  facility_contact.contact
  FROM 
  call_notes, 
  call_notes_text, 
  users, 
  facility_contact 
  WHERE 
  call_notes.ticketid = '1' 
  call_notes.userid = users.userid 
  call_notes.contactid = facility_contact.contactid 
  call_notes_text.noteid = call_notes.noteid
  ORDER BY 
  call_notes.call_start DESC;
  
  
 +--++-+---
 --+-+-
  ---+---+-+
  | table| type   | possible_keys   | key 
 | key_len |
  ref| rows  | Extra   |
  
 +--++-+---
 --+-+-
  ---+---+-+
  | call_notes_text  | ALL| PRIMARY,noteid,noteid_2 | 
 NULL|NULL |
  NULL   | 14682 | Using temporary; Using filesort |
  | call_notes   | eq_ref | PRIMARY,noteid,noteid_2 | 
 PRIMARY |   4 |
  call_notes_text.noteid | 1 | where used  |
  | users| eq_ref | PRIMARY,userid  | 
 PRIMARY |   4 |
  call_notes.userid  | 1 | |
  | facility_contact | eq_ref | PRIMARY,contactid   | 
 PRIMARY |   4 |
  call_notes.contactid   | 1 | |
  
 +--++-+---
 --+-+-
  ---+---+-+
  4 rows in set (0.00 sec)
  
  Note the number of rows returned from call_notes_text.   
 This matches the
  total number of rows in that table.
  
  It appears to be a problem with the query, but I can't see 
 where the problem
  is.  Thanks for any help you can provide.
  
  - Mike
  
  
 -
  Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http

RE: Sluggish performance on medium sized table.. EXPLAIN SELECT's i ncluded.

2002-06-03 Thread Stembridge, Michael

Thank you Keith - I worked with your example and LEFT JOIN has solved the
problem.  

Best Regards,
Mike


 -Original Message-
 From: Keith C. Ivey [mailto:[EMAIL PROTECTED]]
 Sent: Monday, June 03, 2002 2:26 PM
 To: [EMAIL PROTECTED]
 Cc: Stembridge, Michael
 Subject: Re: Sluggish performance on medium sized table.. EXPLAIN
 SELECT's i ncluded.
 
 
 On 3 Jun 2002, at 11:49, Stembridge, Michael wrote:
 
   FROM 
call_notes, 
call_notes_text, 
users, 
facility_contact 
   WHERE 
call_notes.ticketid = '1'  
call_notes.userid = users.userid  
call_notes.contactid = facility_contact.contactid  
call_notes_text.noteid = call_notes.noteid 
 
 I've found that LEFT JOIN can be useful in getting MySQL to process 
 tables in the best order.  (It also can make problems with your 
 tables more obvious, if records are missing from one of the joined 
 tables.)  Try changing that to 
 
FROM call_notes c LEFT JOIN call_notes_text ct
 ON c.noteid = ct.noteid
 LEFT JOIN users u ON c.userid = u.userid
 LEFT JOIN facility_contact f
 ON c.contactid = f.contactid
WHERE c.ticketid = 1
 
 and see how your EXPLAIN result changes.
 
 -- 
 Keith C. Ivey [EMAIL PROTECTED]
 Tobacco Documents Online
 http://tobaccodocuments.org
 

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Inserting files from command prompt

2002-03-20 Thread Stembridge, Michael

Can a file be inserted to a mysql table from a unix(linux) command prompt?
Also, can I query the same table and output the data to a filename.ext in a
specified directory?  
Not sure if this is an appropriate question for the list, but all
clues/examples would be greatly appreciated.

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: Inserting files from command prompt

2002-03-20 Thread Stembridge, Michael

The problem isn't inserting table schema/data - I know how to do that.  

I'm referring to the process of inserting an actual FILE (txt, .bat, .jpg)
via command line.  And of pulling it out and giving it a name (test.txt).  



 -Original Message-
 From: Mark Horton [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, March 20, 2002 2:34 PM
 To: Stembridge, Michael
 Cc: [EMAIL PROTECTED]
 Subject: Re: Inserting files from command prompt
 
 
 I do this from the command line sometimes:
 
 mysql -h HOST -pPASSWORD DATABASE  statements.sql
 
 The statements.sql file should contain full sql statements.  
 This will 
 read in the file and execute the sql 1 line at a time.
 
 The opposite would be to use mysqldump like so:
 
 mysqldump -h HOST -pPASSWORD DATABASE TABLE  statements.sql
 
 This would dump the contents of the given table in the given database 
 into the statements.sql file.  This create full insert 
 statements with 
 schema.  You can pass it many options; see the web page docs for more.
 
 --Mark
 
 
 Paul DuBois wrote:
  At 10:48 -0500 3/20/02, Stembridge, Michael wrote:
  
  Can a file be inserted to a mysql table from a unix(linux) command 
  prompt?
  
  
  mysqlimport?
  
  Also, can I query the same table and output the data to a 
 filename.ext 
  in a
  specified directory?
  
  
  SELECT ... INTO OUTFILE
  
  Not sure if this is an appropriate question for the list, but all
  clues/examples would be greatly appreciated.
  
  
  
  
 -
  Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
  
  To request this thread, e-mail [EMAIL PROTECTED]
  To unsubscribe, e-mail 
  [EMAIL PROTECTED]
  Trouble unsubscribing? Try: 
 http://lists.mysql.com/php/unsubscribe.php
  
  
 
 
 

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php