tested on mysql 5.1.31-1ubuntu2 and mysql-5.1.36-solaris10-x86_64 (got from mysql.com)
=========
CREATE TABLE table (
table_id INTEGER,
length INTEGER,
name VARCHAR(16)
);
ALTER TABLE table ADD INDEX (table_id, length);
INSERT INTO table3 VALUES (10, 100, "hundred");
INSERT INTO table3 VALUES (20, 200, "two hundred");
INSERT INTO table3 VALUES (30, 300, "...
Hi,
I am running the below query and it is taking too long to response. How can I improve it?
SELECT COUNT(DISTINCT CONCAT(r3.name,'-',r4.name from mesh r0, mesh r1, neighbour_yz r2, element r3, number r4 where r3.name=r4.num
Hi,
Got your point. Thanks for the quick reply. I had one more question regarding the index access or you can say the no. of rows estimated for InnoDB engine.
As explained by you, for InnoDB engines,it probes 10 random spots in the table whenever you 'open' the table. So how this random probing works? I mean to ask how the no of rows to be read are estimated using these 10 different ...
Sorry, no answers this time.
* Different query plans for different sessions (hence, different opens)... I suspect (without proof) that you will get the same query plan until you disconnect/reconnect. Note: Going thru a UI usually involves going through a different connection because of the way the web server works (even with "persistent" connections).
* I have never looked at the code...
Hi,
Thanks a lot for your quick reply and I would like to appreciate your great support. While saying that "no answers this time" you gave many answers. I almost got to knw how the optimizer is working.
I had only one question from you last post.Is the probing method used to estimate the total tuple count of the entire table? Or it is used by the optimizer to estimate the rows that ...
A possible answer...
In drilling down the BTree to find const1 (or const2), it gets some feel for what percentage of the BTree nodes INDEX(x) are to the left of the path it is traversing. If that is < 30%, it will use the index; if > 30%, it won't bother with the index. Instead it will use a table scan.
OTOH, if x is a "clustered key" (ie, PRIMARY KEY for InnoDB), the index and the data ...
Hi,
I had one more query. the filter column in the explain shows the fraction of the rows required to be examined. Now I have following select query on a table having an index on attribute X. The cardinality of the table is 2,00,000.
Query:
explain extended
select * from t1 where x<= const;
Now when the value of constant is the one which would fetch the result with cardinality ...
And I will give you "one more" answer... ;)
Well, only a guess. The filter percentage is a new feature, and I don't have much feel for it yet. Perhaps an early stage in the optimizer decided that it would be more than 30% and then simply set a value (50%) to tell the next stage of the optimizer "don't use the index" but also "you won't need all the rows". It could be that some query ...
Hi guys,
I have two tables, people, and roles, that I need to query against. Each person can have zero or more roles at any given time.
--------------------------
CREATE TABLE `people` (
`guid` varchar(128) NOT NULL,
`xuid` varchar(128) DEFAULT NULL,
`moeid` smallint(4) unsigned zerofill DEFAULT NULL,
`first` varchar(64) NOT NULL,
`last` varchar(64) NOT NULL,
`...
A rude stop of MyISAM necessitates a CHECK and possibly a REPAIR. Suggest you do CHECK TABLE tokens; REPAIR TABLE tokens; -- if the CHECK was not 'ok' ANALYZE TABLE tokens; -- maybe its stats need refreshing
No names. Not even certain whether the SSNs are all valid. It doesn't matter, though. Let's just assume that it's a randomly generated anonymous SSN death index, which is probably closest to the truth at this point. The memory analysis for a random fetch definitely made that clear. It just seems that no matter whether the SSN is random that if the SSN is sequentially ordered as a 9-digit number such that 111223333 <...
Yes. it is - the quotes!. This column is defined intentionally as varchar but I'm operating on decimal strings so I missed this issue. Adding quotes makes the job. Thank you for your analyse and pointing the sollution. Thank you for note about autoincrement, Indeed there should be unique index, just for a case. Thank you and best regards.
HOLA A TODOS. El motivo de mi consulta es la siguiente dado qeu yo es una duda muy facil en bases de datos MYSQL. Resulta que me encuentro trabajando unas serie de consulticas en una base de datos con tabls de 500000registros, 400000 registros y necesito hacer una consulta que me las relacione pero el computador se me muere pensando . mire la consulta es la siguiente en MYSQL : SELECT fecha2, fechasolicitud, NumeroCuenta2, NombreOficina2,...
CREATE TABLE `yp_companies` ( `company_id` int(11) NOT NULL default '0', `company_name_en` varchar(100) NOT NULL, `company_name_ar` varchar(100) character set utf8 NOT NULL, `address_en` varchar(200) NOT NULL, `address_ar` varchar(200) character set utf8 NOT NULL, `pobox_name_en` varchar(100) character set utf8 NOT NULL, `pobox_name_ar` varchar(100) character set utf8 NOT NULL, `office_en` varchar(255) character set utf8 NOT NULL,...
Hi Rick, i'm supposed to help writing a paper about mutual synergistig effects of queries. There are some DB Systems which support the parallel execution of a bundle of queries with features like recyling results, creating temporay views... I personally only used MySQL for practical purposes and never really had any performance problems(besides the ones in my code). For now i just have dicovered the...
tested on mysql 5.1.31-1ubuntu2 and mysql-5.1.36-solaris10-x86_64 (got from mysql.com) ========= CREATE TABLE table ( table_id INTEGER, length INTEGER, name VARCHAR(16) ); ALTER TABLE table ADD INDEX (table_id, length); INSERT INTO table3 VALUES (10, 100, "hundred"); INSERT INTO table3 VALUES (20, 200, "two hundred"); INSERT INTO table3 VALUES (30, 300, "three hundred"); INSERT INTO table3...
The "7 rows" is really what mysql scans. On the real database, with 200000+ rows, this request is really slower. At last, i rewrote my query to use the form: SELECT table3.name FROM table3 WHERE table2_id=10 AND length=100; in real life, something like: SELECT table3.name FROM table3 WHERE table2_id = (SELECT table2_id FROM table2 WHERE xxx) AND length = (SELECT length FROM table2 WHERE xxx) awful...
Thread profile page for "simple JOIN with sub SELECT strangeness" on http://www.mysql.com.
This report page is a snippet summary view from a single thread "simple JOIN with sub SELECT strangeness", located on the Message Board at http://www.mysql.com.
This thread profile page shows the thread statistics for: Total Authors, Total Thread Posts, and Thread Activity