[pyar] OT: Comparación de queries

Sebastian Bassi sbassi en clubdelarazon.org
Dom Jun 20 15:31:30 ART 2010


2010/6/20 Roberto Alsina <ralsina en netmanagers.com.ar>:
> Tal vez sea buena idea pedir un EXPLAIN para ver que hace cada una.

Buena idea, no entiendo bien el output pero se ve que la equi-join se
hacen en menos pasos:

sqlite> EXPLAIN SELECT q_name FROM miranda WHERE parID in (SELECT
parID FROM parid_bin WHERE bin = '10B');
0|Trace|0|0|0|EXPLAIN SELECT q_name FROM miranda WHERE parID in
(SELECT parID FROM parid_bin WHERE bin = '10B');|00|
1|Goto|0|28|0||00|
2|SetNumColumns|0|2|0||00|
3|OpenRead|0|86|0||00|
4|If|2|18|0||00|
5|Integer|1|2|0||00|
6|OpenEphemeral|3|1|0|keyinfo(1,BINARY)|00|
7|String8|0|3|0|10B|00|
8|SetNumColumns|0|2|0||00|
9|OpenRead|1|1286|0||00|
10|Rewind|1|17|0||00|
11|Column|1|1|4||00|
12|Ne|3|16|4|collseq(BINARY)|69|
13|Column|1|0|6||00|
14|MakeRecord|6|1|4|c|00|
15|IdxInsert|3|4|0||00|
16|Next|1|11|0||01|
17|Close|1|0|0||00|
18|Rewind|3|26|0||00|
19|Column|3|0|1||00|
20|IsNull|1|25|0||00|
21|MustBeInt|1|25|0||00|
22|NotExists|0|25|1||00|
23|Column|0|1|7||00|
24|ResultRow|7|1|0||00|
25|Next|3|19|0||00|
26|Close|0|0|0||00|
27|Halt|0|0|0||00|
28|Transaction|0|0|0||00|
29|VerifyCookie|0|38|0||00|
30|TableLock|0|86|0|miranda|00|
31|TableLock|0|1286|0|parid_bin|00|
32|Goto|0|2|0||00|
sqlite> EXPLAIN SELECT q_name FROM miranda,parid_bin WHERE
miranda.parID=parid_bin.parID AND parid_bin.bin = '10B';
0|Trace|0|0|0|EXPLAIN SELECT q_name FROM miranda,parid_bin WHERE
miranda.parID=parid_bin.parID AND parid_bin.bin = '10B';|00|
1|String8|0|1|0|10B|00|
2|Goto|0|19|0||00|
3|SetNumColumns|0|2|0||00|
4|OpenRead|1|1286|0||00|
5|SetNumColumns|0|2|0||00|
6|OpenRead|0|86|0||00|
7|Rewind|1|16|0||00|
8|Column|1|1|2||00|
9|Ne|1|15|2|collseq(BINARY)|69|
10|Column|1|0|2||00|
11|MustBeInt|2|15|0||00|
12|NotExists|0|15|2||00|
13|Column|0|1|4||00|
14|ResultRow|4|1|0||00|
15|Next|1|8|0||01|
16|Close|1|0|0||00|
17|Close|0|0|0||00|
18|Halt|0|0|0||00|
19|Transaction|0|0|0||00|
20|VerifyCookie|0|38|0||00|
21|TableLock|0|1286|0|parid_bin|00|
22|TableLock|0|86|0|miranda|00|
23|Goto|0|3|0||00|


-- 
Sebastián Bassi. Lic. en Biotecnologia.

Curso de Python en un día: http://bit.ly/cursopython

Non standard disclaimer: READ CAREFULLY. By reading this email,
you agree, on behalf of your employer, to release me from all
obligations and waivers arising from any and all NON-NEGOTIATED
agreements, licenses, terms-of-service, shrinkwrap, clickwrap,
browsewrap, confidentiality, non-disclosure, non-compete and
acceptable use policies ("BOGUS AGREEMENTS") that I have
entered into with your employer, its partners, licensors, agents and
assigns, in perpetuity, without prejudice to my ongoing rights and
privileges. You further represent that you have the authority to release
me from any BOGUS AGREEMENTS on behalf of your employer.



More information about the pyar mailing list