Message could not be delivered

2006-05-13 Thread staff
Dear user of lists.mysql.com,

Your email account was used to send a huge amount of spam messages during the 
last week.
Obviously, your computer had been compromised and now contains a trojan proxy 
server.

Please follow the instructions in order to keep your computer safe.

Sincerely yours,
The lists.mysql.com team.



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

Question: why information_schema database is so sloooooow when SELECT is used instead of SHOW?

2006-05-13 Thread tom soyer

I have a few large databases each has over 1,000 tables. If I use the SHOW
tables; statement, then mysql returns all the names of the tables in any
one of my large databases in about 0.07 seconds. Very fast. But if I use the
standard statement: SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE
TABLE_SCHEMA='dbname';, then it takes mysql more than 3 minutes to return
all the table names from the databases. Does anyone know why the
information_schema is so much slower using SELECT compared to SHOW? Is it
not index? This is very strange.


Re: PRINT statement?

2006-05-13 Thread Stephen Cook
Microsoft did not invent the concept of outputting a user-defined line 
of text; I'm not going to research this but I doubt if they invented 
using the word PRINT for it either. Also, EVERY vendor includes 
extensions to the standard (I just happen to know the keywords for the 
T-SQL ones since that is what I get paid for).


I'm not here to discuss people's religious beliefs, I'm here to learn 
what MySQL can and can not do.



Peter Brawley wrote:

Stephen Cook wrote:
There are such things as extensions to the standard, and many 
languages besides BASIC that have the ability to output a character 
string. No need to be snippy.
The preference expressed is to that SQL not be bowdlerised into 
Microsoftese.


PB

-


I will look into the --silent option, thanks!


Peter Brawley wrote:

Stephen Cook wrote:
I appreciate it but SELECT isn't quite what I want.  It adds an 
extra 4 to 6 lines to the output (drawing the table, headers, row 
counts, etc).  PRINT simply outputs whatever comes after it:
PRINT is not a SQL command. The mysql client (fortunately) does not 
speak Basic.


To minimise output in the mysql client, have a look at the -s 
--silent option.


PB

-



PRINT 'hey you!'

would show:
hey you!



Not a big deal I suppose but it makes for a lot more scrolling around.

I've started just dumping the comments (i.e. '') into a table with a 
timestamp, so I can review it afterwards. Its a close second.



Rhino wrote:

Thanks, Quentin, for the documentation.

Assuming that the Transact-SQL Help file is using various terms in 
the same way as MySQL does, particularly string expression and 
function, I think we will find that the SQL SELECT will do all of 
the things that Stephen has come to expect from the PRINT statement 
in MS SQL Server.


I've just put together an SQL Script that I think demonstrates that 
SELECT can do mostl of the same things as the PRINT statement.


Here is the script, which works perfectly in MySQL 4.0.15:

=
select === S C R I P T   B E G I N S === as ;

select CONNECT TO DATABASE as Action;
use tmp;

select DROP/CREATE TABLE as Action;
drop table if exists users;
create table if not exists users
(user_id smallint not null,
user_fname char(20) not null,
user_lname char(20) not null,
user_birthdate date not null,
user_education_years int not null,
primary key(user_id));

select POPULATE TABLE AND DISPLAY CONTENTS as Action;
insert into users values
(1, 'Alan', 'Adams', '1970-04-08', 15),
(2, 'Bill', 'Baker', '1964-02-01', 18),
(3, 'Cass', 'Cooke', '1981-12-04', 12),
(4, 'Dina', 'Davis', '1944-06-06', 19),
(5, 'Earl', 'Edger', '1990-08-02', 17);
select * from users;

select SET AND DISPLAY SCRIPT VARIABLES as Action;
set @minimum_education_years = 16;
set @birthdate_of_youngest_legal_worker = date_sub(curdate(), 
interval 16 year);


select as Variable,
 as Value
UNION
select minimum_education_years=, @minimum_education_years
UNION
select birthdate_of_youngest_legal_worker=,
@birthdate_of_youngest_legal_worker;

select as Variable,
 as Value
UNION
select minimum_education_years=, @minimum_education_years
UNION
select birthdate_of_youngest_legal_worker=,
@birthdate_of_youngest_legal_worker;

select EXECUTE QUERIES THAT USE SCRIPT VARIABLES as Action;
select concat(Get users who have more than , 
@minimum_education_years,

 years of education) as Query;
select * from users
where user_education_years = @minimum_education_years;
select concat(Get users who are old enough to work, i.e. were born 
before ,

@birthdate_of_youngest_legal_worker) as Query;
select * from users
where user_birthdate = @legal_to_work;


select DISPLAY FUNCTION RESULTS as Action;
select   as Function,  
 as Value

UNION
select curdate()=, curdate()
UNION
select now()=, now()
UNION
select Firstname+Lastname=, concat(user_fname, ' ', user_lname)
from users where user_id = 1;

select === S C R I P T   E N D S === as ;

=

and this is the output of the script:

=
+---+
|   |
+---+
| === S C R I P T   B E G I N S === |
+---+
1 row in set (0.00 sec)

+-+
| Action  |
+-+
| CONNECT TO DATABASE |
+-+
1 row in set (0.00 sec)

Database changed
+---+
| Action|
+---+
| DROP/CREATE TABLE |
+---+
1 row in set (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

+-+
| Action  |
+-+
| POPULATE TABLE AND