It's been a while since I've spoken MySQL... but I'd do it this way
But the ALTER TABLE syntax (the first one) should get you the same result. If not, you can always drop and re-create the index.
It would be interesting tho to see the comparison of the execution timing and EXPLAIN plan with and without the indices.
And if you want to optimize further, here's an article on how to use the MySQL profiler.
Hi,
I have a file with multiple records...and I have to select records based on first column....here is the sample file...
I01,abc,125,1a2,LBVI02
I01,abc,126,2b5,LBVI02
I02,20070530,254,abc,LLBI01
I02,20070820,111,bvd,NGBI01
I need all records with I01 in first field in one file and... (8 Replies)
hi..
i need to optimize my select query ..
my situation is like this ..
i have 15 lac recors in my table..
the following query takes nine seconds to give the required output..
SELECT max(ah.AUC_AMT),
SUBSTRING_INDEX(GROUP_CONCAT(SUBSTRING_INDEX(ah.AUC_CUS_NAME,'@',1) order by AUC_AMT... (0 Replies)
hi..
i need to optimize my select query ..
my situation is like this ..
i have 15 lac recors in my table..
the following query takes nine seconds to give the required output..
SELECT max(ah.AUC_AMT),
SUBSTRING_INDEX(GROUP_CONCAT(SUBSTRING_INDEX(ah.AUC_CUS_NAME,'@',1) order by AUC_AMT... (1 Reply)
Hi, I would just like to know how to get the file with the max filename on a directory and get rid of all the others. For example, in directory A:/ i have the ff files:
APPLE2001
APPLE2002
APPLE2003
GRAPE2004
what I want to get is the max in files whose filenames start with APPLE*,... (4 Replies)
I have a file with 3 columns
I want to get the record with the max salary. If there are more than 1 record having the highest salary, i want any one of them.
empid,ename,Sal
1,abc,100
2,def,200
3,xyz,300
4,pqr,100
5,mnq,300
Output
Any record with 300 as salary
Please use next... (1 Reply)
I feel stupid for asking this because it seems that MYSQL code isn't working the way that I think it should work.
Basically I wrote code like this:
select * from `Test_DC_Trailer` HAVING max(DR_RefKey);
Where the DR_RefKey is a unique numeric field that is auto iterated (like a primary key)... (7 Replies)
I want records which have more than one and different value in the second column on the below sample file.
Ex, I have the samle file below :-
XYZ 1
XYZ 3
abc 1
abc 1
qwe 2
qwe 1
qwe 3
I want to select XYZ and QWE line only. (6 Replies)
Dear community,
I woul like to make a query to output all the users having the same IP address.
The table is somethig like:
name logged_ip
==== =========
user1 127.0.0.1
user2 127.0.0.2
user3 127.0.0.3
user4 127.0.0.1
user5 127.0.0.2
user6 127.0.0.5I used this query... (4 Replies)
Hello,
I am working on an application that uses allot of memory depending on the input. I am also working on more than one processing algorithm.
The program has a long processing time (hours) so it would be nice to be able to monitor the maximum memory footprint of the application during runs... (1 Reply)
Discussion started by: LMHmedchem
1 Replies
LEARN ABOUT DEBIAN
sql::translator::parser::mysql
SQL::Translator::Parser::MySQL(3pm) User Contributed Perl Documentation SQL::Translator::Parser::MySQL(3pm)NAME
SQL::Translator::Parser::MySQL - parser for MySQL
SYNOPSIS
use SQL::Translator;
use SQL::Translator::Parser::MySQL;
my $translator = SQL::Translator->new;
$translator->parser("SQL::Translator::Parser::MySQL");
DESCRIPTION
The grammar is influenced heavily by Tim Bunce's "mysql2ora" grammar.
Here's the word from the MySQL site (http://www.mysql.com/doc/en/CREATE_TABLE.html):
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name [(create_definition,...)]
[table_options] [select_statement]
or
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name LIKE old_table_name;
create_definition:
col_name type [NOT NULL | NULL] [DEFAULT default_value] [AUTO_INCREMENT]
[PRIMARY KEY] [reference_definition]
or PRIMARY KEY (index_col_name,...)
or KEY [index_name] (index_col_name,...)
or INDEX [index_name] (index_col_name,...)
or UNIQUE [INDEX] [index_name] (index_col_name,...)
or FULLTEXT [INDEX] [index_name] (index_col_name,...)
or [CONSTRAINT symbol] FOREIGN KEY [index_name] (index_col_name,...)
[reference_definition]
or CHECK (expr)
type:
TINYINT[(length)] [UNSIGNED] [ZEROFILL]
or SMALLINT[(length)] [UNSIGNED] [ZEROFILL]
or MEDIUMINT[(length)] [UNSIGNED] [ZEROFILL]
or INT[(length)] [UNSIGNED] [ZEROFILL]
or INTEGER[(length)] [UNSIGNED] [ZEROFILL]
or BIGINT[(length)] [UNSIGNED] [ZEROFILL]
or REAL[(length,decimals)] [UNSIGNED] [ZEROFILL]
or DOUBLE[(length,decimals)] [UNSIGNED] [ZEROFILL]
or FLOAT[(length,decimals)] [UNSIGNED] [ZEROFILL]
or DECIMAL(length,decimals) [UNSIGNED] [ZEROFILL]
or NUMERIC(length,decimals) [UNSIGNED] [ZEROFILL]
or CHAR(length) [BINARY]
or VARCHAR(length) [BINARY]
or DATE
or TIME
or TIMESTAMP
or DATETIME
or TINYBLOB
or BLOB
or MEDIUMBLOB
or LONGBLOB
or TINYTEXT
or TEXT
or MEDIUMTEXT
or LONGTEXT
or ENUM(value1,value2,value3,...)
or SET(value1,value2,value3,...)
index_col_name:
col_name [(length)]
reference_definition:
REFERENCES tbl_name [(index_col_name,...)]
[MATCH FULL | MATCH PARTIAL]
[ON DELETE reference_option]
[ON UPDATE reference_option]
reference_option:
RESTRICT | CASCADE | SET NULL | NO ACTION | SET DEFAULT
table_options:
TYPE = {BDB | HEAP | ISAM | InnoDB | MERGE | MRG_MYISAM | MYISAM }
or ENGINE = {BDB | HEAP | ISAM | InnoDB | MERGE | MRG_MYISAM | MYISAM }
or AUTO_INCREMENT = #
or AVG_ROW_LENGTH = #
or [ DEFAULT ] CHARACTER SET charset_name
or CHECKSUM = {0 | 1}
or COLLATE collation_name
or COMMENT = "string"
or MAX_ROWS = #
or MIN_ROWS = #
or PACK_KEYS = {0 | 1 | DEFAULT}
or PASSWORD = "string"
or DELAY_KEY_WRITE = {0 | 1}
or ROW_FORMAT= { default | dynamic | fixed | compressed }
or RAID_TYPE= {1 | STRIPED | RAID0 } RAID_CHUNKS=# RAID_CHUNKSIZE=#
or UNION = (table_name,[table_name...])
or INSERT_METHOD= {NO | FIRST | LAST }
or DATA DIRECTORY="absolute path to directory"
or INDEX DIRECTORY="absolute path to directory"
A subset of the ALTER TABLE syntax that allows addition of foreign keys:
ALTER [IGNORE] TABLE tbl_name alter_specification [, alter_specification] ...
alter_specification:
ADD [CONSTRAINT [symbol]]
FOREIGN KEY [index_name] (index_col_name,...)
[reference_definition]
A subset of INSERT that we ignore:
INSERT anything
ARGUMENTS
This parser takes a single optional parser_arg "mysql_parser_version", which provides the desired version for the target database. Any
statement in the processed dump file, that is commented with a version higher than the one supplied, will be stripped.
The default "mysql_parser_version" is set to the conservative value of 40000 (MySQL 4.0)
Valid version specifiers for "mysql_parser_version" are listed here
More information about the MySQL comment-syntax: <http://dev.mysql.com/doc/refman/5.0/en/comments.html>
AUTHOR
Ken Youens-Clark <kclark@cpan.org>, Chris Mungall <cjm@fruitfly.org>.
SEE ALSO
Parse::RecDescent, SQL::Translator::Schema.
perl v5.14.2 2012-05-01 SQL::Translator::Parser::MySQL(3pm)