just - universidad técnica estatal de quevedo
TRANSCRIPT
just
UNIVERSIDAD TÉCNICA ESTATAL DE QUEVEDO
FACULTAD DE CIENCIAS DE LA INGENIERÍA
ESCUELA DE INFORMÁTICA
TESIS DE GRADO
PREVIO LA OBTENCIÓN DEL TÍTULO DE
INGENIERO EN SISTEMAS
TEMA
““AANNAALLIISSIISS DDEELL TTIIEEMMPPOO DDEE RREESSPPUUEESSTTAA DDEE LLAASS SSEENNTTEENNCCIIAASS SSQQLL CCOOMMPPLLEEJJAASS
UUTTIILLIIZZAANNDDOO VVOOLLUUMMEENNEESS DDEE MMIILLLLOONNEESS DDEE DDAATTOOSS””
AUTOR:
CARLOS JAVIER HIDALGO RIVAS.
TUTOR DE TESIS:
ING. ARIOSTO VICUÑA PINO
QUEVEDO – LOS RÍOS – ECUADOR
2012
UNIVERSIDAD TÉCNICA ESTATAL DE QUEVEDO
FACULTAD DE CIENCIAS DE LA INGENIARÍA
ESCUELA DE INFORMÁTICA
AANNAALLIISSIISS DDEELL TTIIEEMMPPOO DDEE RREESSPPUUEESSTTAA DDEE LLAASS SSEENNTTEENNCCIIAASS SSQQLL CCOOMMPPLLEEJJAASS
UUTTIILLIIZZAANNDDOO VVOOLLUUMMEENNEESS DDEE MMIILLLLOONNEESS DDEE DDAATTOOSS
Presentado al Honorable concejo directivo como requisito previo a la obtención del título de
ingeniero en sistemas.
Aprobado:
PRESIDENTE DEL TRIBUNAL DE TESIS
MIEMBRO DEL TRIBUNAL DE TESIS MIEMBRO DEL TRIBUNAL DE TESIS
QUEVEDO – LOS RÍOS – ECUADOR
2012
I
CERTIFICACIÓN
Yo, Ing. Ariosto Vicuña, Docente de la Facultad de Ciencias de la Ingeniería de la Universidad
Técnica Estatal de Quevedo, certifico que el Egresado Carlos Javier Hidalgo Rivas, realizó la
Tesis de grado titulada ““AANNAALLIISSIISS DDEELL TTIIEEMMPPOO DDEE RREESSPPUUEESSTTAA DDEE LLAASS
SSEENNTTEENNCCIIAASS SSQQLL CCOOMMPPLLEEJJAASS UUTTIILLIIZZAANNDDOO VVOOLLUUMMEENNEESS DDEE MMIILLLLOONNEESS DDEE
DDAATTOOSS””, bajo mi dirección, habiendo cumplido con las disposiciones reglamentarias
establecidas para el efecto.
ARIOSTO VICUÑA PINO
INGENIERO EN COMPUTACIÓN
DIRECTOR DE TESIS
II
AUTORIA
Certifico que los criterios, opiniones, métodos,
procedimientos, análisis e interpretación de resultados
del presente trabajo de investigación son de exclusiva
responsabilidad del autor.
CARLOS JAVIER HIDALGO RIVAS
III
DDEEDDIICCAATTOORRIIAA
A Dios por haberme permitido culminar esta carrera con éxito;
A mi madre Zoila Emperatriz Rivas Espinoza, por el esfuerzo diario que
siempre demostró para ayudarme a cumplir con mi objetivo propuesto;
A mis hermanas, Juliza Jazmín Hidalgo y Mónica Jessenia Hidalgo Rivas,
quienes me dieron la fuerza necesaria para conseguir esta meta;
A mi padre, por haberme brindado apoyo durante toda mi vida;
A mis demás hermanos Fernando, Sonia, Jasón, Manuel, Mauricio, Jessica,
Irma, Matilde y Ginette por apoyo brindado; y
A mis amigos, quienes de alguna manera fueron parte importante de mi
formación como persona.
IV
AAGGRRAADDEECCIIMMIIEENNTTOO
A la UNIVERSIDAD TÉCNICA ESTATAL DE QUEVEDO por haberme
acogido en su seno para poder llegar a ser un profesional;
A todos los docentes que de una u otra maner a lograron incentivar en mí
los valores que me permitieron obtener el fin propuesto;
Y a toda mi familia que siempre han estado junto a mí para bridarme el
apoyo necesario.
Y finalmente a mi tutor Ariosto Vicuña Pino, quien contribuyó a la
culminación de la carrera.
INDICE
CERTIFICACIÓN ........................................................................................................................................ I
AUTORIA …………………………………………………………………………………………………II
DDEEDDIICCAATTOORRIIAA ......................................................................................................................................... III
AAGGRRAADDEECCIIMMIIEENNTTOO ................................................................................................................................ IV
1. RESUMEN ...................................................................................................................................... 1
2. SUMMARY. ................................................................................................................................... 2
3. INTRODUCCIÓN .......................................................................................................................... 2
4. JUSTIFICACIÓN. ........................................................................................................................... 5
5. OBJETIVOS.................................................................................................................................... 5
5.1 OBJETIVO GENERAL. .............................................................................................................. 5
5.2 OBJETIVOS ESPECÍFICOS. ...................................................................................................... 6
6. PROBLEMA DE INVESTIGACIÓN. ............................................................................................ 6
6.1 PROBLEMATIZACIÓN. ............................................................................................................ 6
6.2 FORMULACIÓN DEL PROBLEMA. ......................................................................................... 7
7. HIPÓTESIS. .................................................................................................................................... 8
7.1 GENERAL. .................................................................................................................................. 8
7.2 MATRIZ DE CONCEPTUALIZACIÓN. .................................................................................... 8
8. MARCO TEÓRICO. ....................................................................................................................... 8
8.1 ESTUDIO REALIZADO POR EMPRESA EDINWARE. .......................................................... 8
8.2 SEGÚN LUCAS FORCHINO ................................................................................................... 10
8.3 ALGORITMOS DE RESOLUCION DE SENTENCIAS SQL .................................................. 13
8.3.1 ALGORITMOS UTILIZADOS EN POSTGRES 9.0 DURANTE LAS PRUEBAS. .................. 13
8.3.2 ALGORITMOS UTILIZADOS EN SQL SERVER 2008 R2 DURANTE LAS PRUEBAS. ....... 15
8.3.3 ALGORITMOS UTILIZADOS EN ORACLE 10G DURANTE LAS PRUEBAS. .................... 20
8.4 EQUIVALENCIAS DE ALGORITMOS. ................................................................................. 23
9. MÉTODOS Y MATERIALES. .................................................................................................... 24
9.1 METODOLOGÍA. ..................................................................................................................... 24
9.2 MATERIALES. .......................................................................................................................... 25
9.3 RECURSOS HUMANOS. ......................................................................................................... 26
10. RESULTADOS DE LA COMPROBACIÓN DE HIPÓTESIS. ................................................... 26
10.1 ANÁLISIS DE RESULTADOS Y DISCUSIONES. ................................................................. 26
10.2 INTERPRETACIÓN GENERAL DE GRÁFICOS DE DISPERSIÓN Y TABLAS .................. 26
10.3 ANÁLISIS DE RESULTADOS DE SENTENCIAS SELECT EN POSTGRES 9.0 ................. 27
10.4 ANÁLISIS DE RESULTADOS DE SENTENCIAS UPDATE EN POSTGRES 9.0 ................ 28
10.5 ANÁLISIS DE RESULTADOS DE SENTENCIAS DELETE EN POSTGRES 9.0 ................. 29
10.6 ANÁLISIS DE RESULTADOS DE SENTENCIAS INSERT EN POSTGRES 9.0 .................. 30
10.7 ANÁLISIS DE RESULTADOS DE SENTENCIAS SELECT EN SQL SERVER 2008 ........... 32
10.8 ANÁLISIS DE RESULTADOS DE SENTENCIAS UPDATE EN SQL SERVER 2008 .......... 33
10.9 ANÁLISIS RESULTADOS DE SENTENCIAS DELETE EN SQL SERVER 2008. ............... 34
10.10 ANÁLISIS DE RESULTADOS DE SENTENCIAS INSERT EN SQL SERVER 2008 ........... 35
10.11 ANÁLISIS DE RESULTADOS DE SENTENCIAS SELECT EN ORACLE 10G. .................. 36
10.12 ANÁLISIS DE RESULTADOS DE SENTENCIAS UPDATE EN ORACLE 10G .................. 37
10.13 ANÁLISIS DE RESULTADOS DE SENTENCIAS DELETE EN ORACLE 10G ................... 38
10.14 ANÁLISIS DE RESULTADOS DE SENTENCIAS INSERT EN ORACLE 10G .................... 39
11. PRESUPUESTO. .......................................................................................................................... 42
12. CONCLUSIONES. ....................................................................................................................... 43
13. RECOMENDACIONES ............................................................................................................... 43
ANEXO 1. DIAGRAMA DE LA BASE DE DATOS DEL SISTEMA DE GESTION MUNICIPAL
CABILDO – CASTASTRO URBANO Y RURAL . ......................................................................... 45
ANEXO 2. REQUERIMIENTOS PARA LA SENTENCIA SELECT . .............................................. 46
ANEXO 3. REQUERIMIENTOS PARA LA SENTENCIA UPDATE .................................................... 47
ANEXO 4. REQUERIMIENTOS PARA LA SENTENCIA DELETE. ................................................... 48
ANEXO 5. REQUERIMIENTOS PARA LA SENTENCIA INSERT. .................................................... 49
ANEXO 7. RESULTADOS DE LA SENTENCIA SELECT BAJO DBMS POSTGRES 9.0 ............... 50
ANEXO 8. RESULTADOS DE LA SENTENCIA SELECT BAJO DBMS SQL SERVER 2008 R2 ... 51
ANEXO 9. RESULTADOS DE LA SENTENCIA SELECT BAJO DBMS ORACLE 10G .................. 52
ANEXO 10. RESULTADOS DE LA SENTENCIA UPDATE BAJO DBMS POSTGRES 9.0 ............ 53
ANEXO 11. RESULTADOS DE LA SENTENCIA UPDATE BAJO DBMS SQL SERVER 2008 R2 54
ANEXO 12. RESULTADOS DE LA SENTENCIA UPDATE BAJO DBMS ORACLE 10G .............. 55
ANEXO 13. RESULTADOS DE LA SENTENCIA DELETE BAJO DBMS POSTGRES 9.0 ............. 56
ANEXO 14. RESULTADOS DE LA SENTENCIA DELETE BAJO DBMS SQL SERVER 2008 R2 57
ANEXO 15. RESULTADOS DE LA SENTENCIA DELETE BAJO DBMS ORACLE 10G ............... 58
ANEXO 16. RESULTADOS DE LA SENTENCIA INSERT BAJO DBMS POSTGRES 9.0 .............. 59
ANEXO 17. RESULTADOS DE LA SENTENCIA INSERT BAJO DBMS SQL SERVER 2008 R2 .. 60
ANEXO 18. RESULTADOS DE LA SENTENCIA INSERT BAJO DBMS ORACLE 10G ................ 61
ANEXO 9. RESULTADOS EN POSTGRES CON 1 MILLON DE DATOS. ......................................... 62
ANEXO 19. RESULTADOS EN POSTGRES CON 5 MILLONES DE DATOS. ................................... 62
ANEXO 20. RESULTADOS EN SQL SERVER 2008 R2 CON 1 MILLON DE DATOS. ..................... 63
ANEXO 21. RESULTADOS EN SQL SEVER 2008 R2 CON 5 MILLONES DE DATOS. ................... 63
ANEXO 22. RESULTADOS EN ORACLE 10G CON 1 MILLON DE DATOS. ................................... 64
ANEXO 23. RESULTADOS EN ORACLE 10G CON 5 MILLONES DE DATOS. ............................... 64
ANEXO 24. RECURSOS UTILIZADOS EN POSTGRES CON UN MILLON DE DATOS. ............... 65
ANEXO 25. RECURSOS UTILIZADOS EN POSTGRES CON CINCO MILLONES DE DATOS. .... 66
ANEXO 26. RECURSOS UTILIZADOS EN SQL SERVER 2008 CON UN MILLON DE DATOS. ... 67
ANEXO 27. RECURSOS UTILIZADOS EN SQL SERVER 2008 CON CINCO MILLONES DE
DATOS....................................................................................................................................................... 68
ANEXO 28. RECURSOS UTILIZADOS EN ORACLE 10G CON UN MILLON DE DATOS. ............ 69
ANEXO 29. RECURSOS UTILIZADOS EN ORACLE 10G CON CINCO MILLONES DE DATOS. . 70
ANEXO 30. TABLAS UTILIZADAS EN POSTGRES, ORACLE Y SQL SERVER 2008 CON UN
MILLON DE DATOS. ............................................................................................................................... 71
ANEXO 31. TABLAS UTILIZADAS EN POSTGRES 9.0, ORACLE 10G Y SQL SERVER 2008 R2
CON CINCO MILLONES DE DATOS. ................................................................................................... 72
ANEXO 32. ALGORITMOS UTILIZADOS EN BASES DE DATOS POSTGRES 9.0, SQL SERVER
2008 R2 Y ORACLE 10G CON UN MILLON DE DATOS. ................................................................... 73
ANEXO 33. ALGORITMOS UTILIZADOS EN BASES DE DATOS POSTGRES 9.0, SQL SERVER
2008 R2 Y ORACLE 10G CON 5 MILLONES DE DATOS. .................................................................. 74
ANEXO 34. RECURSOS UTILIZADOS POR SENTENCIAS EN POSTGRES 9.0. ............................. 75
ANEXO 35. RECURSOS UTILIZADOS POR SENTENCIAS EN SQL SERVER 2008 R2. ................. 75
ANEXO 36. RECURSOS UTILIZADOS POR SENTENCIAS EN ORACLE 10G. ............................... 76
ANEXO 2 SCRIPTS PARA PRUEBAS SELECT .................................................................................. 77
14.1.1.1 ANEXO 2. SCRIPTS PARA PRUEBAS SELECT ................................................................. 77
14.1.1.1 PRUEBA 1 SIN OPTIMIZACIÓN (SENTENCIA SELECT). ................................................. 77
14.1.1.2 PRUEBA 1 PRIMERA OPTIMIZACIÓN (SENTENCIA SELECT). ..................................... 78
14.1.1.3 PRUEBA 1 SEGUNDA OPTIMIZACIÓN (SENTENCIA SELECT). .................................... 79
14.1.1.4 PRUEBA 2 SIN OPTIMIZACIÓN (SENTENCIA SELECT). ................................................. 81
14.1.1.5 PRUEBA 2 PRIMER OPTIMIZACIÓN (SENTENCIA SELECT). ........................................ 82
14.1.1.6 PRUEBA 2 SEGUNDA OPTIMIZACIÓN (SENTENCIA SELECT). .................................... 83
14.1.1.7 PRUEBA 3 SIN OPTIMIZACIÓN (SENTENCIA SELECT). ................................................ 87
14.1.1.8 PRUEBA 3 PRIMERA OPTIMIZACIÓN (SENTENCIA SELECT). ...................................... 88
14.1.1.9 PRUEBA 3 SEGUNDA OPTIMIZACIÓN (SENTENCIA SELECT). ..................................... 91
14.1.1.10 PRUEBA 4 SIN OPTIMIZACIÓN (SENTENCIA SELECT). ................................................. 93
14.1.1.11 PRUEBA 4 PRIMER OPTIMIZACIÓN (SENTENCIA SELECT). ........................................ 95
14.1.1.12 PRUEBA 4 SEGUNDA OPTIMIZACIÓN (SENTENCIA SELECT). ..................................... 99
14.1.1.13 PRUEBA 5 SIN OPTIMIZACIÓN (SENTENCIA SELECT). ............................................... 102
14.1.1.14 PRUEBA 5 PRIMERA OPTIMIZACIÓN (SENTENCIA SELECT). .................................. 104
14.1.1.15 PRUEBA 5 SEGUNDA OPTIMIZACIÓN (SENTENCIA SELECT). ................................... 105
14.1.1.16 ANEXO 3. SCRIPTS PARA PRUEBAS UPDATE. ............................................................. 109
14.1.1.17 PRUEBA 1 SIN OPTIMIZACIÓN (SENTENCIA UPDATE). .............................................. 109
14.1.1.18 PRUEBA 1 PRIMERA OPTIMIZACIÓN (SENTENCIA UPDATE). ................................... 110
14.1.1.19 PRUEBA 1 SEGUNDA OPTIMIZACIÓN (SENTENCIA UPDATE). ................................. 111
14.1.1.20 PRUEBA 2 SIN OPTIMIZACIÓN (SENTENCIA UPDATE). ............................................. 113
14.1.1.21 PRUEBA 2 PRIMERA OPTIMIZACIÓN (SENTENCIA UPDATE). .................................. 114
14.1.1.22 PRUEBA 2 SEGUNDA OPTIMIZACIÓN (SENTENCIA UPDATE). ................................. 116
14.1.1.23 PRUEBA 3 SIN OPTIMIZACIÓN (SENTENCIA UPDATE). ............................................. 118
14.1.1.24 PRUEBA 3 PRIMER OPTIMIZACIÓN (SENTENCIA UPDATE). .................................... 119
14.1.1.25 PRUEBA 3 SEGUNDA OPTIMIZACIÓN (SENTENCIA UPDATE). ................................ 121
14.1.1.26 PRUEBA 4 SIN OPTIMIZACIÓN (SENTENCIA UPDATE). .............................................. 123
14.1.1.27 PRUEBA 4 PRIMER OPTIMIZACIÓN (SENTENCIA UPDATE). ...................................... 124
14.1.1.28 PRUEBA 4 SEGUNDA OPTIMIZACIÓN (SENTENCIA UPDATE). ................................. 127
14.1.1.29 PRUEBA 5 SIN OPTIMIZACIÓN (SENTENCIA UPDATE). ............................................. 129
14.1.1.30 PRUEBA 5 PRIMER OPTIMIZACIÓN (SENTENCIA UPDATE). ..................................... 130
14.1.1.31 PRUEBA 5 SEGUNDA OPTIMIZACIÓN (SENTENCIA UPDATE). ................................. 131
14.1.2 ANEXO 3. SCRIPTS PARA LA SENTENCIA DELETE. ........................................................ 135
14.1.2.1 PRUEBA 1 SIN OPTIMIZACIÓN (SENTENCIA DELETE). .............................................. 135
14.1.2.2 PRUEBA 1 PRIMERA OPTIMIZACIÓN (SENTENCIA DELETE). ................................... 136
14.1.2.3 PRUEBA 1 SEGUNDA OPTIMIZACIÓN (SENTENCIA DELETE). .................................. 137
14.1.2.4 PRUEBA 2 SIN OPTIMIZACIÓN (SENTENCIA DELETE). ............................................... 140
14.1.2.5 PRUEBA 2 PRIMER OPTIMIZACIÓN (SENTENCIA DELETE). ...................................... 141
14.1.2.6 PRUEBA 2 SEGUNDA OPTIMIZACIÓN (SENTENCIA DELETE). .................................. 142
14.1.2.7 PRUEBA 3 SIN OPTIMIZACIÓN (SENTENCIA DELETE). ............................................... 145
14.1.2.8 PRUEBA 3 PRIMER OPTIMIZACIÓN (SENTENCIA DELETE). ..................................... 146
14.1.2.9 PRUEBA 3 SEGUNDA OPTIMIZACIÓN (SENTENCIA DELETE). ................................. 147
14.1.2.10 PRUEBA 4 SIN OPTIMIZACIÓN (SENTENCIA DELETE). .............................................. 149
14.1.2.11 PRUEBA 4 PRIMERA OPTIMIZACIÓN (SENTENCIA DELETE). .................................. 150
14.1.2.12 PRUEBA 4 SEGUNDA OPTIMIZACIÓN (SENTENCIA DELETE). .................................. 151
14.1.2.13 PRUEBA 5 SIN OPTIMIZACIÓN (SENTENCIA DELETE). .............................................. 153
14.1.2.14 PRUEBA 5 PRIMER OPTIMIZACIÓN (SENTENCIA DELETE). ...................................... 154
14.1.2.15 PRUEBA 5 SEGUNDA OPTIMIZACIÓN (SENTENCIA DELETE). ................................. 155
14.2 ANEXO 4. PRUEBAS PARA LA SENTENCIA INSERT. ....................................................... 159
14.2.1.1 PRUEBA 1 SIN OPTIMIZACIÓN (SENTENCIA INSERT). ............................................... 159
14.2.1.2 PRUEBA 1 PRIMERA OPTIMIZACIÓN (SENTENCIA INSERT). .................................... 159
14.2.1.3 PRUEBA 1 SEGUNDA OPTIMIZACIÓN (SENTENCIA INSERT). .................................. 160
14.2.1.4 PRUEBA 2 SIN OPTIMIZACIÓN (SENTENCIA INSERT). ............................................... 161
14.2.1.5 PRUEBA 2 PRIMER OPTIMIZACIÓN (SENTENCIA INSERT). ...................................... 163
14.2.1.6 PRUEBA 2 SEGUNDA OPTIMIZACIÓN (SENTENCIA INSERT). ................................... 164
14.2.1.7 PRUEBA 3 SIN OPTIMIZACIÓN (SENTENCIA INSERT). ............................................... 166
14.2.1.8 PRUEBA 3 PRIMER OPTIMIZACIÓN (SENTENCIA INSERT). ....................................... 168
14.2.1.9 PRUEBA 3 SEGUNDA OPTIMIZACIÓN (SENTENCIA INSERT). ................................... 170
14.2.1.10 PRUEBA 4 SIN OPTIMIZACIÓN (SENTENCIA INSERT). ............................................ 172
14.2.1.11 PRUEBA 4 PRIMERA OPTIMIZACIÓN (SENTENCIA INSERT). ................................. 173
14.2.1.12 PRUEBA 4 SEGUNDA OPTIMIZACIÓN (SENTENCIA INSERT). ............................... 174
14.2.1.13 PRUEBA 5 SIN OPTIMIZACIÓN (SENTENCIA INSERT). ............................................ 175
14.2.1.14 PRUEBA 5 PRIMER OPTIMIZACIÓN (SENTENCIA INSERT). .................................... 177
14.2.1.15 PRUEBA 5 SEGUNDA OPTIMIZACIÓN (SENTENCIA INSERT). ................................ 178
DUBLIN CORE (ESQUEMA DE CODIFICACIÓN) ............................................................................ 181
ÍNDICE DE TABLAS
TABLA 1. MATRIZ DE CONCEPTUALIZACIÓN. ................................................................................. 8
TABLA 2. TIEMPO EN GENERAR REPORTE SIN OPTIMIZACIÓN. .................................................. 9
TABLA 3. TIEMPO EN GENERAR REPORTE OPTIMIZADO. ........................................................... 10
TABLA 4. EQUIVALENCIAS DE ALGORITMOS CON POSTGRES 9.0, SQL SERVER 2008 R2 Y
ORACLE 10G ............................................................................................................................................ 23
TABLA 5. GRUPOS DE PRUEBAS. ........................................................................................................ 24
TABLA 6. MATERIALES. ....................................................................................................................... 25
TABLA 7. PRESUPUESTO ...................................................................................................................... 42
ÍNDICE DE GRÁFICOS
GRÁFICO 1. RESULTADOS DE TIEMPO DE RESPUESTAS. ............................................................ 10
GRÁFICO 2 FUENTE: BRUCE MOMJIAN, POSTGRESQL INTERNALS TROUGH PICTURES. ... 13
GRÁFICO 3 FUENTE: BRUCE MOMJIAN, POSTGRESQL INTERNALS TROUGH PICTURES. ... 14
GRÁFICO 4 FUENTE: BRUCE MOMJIAN, POSTGRESQL INTERNALS TROUGH PICTURES. ... 14
GRÁFICO 5. PRUEBAS SELECT EN POSTGRES 9.0 CON UN MILLÓN DE DATOS. .................... 27
GRÁFICO 6. PRUEBAS SELECT EN POSTGRES 9.0 CON CINCO MILLONES DE DATOS .......... 27
GRÁFICO 7. PRUEBAS UPDATE EN POSTGRES 9.0 CON UN MILLÓN DE DATOS. ................... 28
GRÁFICO 8. PRUEBAS UPDATE EN POSTGRES 9.0 CON CINCO MILLONES DE DATOS. ........ 28
GRÁFICO 9. PRUEBAS DELETE EN POSTGRES 9.0 CON UN MILLÓN DE DATOS. .................... 29
GRÁFICO 10. PRUEBAS DELETE EN POSTGRES 9.0 CON CINCO MILLONES DE DATOS. ....... 29
GRÁFICO 11. PRUEBAS INSERT EN POSTGRES 9.0 CON UN MILLÓN DE DATOS. ................... 30
GRÁFICO 12. PRUEBAS INSERT EN POSTGRES 9.0 CON CINCO MILLONES DE DATOS. ........ 30
GRÁFICO 13. PRUEBAS SELECT EN SQL SERVER 2008 CON UN MILLÓN DE DATOS. ........... 32
GRÁFICO 14. PRUEBAS SELECT EN SQL SERVER 2008 CON CINCO MILLONES DE DATOS. 32
GRÁFICO 15. PRUEBAS UPDATE EN SQL SERVER 2008 CON UN MILLÓN DE DATOS. .......... 33
GRÁFICO 16. PRUEBAS UPDATE EN SQL SERVER 2008 CON CINCO MILLONES DE DATOS. 33
GRÁFICO 17. PRUEBAS DELETE EN SQL SERVER 2008 CON UN MILLÓN DE DATOS. ........... 34
GRÁFICO 18. PRUEBAS DELETE EN SQL SERVER 2008 CON CINCO MILLONES DE DATOS. 34
GRÁFICO 19. PRUEBAS INSERT EN SQL SERVER 2008 CON UN MILLÓN DE DATOS. ............ 35
GRÁFICO 20. PRUEBAS INSERT EN SQL SERVER 2008 CON CINCO MILLONES DE DATOS. . 35
GRÁFICO 21. PRUEBAS SELECT EN ORACLE 10G CON UN MILLÓN DE DATOS. .................... 36
GRÁFICO 22. PRUEBAS SELECT EN ORACLE 10G CON CINCO MILLONES DE DATOS. ......... 36
GRÁFICO 23. PRUEBAS UPDATE EN ORACLE 10G CON UN MILLÓN DE DATOS. ................... 37
GRÁFICO 24. PRUEBAS UPDATE EN ORACLE 10G CON CINCO MILLONES DE DATOS. ........ 37
GRÁFICO 25. PRUEBAS DELETE EN ORACLE 10G CON UN MILLÓN DE DATOS. .................... 38
GRÁFICO 26. PRUEBAS DELETE EN ORACLE 10G CON CINCO MILLONES DE DATOS. ......... 38
GRÁFICO 27. PRUEBAS INSERT EN ORACLE 10G CON UN MILLÓN DE DATOS. ..................... 39
GRÁFICO 28. PRUEBAS INSERT EN ORACLE 10G CON CINCO MILLONES DE DATOS. .......... 39
GRÁFICO 29. GRÁFICO DE MEDIAS EN DBMS CON 1 MILLON DE DATOS ............................... 40
GRÁFICO 30. DE MEDIAS EN DBMS CON 5 MILLONES DE DATOS ............................................. 41
GRÁFICO 31. DIAGRAMA DE LA BASE DE DATOS ........................................................................ 45
GRÁFICO 32 RESULTADO CON 1 MILLÓN DE DATOS EN POSTGRES 9.0. ................................. 62
GRÁFICO 33. RESULTADO CON 5 MILLONES DE DATOS EN POSTGRES 9.0. .......................... 62
GRÁFICO 34 RESULTADO CON 1 MILLÓN DE DATOS EN SQL SERVER 2008 R2. .................... 63
GRÁFICO 35. RESULTADO CON 5 MILLONES DE DATOS EN SERVER 2008 R2. ...................... 63
GRÁFICO 36 RESULTADO CON 1 MILLÓN DE DATOS EN ORACLE 10G. ................................... 64
GRÁFICO 37. RESULTADO CON 5 MILLONES DE DATOS EN ORACLE 10G. ............................. 64
GRÁFICO 38. RECURSOS UTILIZADOS EN POSTGRES 9.0 POR SENTENCIAS ........................... 75
GRÁFICO 39. RECURSOS UTILIZADOS EN SQL SERVER 2008 R2 POR SENTENCIAS SQL ...... 75
GRÁFICO 40. RECURSOS UTILIZADOS EN ORACLE 10G POR SENTENCIAS SQL CON 1
MILLÓN DE DATOS. ............................................................................................................................... 76
1
1. RESUMEN
El objetivo de este proyecto fue determinar cómo mejora el rendimiento del tiempo de
respuesta de operaciones complejas escritas en el Lenguaje de Consulta Estructurado (SQL),
que pasan por un proceso de optimización en el gestor de base de datos POSTGRE 9.0
corriendo en una plataforma de sistema operativo WINDOWS 7.
Para este propósito se utilizó una sección de una base de datos creada para contener
información acerca de catastro urbano y rural. Ésta sección contenía tablas con el mayor
número de relaciones posibles. A partir de estas tablas se crearon procedimientos
almacenados que generaron millones de registros que se utilizaron en las pruebas de tiempo
de respuesta. Además, se crearon veinte requerimientos de consulta por cada operación
básica de SQL (SELECT, INSERT, UPDATE, DELETE) y cada una de ellas pasó por dos
procesos de optimización.
Los resultados evidenciaron que es posible mejorar los tiempos de respuesta mediante la
optimización de las sentencias. Sin embargo, fue posible observar que esta mejoría tiene un
límite, el mismo que podría estar muy próximo al segundo nivel de optimización. Por otra
parte, las sentencias optimizadas para POSTGRE no dieron los mismos resultados en otros
gestores de base de datos como ORACLE y SQL Server 2008 R2.
2
2. SUMMARY.
The objective of this project was to determine how to improve the response time
performance of complex operations written in Structured Query Language (SQL), which go
through a process of optimization in the database manager POSTGRE 9.0 running on a
platform WINDOWS 7 operating system.
For this purpose we used a section of a database created to contain information about urban
and rural cadastre. This section contains tables with the largest number of possible
relationships. From these tables were created stored procedures that generated millions of
records that were used in the tests of response time. In addition, consultation requirements
established twenty per basic operation of SQL (SELECT, INSERT, UPDATE, DELETE)
and each of them went through two processes optimization.
The results showed that it is possible to improve response times by optimizing the sentences.
However, it was observed that this improvement is limited, it could be very close to the
second level of optimization. Moreover, the statements were not optimized for POSTGRE
the same results in other database managers such as Oracle and SQL Server 2008 R2.
3. INTRODUCCIÓN
3
La información es una de los activos más importantes de toda organización, motivo por el
cual desde tiempos antiguos se ha buscado la forma de conservarla y recuperarla, utilizando
diversas maneras de almacenamiento. Al principio, la forma más común de almacenamiento
de información consistía en el sistema de ficheros secuenciales1, los que para obtener
información desde este tipo se necesitaba que se escribiera un programa2 para una
determinada consulta.
Luego surgieron los ficheros indexados3 donde el acceso a los datos ya podía ser de modo
aleatorio4, este tipo de fichero se manejaba utilizando estructuras de datos los cuales
permitían extraer información5 por medio de un campo determinado en la estructura.
En base a los requerimientos de los usuarios en lo referente al manejo de los sistemas de
ficheros de datos y a la gran cantidad de información que ya se empezaba a generar en las
organizaciones, la administración fue más difícil cada día, por lo que se hizo necesario un
nuevo sistema que permitiera almacenar la información de una mejor manera, a causa de
este problema surgieron las bases de datos jerárquicas6. La forma de acceder a la
información de cada registro era de modo unidireccional y se utilizaba programas con
algoritmos basados en árboles para hacer la búsqueda de un registro determinado, lo que
optimizó la organización de las bases de datos y, por ende, los tiempos de respuestas de las
operaciones fueron aceptables.
En las bases de datos jerárquicas, queda en manos de las aplicaciones garantizar que se
cumplan las condiciones requeridas para que funcionen de una manera correcta. Para dar
solución a este problema y obtener absoluta libertad al acceso a los datos, surgieron los
1 FICHEROS SECUENCIALES.- Son archivos que están diseñados para procesar de manera eficiente registros en un determinado orden basándose en alguna clave de búsqueda, para permitir
una recuperación rápida de registros en el orden de la clave de búsqueda, los registros se encadenan por medio de punteros. El puntero de cada registro apunta al siguiente registro en el orden de
la clave de búsqueda. Henry F. Korth y Abraham Silberschatz, Fundamentos de bases de datos, McGraw-Hill, Segunda Edición. Página. 245.
2 OBTENER DATOS EN FICHEROS SECUENCIALES.- Desde el punto de vista de los usuarios finales, los sistemas de ficheros fueron un gran avance comparado a los sistemas manuales.
a consecuencia de esto, creció la necesidad de crear distintos tipos de consultas de datos. sin embargo, los sistemas de ficheros son muy dependientes del programador de aplicaciones: cualquier
consulta o informe que se quiera realizar debe ser programado. Mercede Marqués, Apuntes de ficheros y bases de datos 2001.
3 FICHEROS INDEXADOS.- Para permitir el acceso aleatorio rápido los registros de un archivo se utiliza una estructura de índice. Cada estructura de índice está asociada a una clave de
búsqueda determinada. Henry F. Korth y Abraham Silberschatz, Fundamentos de bases de datos, McGraw-Hill, Segunda Edición Página. 260.
4 ALEATORIO.- Es un campo de definición que, en matemáticas, se asocia a todo proceso cuyo resultado no es previsible más que en razón de la intervención del azar. El resultado de todo
suceso aleatorio no puede determinarse en ningún caso antes de que este se produzca. El estudio de los fenómenos aleatorios queda dentro del ámbito de la teoría de la probabilidad y, en un
marco más amplio, en el de la estadística. David R. Anderson, Dennis J. Sweeney, Estadística para administración y economía 2008.
5 OBTENER DATOS EN BASE DE DATOS GERARQUICAS.-Es necesario escribir complejos programas de aplicación para responder a cualquier tipo de consulta de datos, por simple
que esta sea. Mercedes Marqués, Apuntes de ficheros y bases de datos 2001.
6 BASES DE DATOS JERÁRQUICAS.- Consiste en una colección de registros que se conectan entre sí por medio de enlaces. Cada registro es un conjunto de campos, cada uno de los cuales
contiene un solo valor. Un enlace es una asociación entre dos registros exclusivamente. Henry F. Korth y Abraham Silberschatz, Fundamentos de bases de datos, McGraw-Hill, Segunda Edición.
Página 643.
4
sistemas gestores de bases de datos relacionales7 (RDBMS), además aparece un nuevo
concepto denominado transacción8 con el cual se pueden efectuar operaciones sobre las
bases de datos.
Los RDBMS trajeron dos propiedades muy importantes:
1. ACID (Atomicidad9, Consistencia10, Aislamiento11 , Durabilidad12) es un
conjunto de características o propiedades que garantizan que las transacciones en
una base de datos sean fiables.
2. Un lenguaje de consultas denominado Structured Query Language13 (SQL).
Uno de los parámetros más importantes tomado en cuenta para el manejo de los datos en
toda organización es el tiempo de respuesta de las operaciones realizadas a la base de datos
especialmente aquellas que cuentan con millones de registros. Es de vital importancia tener
sistemas eficientes de bases de datos que obtengan resultados en el menor tiempo posible,
esto permite conseguir información eficaz a bajo costo.
Existen muchos parámetros a tomar en cuenta para minimizar el tiempo de respuesta en las
operaciones de bases de datos, como por ejemplo: el diseño de estos, la estructura de la
sentencia SQL, el RDBMS, entre otros. Cualquiera de ellos podría afectar
considerablemente al buen rendimiento de una aplicación.
Este estudio analiza cómo afecta al tiempo de respuesta de las operaciones que se desean
ejecute el motor de la base de datos por medio de las sentencias SQL que no pasan por un
proceso de optimización.
7 SISTEMAS ADMINISTRADORES BASES DE DATOS RELACIONALES (RDBMS).- Las bases de datos relacionales se basan en el modelo relacional y usan un conjunto de tablas
para representar tanto los datos como las relaciones entre ellos. también incluyen un lenguaje de manipulación de datos y un lenguaje de definición de datos. La mayor parte de los sistemas
relacionales comerciales emplean el lenguaje SQL. Silberchatz, Korth, Sudarshan, Fundamentos de bases de datos, McGraw-Hill quinta edición página 9.
8 TRANSACCIÓN.- Es una unidad de la ejecución de un programa que accede y posiblemente actualiza varios elementos de datos. Una transacción se inicia con la ejecución de un programa
de usuario escrito en un lenguaje de manipulación de datos de alto nivel o en un lenguaje de programación. Y está delimitado por instrucciones de principio y fin de transacción. Silberchatz,
Korth, Sudarshan, Fundamentos de bases de datos, McGraw-Hill, quinta edición Página 507.
9 ATOMICIDAD.- Es una propiedad que indica que todas las operaciones de la transacción se deben realizar de manera adecuada en la base de datos o ninguna de ellas. Silberchatz, Korth,
Fundamentos de bases de datos, McGraw-Hill, quinta edición Sudarshan página 507.
10 CONSISTENCIA.- Es ejecutar las operaciones de una transacción de manera aislada para evitar la inconsistencia datos en la base de datos. Fundamentos de bases de datos quinta edición
Silberchatz, Korth, Sudarshan página 507.
11 AISLAMIENTO.- Una transacción es una unidad de aislamiento, permitiendo que transacciones concurrentes se comporten como si cada una fuera una única transacción que se ejecuta en el
sistema. Silberchatz, Korth, Sudarshan, Fundamentos de bases de datos, McGraw-Hill, quinta edición Página 508.
12 DURABILIDAD.- Tras la finalización con éxito de una transacción, los cambios realizados en una base de datos permanecen, incluso si hay fallos en el sistema. Silberchatz, Korth,
Sudarshan, Fundamentos de bases de datos, McGraw-Hill, quinta edición Página 508.
13 SQL (Structured Query Language, Lenguaje Estructurado De Consulta).- Es un lenguaje surgido de un proyecto de investigación de IBM para el acceso a bases de datos relacionales.
Actualmente se ha convertido en un estándar de lenguaje de bases de datos, y la mayoría de los sistemas de bases de datos lo soportan, desde sistemas para ordenadores personales, hasta grandes
ordenadores. Silberchatz, Korth, Sudarshan, Fundamentos de bases de datos, McGraw-Hill, cuarta edición 2002 Página 107.
5
4. JUSTIFICACIÓN.
En nuestro medio, los profesionales del área de informática diseñan sistemas de bases de
datos para organizaciones pequeñas, que normalmente no manejan grandes volúmenes de
información. Por este motivo es inusual que se le dé la importancia que amerita el
refinamiento de las sentencias SQL. Por lo tanto, se tiene poco conocimiento de cómo
responderían los sistemas, si estos estuvieran poblados con millones de registros. Esta falta
de previsión en lo posterior podría ocasionar gastos y pérdida de tiempo en las
organizaciones por cuanto se tendrán que hacer cambios en el sistema para obtener los
tiempos de respuestas esperados.
En la Escuela de Ingeniería en Sistemas de la Facultad de Ciencias de la Ingeniería de la
Universidad Técnica Estatal de Quevedo, escasas veces se evalúa el rendimiento de los
sistemas (enviados como proyectos) con bases de datos poblados de millones de registros; lo
que hace que los futuros profesionales desconozcan este detalle fundamental para la
eficiencia de los sistemas. Es conveniente realizar un estudio sobre este tópico, que sirva
como fundamento para los estudiantes y profesionales del área, con el cual tengan una
evidencia sustancial que les permita considerar estos aspectos al momento de diseñar la
sentencias SQL (que satisfagan los requerimientos de la aplicación) cuando realicen sus
proyectos profesionales.
5. OBJETIVOS.
5.1 OBJETIVO GENERAL.
Determinar en qué porcentaje mejora el rendimiento del tiempo de respuesta de sentencias
SQL complejas, que pasan por un proceso de optimización usando una base de datos
poblada de millones de registros.
6
5.2 OBJETIVOS ESPECÍFICOS.
✓ Crear procedimientos almacenados y generar de manera automática, millones de registros
para ser utilizados en la comprobación del menor tiempo de respuesta.
✓ Aplicar distintas sentencias SQL para satisfacer un requerimiento funcional, midiendo el
tiempo de respuesta de las mismas.
✓ Crear sentencias SQL complejas optimizadas para la obtención de datos.
6. PROBLEMA DE INVESTIGACIÓN.
6.1 PROBLEMATIZACIÓN.
Dentro del ámbito de desarrollo de sistemas, uno de los tópicos fundamentales para la
construcción de las aplicaciones, es la que corresponde al manejo de los datos. El ingeniero
en sistemas inicia su actividad (para desarrollar un software) captando los requerimientos de
la organización, es decir, empapándose cuáles son los problemas que desea resolver la
organización por medio del sistema. Los requerimientos pueden ser clasificados en
funcionales y del sistema. Los requerimientos funcionales se refieren a la entrada, salida,
mantenimiento y estancia de los datos a través de formularios. Los requerimientos
operacionales se orientan a qué tiempos de respuesta debe ceñirse el manejo de los datos.
Concretamente podemos decir que quien está realizando un sistema debe saber qué datos
seleccionar14 insertar15 , actualizar16 o eliminar17 y en qué tiempo debe estar la respuesta.
El manejo de los datos tiene básicamente tres elementos que son: El sistema gestor de bases
de datos, el diseño de la base de datos y las sentencias para realizar las operaciones. Existen
otros factores que afectan al manejo de los datos tal como los sistemas operativos, la
conectividad de las redes, etc.
Un mal diseño del esquema base de datos, afecta de manera general al rendimiento en una
base de datos, lógicamente al rendimiento del sistema. Esto ocurre puesto que en muchos
14 Seleccionar (Select).- Es una manera sencilla de recuperar datos de una base de datos. puede ser una sola tabla, de un grupo de tablas relacionadas, de tablas que existen en otras bases de
datos. Rob Hawthorne, Desarrollo de base de datos MS SQL 2000.
15 Insertar (insert).- Permite agregar nuevos valores a una tabla de la base de datos. podemos insertar filas completas a la vez. Rob Hawthorne, Desarrollo de base de datos MS SQL 2000.
16 Actualizar (Update).- Una sentencia UPDATE de SQL es utilizada para modificar uno o más valores de un conjunto de registros existentes en una tabla. Rob Hawthorne, Desarrollo de base
de datos MS SQL 2000.
17 Eliminar (Delete).- Permite eliminar uno o más registros de una tabla en una base de datos. Se debe especificar mediante una condición que datos eliminar. Rob Hawthorne, Desarrollo de
base de datos MS SQL 2000.
7
casos hay que hacer sentencias SQL demasiado complejas que utilizan muchos recursos lo
que hace que la respuesta sea lenta.
Debido a la poca atención de las sentencias SQL, puede ocurrir que sentencias que
consumen muchos recursos para su ejecución, pueden ser optimizadas de manera que
permita un mejor desempeño de los DBMS y las operaciones se ejecuten con mayor
velocidad.
El escribir sentencias SQL embebidas en el lenguaje de programación de las aplicaciones y
no en el sistema gestos de base de datos afecta al tiempo de respuesta en consulta y también
retarda el mantenimiento del sistema.
Para crear las sentencias18 que realizan las operaciones en la base de datos se utiliza el
Lenguaje de Consulta Estructurado conocido como SQL (es prácticamente de uso
universal); sin embargo, es importante observar que el objetivo de una operación puede ser
implementado con diferentes sentencias SQL que no necesariamente responderán con el
mismo tiempo de ejecución (de la sentencia) para realizar la operación. Esto significa que es
gravitante para el cumplimiento de los requisitos funcionales y del sistema que las
operaciones a los datos sean implementadas en sentencias SQL bien estructuradas tanto en
operaciones sencillas como complejas.
Construir todas las sentencias SQL (en especial las complejas) para efectuar operaciones con
los datos y posteriormente pasar a un proceso de optimización de cada una de estas requiere
de un esfuerzo intelectual considerable y de una buena cantidad de tiempo que contribuye a
consumir recursos en el desarrollo del sistema.
6.2 FORMULACIÓN DEL PROBLEMA.
¿La optimización de las sentencias SQL complejas de una aplicación produce tiempos de
respuestas más rápidas que mejoran el rendimiento del sistema?
18 SENTENCIAS.- Una sentencia SQL es como una frase (comúnmente escrita en inglés) con la que decimos lo que queremos obtener y de donde obtenerlo. Todas las sentencias empiezan con
un verbo (palabra reservada que indica la acción a realizar), seguido del resto de cláusulas, algunas obligatorias y otras opcionales que completan la frase. Todas las sentencias siguen una sintaxis
para que se puedan ejecutar correctamente. Vértice S.L., Aplicaciones avanzadas de Access en la gestión del comercio Publicaciones.
8
7. HIPÓTESIS.
7.1 GENERAL.
La optimización de las sentencia SQL mejoran considerablemente el rendimiento del
tiempo de respuesta de las operaciones en una base de datos poblada con millones de
registros.
7.2 MATRIZ DE CONCEPTUALIZACIÓN.
TABLA 1. MATRIZ DE CONCEPTUALIZACIÓN.
8. MARCO TEÓRICO.
8.1 ESTUDIO REALIZADO POR EMPRESA EDINWARE.
Según Edinware19 en el estudio realizado por la empresa del Grupo GUSI20 ubicada en el
municipio de Tamuín México, la que tenía diferentes sistemas de información desarrollados por
personal de la misma empresa. Ellos analizaron la aplicación Deshuese, que controlaba la
información desde que la carne era recibida, procesada, almacenada y embarcada. Uno de los
principales problemas de este sistema era el tiempo utilizado para la generación de algunos
reportes.
El reporte consta de 3 partes, un encabezado donde se muestra información del cliente de
destino, un detalle del producto que entró al proceso y otro del producto final luego de haber
sido procesado. La ejecución de este reporte tardaba un tiempo considerable para mostrar el
resultado, tal como se observa en la siguiente tabla:
19 EDINWARE.- Es una empresa de tecnología informática(TI), especializada en servicios de Optimización de Desempeño, Alta Disponibilidad y Planeación de Capacidad para Sistemas de
Información de empresas medianas y grandes. Ubicada en Molino 40 #37 Local 7 Col. Buenos Aires, Monterrey N.L. México C.P. 64800 con web site: http://www.edinware.com/
20 GRUPO GUSI.- Es una empresa que Ofrece productos cárnicos de calidad que cumplen las especificaciones de los clientes así como las normas oficiales aplicables, logrando productividad,
eficiencia y rentabilidad, a través de la aplicación de la mejora continua y un sistema de gestión de la calidad que cumpla con la Norma Internacional ISO 9001:2000, promoviendo el desarrollo
integral del personal y minimizando el impacto ambiental. Dirección: Tamuín S.L.P. México con sitio web: http://www.grupogusi.com.mx
VARIABLES DEFINICIÓN CONCEPTUAL DIMENSIÓN INDICADOR
Tiempo
Es la magnitud física con la que
medimos la duración o separación
de acontecimientos sujetos a
cambio.
✓ Costo del
plan de
ejecución
✓ Recursos
utilizados
✓ Tiempo de
respuesta en la
ejecución de la
sentencia
9
Lote de
prueba
Tiempos (mm:ss)
2289 03:00
1788 03:54
869 03:25
1974 03:01
2090 03:02
TABLA 2. TIEMPO EN GENERAR REPORTE SIN OPTIMIZACIÓN.
Para mejorar el tiempo de respuesta en la obtención resultados por medio de reportes se
procedió a la aplicación de las siguientes etapas:
1. Esquema de Base de Datos21.- Modificaron el esquema, aplicando reglas de
normalización a varias tablas, las cuales consisten en la inserción de datos redundantes a
través de la creación de nuevas columnas en varias de ellas para reducir la cantidad de las
mismas, combinadas en las consultas utilizadas para la generación del reporte.
2. Query Redefine22.- Se analizó la lógica de las consultas que generan el reporte y se
realizaron modificaciones para eliminar la utilización de cursores y consultar la
información directamente de las tablas base en lugar de hacerlo a través de vistas o
funciones recursivas que hacían más lenta la consulta de la información.
3. Indexing23.- Se analizó y diseñó una configuración en los índices para obtener el mayor
beneficio en todas las sub-consultas utilizadas para la generación del reporte.
4. Isolate24.- Se configuró el nivel de aislamiento de las transacciones para permitir mayor
grado de concurrencia entre los usuarios que utilizan este reporte.
Luego de haber realizado las modificaciones en cada una de las etapas de la metodología, los
tiempos obtenidos para la generación del reporte se muestran en la siguiente tabla.
21 ESQUEMA DE BASE DE DATOS.- (en Inglés Data base Schema) Describe la estructura de una Base de datos, en un lenguaje formal soportado por un Sistema administrador de Base de
datos RDBMS. En una Base de datos Relacional, el Esquema define sus tablas, sus campos en cada tabla y las relaciones entre cada campo y cada tabla. Henry F. Korth y Abraham Silberschatz,
Fundamentos de bases de datos, McGraw-Hill, Segunda Edición Página 4.
22QUERY REDEFINE.- Se trata de redefinir una determinada consulta de tal manera que permita obtener el mismo resultado pero de manera más optima.
23 INDEXING.- Indexación Los registros de una base de datos quedan grabados de forma secuencia, la indexación permite listar la información de forma ordenada según un criterio
determinado o condición. Informática y comunicaciones en la empresa Carmen de Pablo Heredero 2004.
24 ISOLATE (Aislamiento).- Una transacción es una unidad de aislamiento, permitiendo que transacciones concurrentes se comporten como si cada una fuera una única transacción que se
ejecuta en el sistema. Silberchatz, Korth, Sudarshan, Fundamentos de bases de datos, McGraw-Hill quinta edición página 508.
10
Lote de
prueba
Tiempos
(mm:ss)
2289 00:14
1788 00:21
869 00:18
1974 00:16
2090 00:15
TABLA 3. TIEMPO EN GENERAR REPORTE OPTIMIZADO.
Según el análisis llevado por la empresa, concluyeron en que cada uno de los cambios realizados
en las diferentes etapas de la metodología, contribuye sin lugar a dudas a la optimización de los
procesos que utilizan la base de datos. En el gráfico 1, se muestran los resultados de los reportes
antes y después de ser aplicada la metodología de optimización.
GRÁFICO 1. RESULTADOS DE TIEMPO DE RESPUESTAS.
8.2 SEGÚN LUCAS FORCHINO 25
Comenta que cada día se necesita procesar mayor cantidad de datos y obtener de manera más
rápida y precisa la información. Muchos de los problemas de rendimiento se deben entre otras
cosas al hardware, software, sistema gestor de base de datos y por sobre todo al diseño, índices y
mala formulación de consultas SQL. Expresa que es posible mejorar significativamente el
tiempo de respuesta de nuestro sistema gestor de base de datos. A continuación recomienda lo
siguiente:
25 LUCAS FORCHINO.- Ingeniero en sistemas desarrollador de software en general, Redes y páginas web con dirección en Argentina, Córdoba Extremadura 2485.
11
Etapa de diseño de la base de datos
✓ Las tablas normalizadas reducen al mínimo el espacio ocupado por nuestra base de datos y
permiten asegurar la consistencia de la información, al mismo tiempo que son muy rápidas
para la realización de transacciones, pero generan un mayor tiempo de respuesta a la hora de
consultarlas, ya que se deben realizar generalmente la unión de varias tablas, por lo que en
caso de necesidad de altas velocidades de respuesta con grandes volúmenes de datos un
modelo desnormalizado es conveniente.
✓ Ajustar al máximo el tamaño de los campos ayuda a no desperdiciar espacio.
✓ Eliminar todo campo que no sea de utilidad, ya que por más que no contenga datos genera
retrasos.
✓ Los índices son campos que permiten la búsqueda a partir de dicho campo a una velocidad
notablemente superior. Sin embargo cuentan con la desventaja que hacen más lenta la
actualización, carga y eliminación de los registros ya que por cada modificación en la tabla
se deberá actualizar también el índice, además se debe tener en cuenta el hecho de que los
índices también ocupan espacio en el disco. Es por esto que no es factible indexar todos los
campos de la base de datos, y se deben seleccionarlos cuidadosamente. Cabe destacar que
por defecto las tablas no contienen índices, por lo que la introducción de éstos puede llegar
a producir mejoras de más del 100% en algunos casos.
Los campos que se recomiendan indexar son:
o Claves Primarias
o Claves Foráneas
o Campos por los cuales se realizaran búsquedas
o Campos por los cuales se va a ordenar
Conviene indexar tablas con gran cantidad de registros y que van a ser consultadas con más
frecuencia.
12
Donde escribir las sentencias
✓ Siempre es preferible utilizar consultas almacenadas dentro del sistema gestor de base de
datos y no dentro de la aplicación, una consulta almacenada en un procedimiento
almacenado, se ejecuta más rápido y directamente sobre la base de datos que cualquier
consulta externa.
✓ Muchas de las aplicaciones sobre todo de reporting permiten unir y realizar los JOINS y
consultas directamente en la herramienta produciendo una baja de performance realmente
considerable. Lo correcto y más eficiente seria generar la consulta en un STORE
PROCEDURE 26 con todos los JOINS y guardar el resultado en una tabla temporal, de
donde posteriormente el reporte solo deberá mostrar los datos sin necesidad de trabajarlos
primero. Dependiendo los JOINS que intervengan y los registros involucrados se pude
mejorar drásticamente la performance, han habido casos en que reportes que duraban 3 min
en generarse pasaron a 30 seg., usando esta técnica.
Acerca de la formulación de las consultas:
A la hora de ejecutar una consulta SQL la forma en que ésta es expresada, afecta directamente al
motor de BD, pequeños cambios pueden significar la ganancia de muchos segundos o minutos
que el usuario debe esperar al momento de ejecutar la consulta. Algunas recomendaciones son:
✓ No utilizar SELECT * porque el motor debe leer primero la estructura de la tabla antes de
ejecutar la sentencia.
✓ Seleccionar solo aquellos campos que se necesiten, cada campo extra genera tiempo extra.
✓ Utilizar INNER JOIN, LEFT JOIN, RIGHT JOIN, para unir las tablas en lugar del
WHERE, esto permite que a medida que se declaran las tablas se vayan uniendo mientras
que si utilizamos el WHERE el sistema gestor de base de datos, genera primero el
producto cartesiano de todos los registros de las tablas para luego filtrar las correctas, un
trabajo definitivamente lento.
✓ Especificar el alias de la tabla delante de cada campo definido en el SELECT, esto le
ahorra tiempo al motor de tener que buscar a que tabla pertenece el campo especificado.
26 STORE PROCEDURE.- Los procedimientos de una base de datos correspondientes a un conjunto de instrucciones SQL que se ejecutan con una llamada a su nombre. pueden recibir
parámetros y reenviar valores. los procedimientos almacenados se graban en la cache del servidor, compilados, durante su primera ejecución lo que aumenta el rendimiento para las siguientes
ejecuciones. Jerome Gabillaud, SQL server 2005: SQL, Transact SQL, Cuarta Edición, año 2006.
13
✓ Evitar el uso del operador cast y fórmulas dentro de consultas, cada fórmula y casteo
retrasan el motor considerablemente.
El orden de ubicación las tablas en el FROM deberían ir en lo preferible de menor a mayor según
el número de registros, de esta manera reducimos la cantidad de revisiones de registros que
realiza el sistema gestor de base de datos al unir las tablas a medida que se agregan.
Estos estudios demuestran la importancia de estructurar las sentencias SQL para realizar las
operaciones que hacen necesario el uso de la bases de datos.
8.3 ALGORITMOS DE RESOLUCION DE SENTENCIAS SQL
Los algoritmos de resolución de sentencias SQL, son los encargados de la forma como el gestor
de base de datos resuelve las operaciones entre registros de una o varias tablas en una base de
datos.
Puesto que cada gestor de base de datos emplea su forma de resolver las sentencias SQL, esto
conlleva a que si ejecuto una sentencia SQL en POSTGRES, y esta se encuentra con un grado de
optimización aceptable hablando del tiempo de respuesta, los mismos resultados, pueden variar
para gestores de base de datos como SQL server y ORACLE.
8.3.1 ALGORITMOS UTILIZADOS EN POSTGRES 9.0 DURANTE LAS PRUEBAS.
8.3.1.1 Nested Loop.
Cruce de iteración anidada (nested loop) ver (Gráfico 2): la relación derecha se recorre para cada
tupla encontrada en la relación izquierda. Esta estrategia es fácil de implementar pero puede
consumir mucho tiempo.
GRÁFICO 2 FUENTE: BRUCE MOMJIAN, POSTGRESQL INTERNALS TROUGH PICTURES.
14
8.3.1.2 Merge-Join.
Cruce de ordenación mezclada (Merge Join) ver (Gráfico 3): cada relación es ordenada por los
atributos del cruce antes de iniciar el cruce mismo. Después se mezclan las dos relaciones
teniendo en cuenta que ambas relaciones están ordenadas por los atributos del cruce. Este
modelo de cruce es más rápido que nested loop porque cada relación debe ser barrida sólo una
vez.
GRÁFICO 3 FUENTE: BRUCE MOMJIAN, POSTGRESQL INTERNALS TROUGH PICTURES.
8.3.1.3 Hash-Join.
Cruce indexado (Hash Join) ver (gráfico 4): la relación de la derecha se indexa primero sobre sus
atributos para el cruce y se carga en una tabla hash. A continuación, se barre la relación
izquierda, y los valores apropiados de cada tupla encontrada y luego se utilizan como clave
indexada para localizar las tuplas de la relación derecha.
GRÁFICO 4 FUENTE: BRUCE MOMJIAN, POSTGRESQL INTERNALS TROUGH PICTURES.
15
8.3.2 ALGORITMOS UTILIZADOS EN SQL SERVER 2008 R2 DURANTE
LAS PRUEBAS.
8.3.2.1 Table Delete.
El operador físico Table Delete elimina filas de la tabla especificada en la columna Argument
del plan de ejecución de consultas.
8.3.2.2 Assert.
El operador Assert comprueba una condición. Por ejemplo, valida la integridad referencial o se
asegura de que una subconsulta escalar devuelve una fila. Por cada fila de entrada, el operador
Assert evalúa la expresión de la columna Argument del plan de ejecución. Si la expresión da
como resultado NULL, la fila se pasa a través del operador Assert y continúa la ejecución de la
consulta. Si la expresión da como resultado un valor distinto a NULL, se generará el error
apropiado.
8.3.2.3 Computer Scalar.
El operador Compute Scalar evalúa una expresión para generar un valor escalar calculado que
se puede devolver al usuario, hacer referencia a él en cualquier otra parte de la consulta, o ambas
cosas a la vez, por ejemplo, en un predicado de filtro o de combinación.
8.3.2.4 Bitmap.
Un filtro de mapas de bits utiliza una representación compacta de un conjunto de valores de una
tabla, en una parte del árbol de operadores para filtrar filas de una segunda tabla en otra parte del
árbol. Si se quitan las filas innecesarias de la consulta en una fase temprana, los operadores
subsiguientes tienen menos filas con las que hay que trabajar y el rendimiento global de la
consulta mejora. El optimizador determina cuándo un mapa de bits es suficientemente selectivo
para resultar útil y en qué operadores se aplica el filtro.
8.3.2.5 Concaternation
El operador Concatenation explora varias entradas y devuelve cada fila explorada. Normalmente,
Concatenation se utiliza para implementar la construcción UNION ALL de Transact-SQL. El
operador físico Concatenation tiene dos o más entradas y una salida. Concatenation copia filas de
16
la primera secuencia de entrada en la secuencia de salida y, a continuación, repite esta operación
con cada secuencia de entrada adicional.
8.3.2.6 Filter.
El operador Filter recorre la entrada y sólo devuelve las filas que cumplen la expresión del filtro
(predicado) que aparece en la columna Argument.
8.3.2.7 Hash Match.
El operador hash match genera una tabla hash calculando un valor hash para cada fila de su
entrada de generación. En la columna argument aparece un predicado hash con una lista de las
columnas utilizadas para crear un valor hash. A continuación, por cada fila de sondeo (como
corresponda), calcula un valor hash (con la misma función hash) y busca las coincidencias en la
tabla hash.
8.3.2.8 Clustered Index Insert.
Inserta filas desde su entrada en el índice clúster especificado en la columna Argument. La
columna Argument también contiene un predicado SET:(), que indica el valor en el que se
establece cada columna. Si Clustered Index Insert no tiene elementos secundarios para los
valores de inserción, se obtendrá la fila insertada del mismo operador Insert.
8.3.2.9 Clustered Index Scan.
El operador clustered index scan examina el índice clúster especificado en la columna argument
del plan de ejecución de consulta. Si hay un predicado where, sólo se devuelven las filas que lo
cumplen.
8.3.2.10 Clustered Index Seek.
Utiliza la capacidad de búsqueda de los índices para recuperar filas de un índice clúster. La
columna argument contiene el nombre del índice clúster que se va a utilizar y el predicado seek.
El motor de almacenamiento utiliza el índice para procesar solamente las filas que cumplen el
predicado seek.
17
8.3.2.11 Nonclustered Index Spool.
El operador físico index spool contiene un predicado seek en la columna argument. El operador
index spool recorre sus filas de entrada, coloca una copia de cada fila en un archivo de cola
oculto (almacenado en la base de datos tempdb y que sólo existe durante la vigencia de la
consulta) y genera un índice no agrupado en las filas. Esto permite utilizar la capacidad de
búsqueda de los índices para presentar sólo las filas que cumplan el predicado seek.
8.3.2.12 Nonclustered Index Update.
Es un operador físico que actualiza las filas de su entrada en el índice no agrupado especificado
en la columna argument. Si hay un predicado set, cada columna actualizada se establece en este
valor.
8.3.2.13 Merge Join.
Realiza las siguientes operaciones lógicas de combinación interna (inner join), combinación
externa izquierda (left outer join), semicombinación izquierda (left semi join),
antisemicombinación izquierda (left anti semi join), combinación externa derecha (right outer
join), semicombinación derecha (right semi join), antisemicombinación derecha (right anti semi
join) y unión (union).
8.3.2.14 Nested Loop.
Realiza las operaciones lógicas combinación interna, combinación externa izquierda,
semicombinación izquierda y anti semicombinación. Las combinaciones de bucles anidados
buscan en la tabla interna cada fila de la tabla externa, normalmente mediante un índice.
Microsoft SQL Server decide, en función de los costos anticipados, si debe ordenar o no la
entrada externa para mejorar la ubicación de las búsquedas en el índice de la entrada interna.
8.3.2.15 Paralelismo.
Realiza las operaciones lógicas distribute streams, gather streams y repartition streams. Las
columnas argument pueden contener un predicado partition columns con una lista separada por
comas de las columnas que se van a particionar. Las columnas argument también pueden
contener un predicado order by, con una lista de las columnas que deben conservar el criterio de
ordenación durante la partición.
18
8.3.2.16 Proyecto de Secuencia.
Agrega columnas para realizar cálculos sobre un conjunto ordenado. Divide el conjunto de
entrada en segmentos basados en el valor de una o varias columnas. A continuación, el operador
genera la salida de un segmento cada vez. En el operador Sequence Project, las columnas se
muestran como argumentos.
8.3.2.17 Rid Lockup.
Es una búsqueda de marcadores en un montón, que utiliza un identificador de fila suministrado
(rid). La columna argument contiene la etiqueta de marcador utilizada para buscar la fila en la
tabla y el nombre de la tabla en la que se busca la fila. Rid lookup siempre está acompañado por
una instrucción nested loop join.
8.3.2.18 Row Count Spool.
El operador row count spool recorre la entrada, cuenta el número de filas que hay y devuelve ese
número de filas sin datos. Este operador se utiliza cuando es importante comprobar la existencia
de las filas, en lugar de los datos que éstas contienen.
8.3.2.19 Secuence.
Controla los planes de actualización grandes. Funcionalmente, ejecuta cada entrada en secuencia
(del principio al fin). Normalmente, cada entrada es una actualización de un objeto diferente.
Sólo devuelve las filas que proceden de su última entrada (inferior).
8.3.2.20 Segment.
Es un operador físico y lógico. Divide el conjunto de entrada en segmentos basados en el valor
de una o más columnas. Estas columnas se muestran como argumentos en el operador Segment.
El operador genera a continuación un segmento cada vez.
8.3.2.21 Sort.
Ordena todas las filas entrantes. La columna argument contiene un predicado distinct order by, si
esta operación elimina las réplicas, o un predicado order by, con una lista de las columnas,
separadas por comas, que se van a ordenar. Las columnas llevan como prefijo el valor asc, si el
orden de las columnas es ascendente, o el valor desc, si es descendente.
19
8.3.2.22 Split.
Se utiliza para optimizar el procesamiento de actualizaciones. Divide cada operación de
actualización en una operación de eliminación y una operación de inserción.
8.3.2.23 Stream Aggregate.
Agrupa las filas por una o varias columnas y, a continuación, calcula una o varias expresiones
agregadas devueltas por la consulta. Los operadores posteriores de la consulta pueden hacer
referencia al resultado de este operador, devolverse al cliente, o ambas cosas.
8.3.2.24 Table Value Function.
Evalúa una función con valores de tabla y almacena las filas resultantes en la base de datos
tempdb. Cuando los iteradores principales solicitan las filas, la función con valores de tabla
devuelve las filas desde tempdb.
8.3.2.25 Table Insert.
Inserta filas de su entrada en la tabla especificada en la columna argument del plan de ejecución
de consultas. La columna argument también contiene un predicado set, que indica el valor con el
que se establece cada columna.
8.3.2.26 Table Scan.
El operador table scan recupera todas las filas de la tabla especificada en la columna argument
del plan de ejecución de consultas. Si hay un predicado where en la columna argument, sólo se
devuelven las filas que cumplan el predicado.
8.3.2.27 Table Spool.
Recorre la entrada y coloca una copia de cada fila en una tabla de cola oculta almacenada en la
base de datos tempdb y que sólo existe durante la vigencia de la consulta. Si se hace retroceder el
operador (por ejemplo, mediante un operador nested loops) pero no es necesario volver a
enlazar, se utilizan los datos de la cola en lugar de volver a recorrer la entrada.
20
8.3.2.28 Table Update.
El operador físico table update actualiza filas de entrada de la tabla especificada en la columna
argument del plan de ejecución de consultas. El predicado set determina el valor de cada
columna actualizada. Se puede hacer referencia a estos valores en la cláusula set o en cualquier
parte del operador, y en cualquier parte de esta consulta.
8.3.2.29 Top.
Recorre la entrada y sólo devuelve el primer número o porcentaje especificado de filas,
basándose en un criterio de ordenación si es posible. Opcionalmente, la columna argument puede
contener una lista de las columnas en las que se comprueban los valores equivalentes.
8.3.3 ALGORITMOS UTILIZADOS EN ORACLE 10G DURANTE LAS PRUEBAS.
8.3.3.1 Merge Join.
Esta operación acepta dos conjuntos de filas, cada una, ordenada por un valor específico,
combinando cada fila de un conjunto con las filas coincidentes de la otra, y devolviendo el
resultado.
✓ Merge join outer: mezcla operaciones de combinación de combinación externa.
✓ Merge join anti: combina antijoin.
✓ Merge join semi: combina semiunión.
✓ Merge join cartesian: puede resultar de una o más de las tablas no tengan cualquiera de
las condiciones de unirse a las otras tablas en la sentencia.
8.3.3.2 Sort Aggregate.
La recuperación de una sola fila que es el resultado de aplicar una función de grupo a un grupo
de filas seleccionadas.
8.3.3.3 Sort Unique.
Operación de clasificación de un conjunto de filas para eliminar los duplicados.
21
8.3.3.4 Sort Group By.
Operación de clasificación de un conjunto de filas en grupos para una consulta con un group by
cláusula.
8.3.3.5 Sort Join.
Operación de clasificación de un conjunto de filas antes de una Merge Join.
8.3.3.6 Sort Order By.
Operación de clasificación de un conjunto de filas de una consulta con un ORDER BY cláusula.
8.3.3.7 view.
Operación de la realización de la consulta de una vista y luego regresar las filas resultantes a otra
operación.
8.3.3.8 Filter.
Operación de aceptar un conjunto de filas, elimina algunos de ellos, y devuelve el resto.
8.3.3.9 Index Fast Full Scan.
Recupera todos los ROWIDs (y valores de la columna) utilizando multibloques. Se pueden
definir sin orden de clasificación. Se compara a un escaneo completo de tabla sólo en las
columnas indizadas. Y es disponible solo en optimizadores basados en costos.
8.3.3.10 Index Full Scan.
Permite la recuperación de todos los ROWIDs de un índice cuando no hay iniciar o detener
clave. Los valores del índice se analizan en orden descendente o ascendente.
8.3.3.11 Index Range Scan.
Permite recuperar uno o más ROWIDs de un índice. Los valores del índice se analizan en orden
ascendente o descendente.
22
8.3.3.12 Hash Group By.
Operación de hash de un conjunto de filas en grupos para una consulta con una cláusula
group by.
8.3.3.13 Hash Join.
Es una operación de la unión de dos conjuntos de filas, devolviendo el resultado. Este método de
unión es útil para unir conjuntos de datos con grandes volúmenes ellos (DSS, por lotes). La
condición de unión es una manera eficiente de acceder a la segunda tabla.
El optimizador de consultas utiliza la menor de las dos tablas y fuentes de datos para construir
una tabla hash de la clave de combinación en la memoria. Luego se analiza la tabla más grande,
el sondeo de la tabla hash para encontrar las filas combinadas.
Estas son las operaciones de combinación:
✓ Hash join anti hash (izquierda) antijoin.
✓ Hash join semi hash (izquierda) semiunión.
✓ Hash join right anti antijoin derecho de hash.
✓ Hash join right semi semiunión derecho de hash.
✓ Hash join outer hash (izquierda) de combinación externa.
✓ Hash join right outer hash combinación externa derecha.
8.3.3.14 Nested Loop.
Esta Operación acepta dos conjuntos de filas, uno exterior y otro interior. Oracle compara cada
fila del conjunto exterior con cada fila del conjunto interior, volviendo filas que satisfacen una
condición.
8.3.3.15 Table Access Index Rowid.
Si se encuentran la tabla de particiones y las filas, entonces se utilizan el índice.
8.3.3.16 Table Access Full.
Realiza la recuperación de todas las filas de una tabla.
23
8.4 EQUIVALENCIAS DE ALGORITMOS.
AL
GO
RIT
MO
S E
QU
IVA
LE
NT
ES
EN
GE
ST
OR
ES
DE
BA
SE
S D
E
DA
TO
S.
DESCRIPCIÓN POSTGRES 9.0 SQL SERVER
2008 R2 ORACLE 10G
Union Hash
Hash
Hash Aggregate
Hash Join
Hash Semi Join
Has Match
Hash join
Hash Join Semi
Hash Unique
Hash Group by
Combinación de
mezcla Merge Join Merge Join
Merge Join
Merge Join
Cartesian
Merge Join Semi
Ordenar
Ascedente,
descendente
Sort Sort
Sort Group By
Sort Group by
Nosort
Sort Join
Sort Unique
Bucle Anidado
Nested loop
Nested loop
Semi Join
Nested loops Nested Loops
Nested Loops Semi
Filtro de campo Filter Filter
Escaneo de
Índice Index Scan
Clustered Index
Scan
Index Full Scan
Table acces by
Index Rowid
Escaneo
secuencial de
tabla
Seq. Scan Table Scan Table Acces Full
TABLA 4. EQUIVALENCIAS DE ALGORITMOS CON
POSTGRES 9.0, SQL SERVER 2008 R2 Y ORACLE 10G.
24
9. MÉTODOS Y MATERIALES.
9.1 METODOLOGÍA.
Como se trata de demostrar una hipótesis descriptiva se crearon tres grupos de pruebas con el fin
de comprobar la hipótesis.
Para llevar a cabo este análisis se utilizó un modelo de base de datos de catastro urbano y rural
del MUNICIPIO DE BUENAFE (Anexo 1); se partió del supuesto de que el diseño de la base
de datos estaba normalizado y optimizado (el diseño de la base de datos no es parte del estudio
planteado). El volumen de registros que contiene esta base de datos fue generado mediante un
procedimiento, en el cual estipulamos los millones de registros que se deseaban generar para las
pruebas. En este punto, se podrá iniciar la investigación con los grupos de pruebas; para este
efecto contamos con tres grupos de pruebas que son:
REQUERIMIETOS DE OPERACIONES
GRUPO 1 GRUPO 2 GRUPO3
Sentencia
SQL sin
optimización
Millones
De Datos
Tie
mpo
Sentencia SQL
primer
optimización
Millones
De Datos
Tie
mpo
Sentencia
SQL segunda
optimización
Millones
De Datos
Tie
mpo
INSERT
1
INSERT
1
INSERT
1
UPDATE UPDATE UPDATE DELETE DELETE DELETE SELECT SELECT SELECT
INSERT
5
INSERT
5
INSERT
5
UPDATE UPDATE UPDATE DELETE DELETE DELETE SELECT SELECT SELECT
TABLA 5. GRUPOS DE PRUEBAS.
Por cada operación (Insertar, modificar, eliminar y seleccionar) se crearon cinco sentencias SQL
diferentes, es decir, aplicada a distintas tablas y campos. Cada una de estas sentencias escritas
paso por dos ciclos de optimización con los que se midió los tiempos de respuestas. Debido a
que la creación de 5 millones de datos, con el recurso de hardware que tenía se demoró 20 días,
esto dificultó crear los 25 millones de datos como se planteó al principio, y tras coordinar con
mi tutor se optó crear 1 y 5 millones de datos para probar el impacto de la sentencias SQL.
25
Las sentencias SQL fueron desarrolladas para cada grupo de prueba como SCRIPTS27 (Anexos
del 2 al 5), mediante las pruebas en los gestores se pudieron tomar el tiempo de respuesta y el
número de recursos utilizados por cada sentencia ejecutada.
En cuanto al tiempo de respuesta se realizaron la ejecución de 10 veces cada sentencia y como
resultado se obtuvo un promedio, al que tomamos como muestra para el análisis planteado
(Anexos del 6 al 17). Cabe mencionar que los gestores de base de datos tienen una cache interna
a nivel de sesión, que permite que al ejecutar una consulta la primera vez tarde un poco, luego
utilizan los datos generados para mostrarlos y si se ejecuta de nuevo lo hace en un menor tiempo.
El número de recursos utilizados (algoritmos y lectoescritura de tablas) fue tomado ejecutando
todas las sentencias y contando cada nodo del árbol de planificación de sentencias (Anexo del 24
al 32).
9.2 MATERIALES.
Tipo Cantidad Ítem Detalles
Hardware
1 Computador
Main board MSI
Procesador AMD Athlon XP
Memoria RAM 512 Mbytes.
Disco Duro de 120 GB0
Tarjeta de Red ETHERNET
10/100
Monitor SVGA
Teclado USB/Ps2
Mouse USB/Ps2
1 Regulador APC 400 vatios
Software
1 Sistema Operativo Microsoft Windows 7
1 Paquete de software
de oficina Microsoft Word 2003
1 Sistemas Gestores
de base de datos PostgreSQL
60 Horas de Internet Investigación
4 Sueldo de
Programador
Para crear scripts de prueba sobre
análisis
8 Viáticos Pasajes, alimentación, refrigerios.
TABLA 6. MATERIALES.
27 SCRIPTS.- Los scripts de base de datos son archivos adicionales, regularmente texto plano que contienen instrucciones que no forman parte de la definición del esquema de base de datos
pero que son reconocidas por el sistema gestor de base de datos para ser ejecutados, Biblioteca Microsoft, VISUAL STUDIO 2005 enlace http://msdn.microsoft.com/es-
es/library/aa833429%28v=vs.80%29.aspx
26
9.3 RECURSOS HUMANOS.
✓ TESISTA: CARLOS JAVIER HIDALGO RIVAS
✓ DIRECTOR DE TESIS : ING. ARIOSTO VICUÑA PINO
10. RESULTADOS DE LA COMPROBACIÓN DE HIPÓTESIS.
10.1 ANÁLISIS DE RESULTADOS Y DISCUSIONES.
El análisis de resultados se llevó a cabo en el gestor de base de datos de POSTGRES 9.0
mediante los cuales se pudo observar la importancia de la optimización de la sentencias SQL,
pero luego surgió una interrogante si la misma sentencia en otro gestor de base de datos como
afectaría al rendimiento en cuanto al tiempo de respuesta. Para tener una mejor idea de cómo
afectaría la misma sentencia en otros gestores de base de datos se tomó como modelo de pruebas
al gestor de base de datos de SQL SERVER 2008 R2, y ORACLE 10G.
10.2 INTERPRETACIÓN GENERAL DE GRÁFICOS DE DISPERSIÓN Y TABLAS
Los gráficos mostrados a continuación de un millón de datos (izquierda) y 5 millones de datos
(derecha), el eje de las (X) representan las sentencias mientras que el eje de las (Y) representan
los tiempos de respuestas en segundos producidos por las sentencias ejecutadas. En el eje de la X
se ubican las sentencias sin optimización en el rango de 0-5, la primera optimización se
encuentra entre 5 y 10 y la segunda optimización va desde 10 a 15.
Las tablas que acompañan a cada gráfico representan a los tiempos de respuesta mostrados tanto
para uno y cinco millones de datos, las sentencias sin optimización (SO-P1, SO-P2, SO-P3, SO-
P4, SO-P5) color rojo claro, primer optimización (O1-P1, O1-P2, O1-P3, O1-P4, O1-P5) color
verde claro, y segunda optimización (O2-P1, O2-P2, O2-P3, O2-P4, O2-P5) color morado claro.
27
10.3 ANÁLISIS DE RESULTADOS DE SENTENCIAS SELECT EN POSTGRES 9.0
PRUEBAS DE SENTENCIAS SELECT EN DBMS POSTGRES 9.0
Gráfico 5. Pruebas SELECT en POSTGRES 9.0 con un millón de datos.
Gráfico 6. Pruebas SELECT en POSTGRES 9.0 con cinco millones de datos.
Tabla de tiempos de respuestas
Análisis de resultados y discusiones.
El gráfico 5 (arriba) muestra los resultados de las pruebas SELECT en POSTGRES 9.0 con un
millón de datos, para las pruebas de la sentencias SELECT sin optimización incluyó sentencias
con emparejamiento de tablas y registros en la cláusula WHERE, además se utilizó la cláusula
LIKE con los modificadores de porcentaje que buscaban cadenas de texto equivalentes en un
campo especifico, para un millón de datos la línea de tendencia empieza en 75 segundos y tiende
a caer a 10 segundos mientras que para las pruebas en cinco millones(gráfico 6 arriba) la línea
tiende a bajar de 360 segundos a 20 segundos.
La primera optimización se dio haciendo el emparejamiento de los registros mediante la cláusula
FROM utilizando INNER JOIN, esto es más rápido puesto que según se declaran las tablas se
van filtrando los registros de emparejamientos, en la representación gráfica de los datos
podemos observar una línea de tendencia que inicia en 11.26 segundos y tiende bajar a 1.27
segundos con un millón de datos y para cinco millones de datos es de 38.56 segundos con una
tendencia a decrementar a 1.21 segundos.
La segunda optimización se dio obteniendo solo campos necesarios para el objetivo de la
consulta, esto quiere decir, que se suprimió el uso de SELECT *, de igual manera los filtros
Gestor: Postgres 9.0
Sentencia: SELECT
VD SO-P1 SO-P2 SO-P3 SO-P4 SO-P5 O1-P1 O1-P2 O1-P3 O1-P4 O1-P5 O2-P1 O2-P2 O2-P3 O3-P4 O3-P5
1 23,33 47,4 8,88 2,94 228,77 11,26 8,45 4,76 1,27 4,33 0,45 2,11 1,35 1,1 0,95
5 33,51 259,05 93,5 23,3 763,74 25,88 38,56 23 1,21 14,33 6,15 12,11 2,27 1,12 1,13
28
LIKE fueron cambiados haciendo uso de filtros más específicos utilizando el operador igual, los
tiempos de respuestas en el promedio empiezan desde 2 a 0.45 segundos para un millón de datos,
mientras que para cinco millones de datos empieza desde 12.11 y tiende a caer a 1.12 segundos
10.4 ANÁLISIS DE RESULTADOS DE SENTENCIAS UPDATE EN POSTGRES 9.0
PRUEBAS DE SENTENCIAS UPDATE EN DBMS POSTGRES 9.0
Gráfico 7. Pruebas UPDATE en POSTGRES 9.0 con un millón de datos.
Gráfico 8. Pruebas UPDATE en POSTGRES 9.0 con cinco millones de datos.
Tabla de tiempos de respuestas
Análisis de resultados y discusiones.
Las sentencias UPDATE sin optimización para las pruebas fueron preparadas con el uso de
sentencias mediante declaración de tablas en el FROM, con emparejamiento de registros en la
cláusula WHERE, además se hizo el uso de la sentencia IN para hacer subconsultas dentro de
ésta, se crearon mas subconsultas con emparejamiento de tablas para obtener conjuntos de
registros que cumplían con cierto requerimiento, el gráfico 7 (arriba) muestra los resultados de
las pruebas sin optimización con un promedio aproximado de tiempos de respuesta que empieza
en 50 segundos y tienden a bajar a 10 segundos para la sentencia sin optimización en un millón
de registros, mientras que para cinco millones de datos empieza en 400 segundos y tienden a
caer a 35 segundos.
Gestor: Postgres 9.0
Sentencia: UPDATE
VD SO-P1 SO-P2 SO-P3 SO-P4 SO-P5 O1-P1 O1-P2 O1-P3 O1-P4 O1-P5 O2-P1 O2-P2 O2-P3 O3-P4 O3-P5
1 9,96 275,24 5,93 47,42 10,18 6,74 22,5 4,67 4,88 5,47 5,94 10,82 4,16 3,93 3,22
5 287,85 65,62 71,75 616,1 537,2 60,06 38,14 28,16 49,69 24,29 55,72 11,58 27,45 30,19 13,96
29
La primera optimización de este tipo de sentencia se hizo cambiando el emparejamiento de
tablas de FROM-WHERE a FROM con uniones de tablas, los resultados empiezan en 10
segundos y tienden a caer en 5 segundos para un millón de datos, mientras que para cinco
millones (gráfico 8 arriba) de datos los tiempos de respuestas promedios empiezan de 65
segundos y muestra una tendencia a bajar a 25 segundos.
La segunda optimización se dio suprimiendo datos innecesarios para el objetivo de la consulta,
la línea de tiempo de respuesta promedio empieza en 5 segundos y tiende a caer en 1 segundo
para un millón de datos, para cinco millones de datos es de 25 segundos con una tendencia a
decrementar a 20 segundos.
10.5 ANÁLISIS DE RESULTADOS DE SENTENCIAS DELETE EN POSTGRES 9.0
PRUEBAS DE SENTENCIAS DELETE EN DBMS POSTGRES 9.0
Gráfico 9. Pruebas DELETE en POSTGRES 9.0 con un millón de datos.
Gráfico 10. Pruebas DELETE en POSTGRES 9.0 con cinco millones de datos.
Tabla de tiempos de respuestas.
Análisis de resultados y discusiones.
Las sentencias DELETE son consultas de acción, las cuales realizan un cambio en la base de
datos, este tipo de sentencias se usa cuando se desea eliminar ciertos datos que cumplen un
criterio que se lo hizo en la cláusula WHERE mediante uso de subconsultas, para la consulta sin
optimización se utilizó especificaciones de tablas en el FROM y emparejamiento de registros en
WHERE, el uso de cláusula IN para obtener resultados de consultas, búsqueda de datos con la
Gestor: Postgres 9.0
Sentencia: DELETE
VD SO-P1 SO-P2 SO-P3 SO-P4 SO-P5 O1-P1 O1-P2 O1-P3 O1-P4 O1-P5 O2-P1 O2-P2 O2-P3 O3-P4 O3-P5
1 62,12 11,15 40,79 41,89 41,29 3,41 7,09 40,66 2,12 6,45 3,01 5,12 0,87 1,53 4,4
5 27,35 98,31 244,9 246,5 249,51 25,91 65,19 23,65 163,22 21,36 6,02 53,58 1,48 15,14 3
30
clausula LIKE para datos no muy específicos los datos el grafico 9(arriba) muestra tiempos de
respuesta sin optimización con una línea de tendencia que empieza desde 90 y tiende a bajar
hasta 12 para un millón de datos, mientras que en 5 millones(grafico 10 arriba) el
comportamiento de la línea de tendencia en inicia en 249 segundos y tiende a bajar a 49
segundos.
La primera optimización se la realizo cambiando las especificaciones de tablas y condiciones de
selección en el FROM mediante las clausulas de uniones de tablas, esta optimización se puede
apreciar la línea de tendencia que va desde 12 segundos y muestra una tendencia a bajar a 5
segundos para un millón de datos, en tanto que en 5 millones la línea empieza en 45 segundo y
baja hasta 20 segundos.
Lo que se buscó en esta optimización fue seleccionar solo campos necesarios para el objetivo de
la consulta, la línea de tendencia se encuentra dada desde 5 segundos con una tendencia a caer a
2 segundos, mientras que para la ejecución en cinco millones comienza en 20 segundos y tiende
a bajar a 12 segundos.
10.6 ANÁLISIS DE RESULTADOS DE SENTENCIAS INSERT EN POSTGRES 9.0
PRUEBAS DE SENTENCIAS INSERT EN DBMS POSTGRES 9.0
Gráfico 11. Pruebas INSERT en POSTGRES 9.0 con un millón de datos.
Gráfico 12. Pruebas INSERT en POSTGRES 9.0 con cinco millones de datos.
Tabla de tiempos de respuestas.
Gestor: Postgres 9.0
Sentencia: Insert
VD SO-P1 SO-P2 SO-P3 SO-P4 SO-P5 O1-P1 O1-P2 O1-P3 O1-P4 O1-P5 O2-P1 O2-P2 O2-P3 O3-P4 O3-P5
1 356,39 58,35 191,6 11,62 87,49 17,95 6,97 35,59 6,42 6,19 3,15 5,58 32,41 6,09 4,53
5 380,49 66,78 188,1 19,64 134,7 21,15 14,03 33,22 12,66 10,57 6,08 13,2 31,64 9,92 9,48
31
Análisis de resultados y discusiones.
Las sentencias INSERT son consultas de acción, las mismas que permiten agregar datos a una
tabla específica; para este tipo de consultas se utilizó una función propia de PORTGRES 9.0 que
se llama GENERATE_SERIES, la que permitió generar fechas en un rango que ayudaron a
crear millones de registros para efectos de pruebas, además para que coincidiera el índice de
tablas se utilizó la función ROW_NUMBER.
Las sentencias INSERT sin optimización cuentan con especificaciones de tablas en la cláusula
FROM, en las condiciones de selección de registro (WHERE) podemos encontrar subconsultas
dentro de conectores (AND, OR, NOT) con los que se pudo crear subconsultas en la cláusula IN
y emparejamiento de tablas, la primera optimización se dio haciendo script con especificaciones
de tablas en el FROM y emparejamiento de registros con tablas mediante la cláusula WHERE.
La segunda optimización se la hizo suprimiendo campos innecesarios dentro de una
subconsulta, los resultados de tiempos de respuestas muestran una tendencia desde 310 segundos
hasta 30 segundos para un millón de datos (gráfico 11 arriba), mientras que para 5 millones
(gráfico 12 arriba) de datos la línea de tendencia inicia desde 315 segundos con una tendencia a
decrementar a 40 segundos.
La primera optimización se la realizó cambiando las especificaciones de tablas y condiciones de
selección en el FROM, mediante cláusulas de uniones de tablas, la línea de tendencia para esta
optimización en un millón de datos muestra inicia en 25 segundos con un atendencia a
decrementar a 10 segundos, para 5 millones de datos la línea inicia en 40 segundos y tiende a
caer a 20 segundos.
Lo que se buscó en esta optimización es seleccionar solo campos necesarios para el objetivo de
la consulta, la línea de tendencia se encuentra dada desde 10 segundos y tiende a caer a 1
segundo, mientras que para la ejecución en cinco millones comienza en 20 segundos y tiende a
bajar hasta 8 segundos.
32
10.7 ANÁLISIS DE RESULTADOS DE SENTENCIAS SELECT EN SQL SERVER 2008
PRUEBAS DE SENTENCIAS SELECT EN DBMS SQL SERVER 2008
Gráfico 13. Pruebas SELECT en SQL SERVER 2008 R2 con un millón de datos.
Gráfico 14. Pruebas SELECT en SQL SERVER 2008 R2 con cinco millones de datos.
Tabla de tiempos de respuestas
Gestor: SQL SERVER
Sentencia: SELECT
VD SO-P1 SO-P2 SO-P3 SO-P4 SO-P5 O1-P1 O1-P2 O1-P3 O1-P4 O1-P5 O2-P1 O2-P2 O2-P3 O3-P4 O3-P5
1 0,80 2,00 3,10 0,30 1,20 0,90 2,10 1,20 1,20 0,20 2,20 2,10 1,20 1,00 0,10
5 8,50 15,00 17,00 5,40 3,40 16,30 6,20 6,40 6,10 1,50 612,40 10,40 7,20 5,10 3,20
Análisis de resultados y discusiones
La ejecución de sentencias SELECT que se optimizo en POSTGRES 9.0 se ejecuto en SQL
SERVER 2008 R2 dando como resultado una línea de tendencia que muestra sentencia sin
optimización que va desde 1.60 segundos y tiende a bajar a 1 segundos para un millón de datos
(grafico 13 arriba), mientras que para 5 millones de datos (grafico 14 arriba) inicia en 13.5
segundos y tiende a caer en 7.2 segundos
La primera optimización los tiempos de respuestas para un millón de datos inicia en 1 segundos
y tiende a caer a 0.85 segundos, para cinco millones de datos empieza en 7.2 segundos y tiende
a bajar a 5.4 segundos.
La segunda optimización 0.85 segundos y tiende a decrementar a 0.75 segundos para un millón
de datos, mientras que para cinco millones de datos la línea de tendencia empieza en 5.4
segundos y tiende a caer a 3.20 segundos.
33
10.8 ANÁLISIS DE RESULTADOS DE SENTENCIAS UPDATE EN SQL SERVER 2008
PRUEBAS DE SENTENCIAS UPDATE EN DBMS SQL SERVER 2008
Gráfico 15. Pruebas UPDATE en SQL SERVER 2008 R2 con un millón de datos.
Gráfico 16. Pruebas UPDATE en SQL SERVER 2008 R2 con cinco millones de datos.
Tabla de tiempos de respuestas
Análisis de resultados y discusiones
Las sentencia UPDATE sin optimización en un millón (gráfico 15 arriba) de datos tiene una
línea de tendencia que empieza en 3.20 segundos y tiende a 0.90 segundos, en la prueba con
cinco millones de datos (gráfico 16 arriba) empiezan en 0.10 segundos y tienden a subir a 2.10
segundos.
La primera optimización se puede observar la línea de tendencia que baja desde 0.90 segundos a
0.60 segundos para un millón de datos, para cinco millones de registros empiezan de 2.10
segundos y tiende a subir a 35 segundos.
La segunda optimización la línea de tendencia empieza desde 0.60 segundos y tiende a bajar a
0.45 segundos en un millón de datos, las pruebas en cinco millones de datos se observa una línea
que empieza en 35 segundos y tiende a subir a 75 segundos.
Gestor: SQL SERVER
Sentencia: UPDATE
VD SO-P1 SO-P2 SO-P3 SO-P4 SO-P5 O1-P1 O1-P2 O1-P3 O1-P4 O1-P5 O2-P1 O2-P2 O2-P3 O3-P4 O3-P5
1 1,20 1,40 3,20 2,00 0,90 1,80 1,10 2,10 0,10 0,20 1,10 0,20 2,10 0,10 0,30
5 3,50 19,70 10,80 11,90 803,10 6,20 6,20 19,40 11,50 818,90 6,00 7,20 17,50 145,70 1109,10
34
10.9 ANÁLISIS RESULTADOS DE SENTENCIAS DELETE EN SQL SERVER 2008.
PRUEBAS DE SENTENCIAS DELETE EN DBMS SQL SERVER 2008
Gráfico 17. Pruebas DELETE en SQL SERVER 2008 R2 con un millón de datos.
Gráfico 18. Pruebas DELETE en SQL SERVER 2008 R2 con cinco millones de datos.
Tabla de tiempos de respuestas
Análisis de resultados y discusiones
La sentencia DELETE sin optimización para un millón de datos(gráfico 17 arriba ) muestra una
línea de tendencia que inicia 12 segundos y tiende a bajar a 8.50 segundos, para cinco millones
de datos (gráfico 18 arriba) inicia en 27 segundos y tiende a bajar a 25.50 segundos.
La primer optimización en un millón de datos tiene una línea de tendencia de 8.50 segundos y
tiende a bajar a 7.50 segundos, para cinco millones de datos la línea de tendencia inicia en 25.50
segundos y tiende a bajar a 25 segundos.
En la segunda optimización se puede observar una línea de tendencia que baja desde 7.50
segundos con una tendencia a decremetar de 7 segundos, mientras que la ejecución en cinco
millones de datos va desde 26 segundos y tiende a bajar a 25 segundos.
Gestor: SQL SERVER
Sentencia: DELETE
VD SO-P1 SO-P2 SO-P3 SO-P4 SO-P5 O1-P1 O1-P2 O1-P3 O1-P4 O1-P5 O2-P1 O2-P2 O2-P3 O3-P4 O3-P5
1 10,80 10,10 7,00 28,10 5,00 8,00 11,00 6,10 8,00 6,00 7,00 11,00 6,50 7,00 7,00
5 28,90 34,10 25,00 24,00 14,00 25,00 35,00 26,80 24,00 26,00 23,40 38,00 22,10 24,00 26,70
35
10.10 ANÁLISIS DE RESULTADOS DE SENTENCIAS INSERT EN SQL SERVER 2008
Tabla de tiempos de respuestas
Análisis de resultados y discusiones
La sentencia INSERT muestra una línea de tendencia que inicia en 310 segundos y tiende a caer
en 25 segundos para un millón de datos (gráfico 19 arriba), mientras que para cinco millones de
datos (gráfico 20 arriba) inicia en 310 segundos y 39 segundos.
La primera optimización en un millón de datos inicia en 25 segundos y tiende a caer a 15
segundos, para cinco millones de datos la línea de tendencia inicia en 39 segundos y tiende a
caer en 20 segundos.
En la segunda optimización se puede observar que la línea empieza en 15 segundos y tiende a
caer a 5 segundo para un millón de datos, mientras que para cinco millones de datos la línea de
tendencia empieza en 20 segundos y tiende a caer en 10 segundos.
PRUEBAS DE SENTENCIAS INSERT EN DBMS SQL SERVER 2008
Gráfico 19. Pruebas INSERT en SQL SERVER 2008 R2 con un millón de datos.
Gráfico 20. Pruebas INSERT en SQL SERVER 2008 R2 con cinco millones de datos.
Gestor: SQL SERVER
Sentencia: INSERT
VD SO-P1 SO-P2 SO-P3 SO-P4 SO-P5 O1-P1 O1-P2 O1-P3 O1-P4 O1-P5 O2-P1 O2-P2 O2-P3 O3-P4 O3-P5
1 356,39 58,35 191,57 11,62 87,49 17,95 6,97 35,59 6,42 6,19 3,15 5,58 32,41 6,09 4,53
5 380,49 66,78 188,05 19,64 134,7 21,15 14,03 33,22 12,66 10,57 6,08 13,2 31,64 9,92 9,48
36
10.11 ANÁLISIS DE RESULTADOS DE SENTENCIAS SELECT EN ORACLE 10G.
Tabla de tiempos de respuestas
ANÁLISIS DE RESULTADOS Y DISCUSIONES
La sentencia SELECT sin optimización muestra una línea de tendencia que empieza en 9.5
segundos tiende a caer a 3.5 segundos para un millón de datos(gráfico 21 arriba), para cinco
millones de datos (gráfico 22 arriba) empieza en 30 segundos y tiende a subir a 40 segundos.
La primera optimización de esta sentencia para un millón de datos empieza en 3.5 segundos y
tiende a caer a 2 segundos, mientras que para cinco millones de datos se observa una línea que
empieza en 30 y tiende a subir a 45.
La segunda optimización para un millón de datos muestra una línea de tendencia que va desde 2
segundos y tiende a caer en 1.5 segundos, para cinco millones de datos la línea continua desde
45 segundos y tiende a subir a 50 segundos.
PRUEBAS DE SENTENCIAS SELECT EN DBMS ORACLE 10G
Gráfico 21. Pruebas SELECT en ORACLE 10G con un millón de datos.
Gráfico 22. Pruebas SELECT en ORACLE 10G con cinco millones de datos.
Gestor: ORACLE 10G
Sentencia:SELECT
VD SO-P1 SO-P2 SO-P3 SO-P4 SO-P5 O1-P1 O1-P2 O1-P3 O1-P4 O1-P5 O2-P1 O2-P2 O2-P3 O3-P4 O3-P5
1 6,7 9 2,6713 19,313 3 0,1624 9,1 6,9 15,2 0,3853 0,3149 0,848 8,1 15,2 0,3072
5 25,7 55,2 30,1 44,9483 27,1 28,1748 632,027 27,1 29,1307 27,1 28,0602 325,106 29 33,3534 28
37
10.12 ANÁLISIS DE RESULTADOS DE SENTENCIAS UPDATE EN ORACLE 10G
Tabla de tiempos de respuestas
Análisis de resultados y discusiones
La sentencia UPDATE sin optimizar muestra una línea de tendencia que comienza en 1.4
segundos y tiende a caer en 0.9 segundos para un millón de datos (gráfico 23 arriba), mientras
que para cinco millones de datos (gráfico 24 arriba) su ejecución muestra una línea de tendencia
que en va desde 110 segundos y tiende a caer en 80 segundos.
La primer optimización en un millón de datos la línea continúa desde 0.9 segundos y tiende a
caer en 0.6 segundos, para cinco millones de datos empieza desde 80 segundos y tiende a caer a
70 segundos.
La segunda optimización para un millón de datos empieza en 0.6 segundos y tiende a
decrementar a 5 segundos.
PRUEBAS DE SENTENCIAS UPDATE EN DBMS ORACLE 10G
Gráfico 23. Pruebas UPDATE en ORACLE 10G con un millón de datos.
Gráfico 24. Pruebas UPDATE en ORACLE 10G con cinco millones de datos.
Gestor: ORACLE 10G
Sentencia:UPDATE
VD SO-P1 SO-P2 SO-P3 SO-P4 SO-P5 O1-P1 O1-P2 O1-P3 O1-P4 O1-P5 O2-P1 O2-P2 O2-P3 O3-P4 O3-P5
1 0,33 0,82 1,11 6,90 2,61 7,94 0,60 0,33 0,92 0,32 10,41 0,53 0,27 0,38 0,15
5 25,93 71,21 610,27 905,62 55,69 28,48 31,17 126,90 243,60 51,95 28,45 28,50 98,98 70,13 50,79
38
10.13 ANÁLISIS DE RESULTADOS DE SENTENCIAS DELETE EN ORACLE 10G
Tabla de tiempos de respuestas
Análisis de resultados y discusiones
La sentencia DELETE sin optimización en un millón de datos (gráfico 25 arriba) tiene una línea
de tendencia que inicia en 4,9 segundos y tiene una tendencia decremental a 4 segundos, para
cinco millones de datos (gráfico 26 arriba) la línea tendencia empieza en 65 segundos y tiende a
subir a 70 segundos.
En la primera optimización con un millón de datos, la línea continúa bajando de 4 segundos a 3.5
segundos, esta prueba en cinco millones de datos tiene una línea de tendencia que inicia en 70
segundos y tiende a mantenerse en 70 segundos.
La segunda optimización en un millón de datos se muestra una tendencia 3.5 y tiende a bajar 3.2
segundos, para cinco millones de datos la línea de tendencia empieza en 70 segundos y tiende a
mantenerse en 70 segundos.
PRUEBAS DE SENTENCIAS DELETE EN DBMS ORACLE 10G
Gráfico 25. Pruebas DELETE en ORACLE 10G con un millón de datos.
Gráfico 26. Pruebas DELETE en ORACLE 10G con cinco millones de datos.
Gestor: ORACLE 10G
Sentencia:DELETE
VD SO-P1 SO-P2 SO-P3 SO-P4 SO-P5 O1-P1 O1-P2 O1-P3 O1-P4 O1-P5 O2-P1 O2-P2 O2-P3 O3-P4 O3-P5
1 1,08 4,08 8,68 12,20 16,26 0,70 11,52 8,91 10,67 4,63 0,92 1,18 0,34 25,13 1,55
5 29,74 443,55 30,33 50,92 81,70 28,85 320,24 29,87 43,02 74,10 29,06 241,53 32,31 147,13 50,72
39
10.14 ANÁLISIS DE RESULTADOS DE SENTENCIAS INSERT EN ORACLE 10G
Tabla de tiempos de respuestas
Análisis de resultados y discusiones
La sentencia INSERT sin optimización en un millón de datos (gráfico 27 arriba) muestra una
línea de tendencia que va desde 70 segundos y tiende a caer en 20 segundos, para cinco millones
de datos (gráfico 28 arriba) inicia en 110 segundos y tiende a caer en 40 segundos.
La primera optimización se observa una línea que continua cayendo desde 20 segundos y tiende
a caer en 10 segundos, en cinco millones de datos la línea inicia en 40 segundos y tiende a 20
segundos.
La segunda optimización para un millón de datos empieza en 10 segundos y tiende a caer en 5
segundos, en cinco millones de datos la línea empieza en 20 segundos y tiende a caer a 10
segundos.
PRUEBAS DE SENTENCIAS INSERT EN DBMS ORACLE 10G
Gráfico 27. Pruebas INSERT en ORACLE 10G con un millón de datos.
Gráfico 28. Pruebas INSERT en ORACLE 10G con cinco millones de datos.
Gestor: ORACLE 10G
Sentencia:INSERT
VD SO-P1 SO-P2 SO-P3 SO-P4 SO-P5 O1-P1 O1-P2 O1-P3 O1-P4 O1-P5 O2-P1 O2-P2 O2-P3 O3-P4 O3-P5
1 24,46 654,57 8,66 20,10 24,51 12,38 6,63 9,21 16,42 11,46 10,06 8,04 9,11 14,46 11,88
5 42,51 791,59 27,58 33,00 47,69 29,59 19,59 28,01 32,53 33,08 29,32 33,30 28,22 31,22 28,46
40
10.15 ANÁLISIS DE MEDIAS POR DBMS CON UN MILLÓN DE DATOS.
POSTGRES 9.0
ORACLE 10G SQL SERVER 2008 R2
GRÁFICO 29. GRÁFICO DE MEDIAS EN DBMS CON 1 MILLON DE DATOS
Puesto que las optimizaciones se realizaron en POSTGRES 9.0 se puede observar la gráfica de la
media en segundos de la sentencia SOPT (sentencia sin optimización) ejecutada en POSTGRES
9.0 con una media de 300 segundos, el tiempo de respuesta de la media para la sentencia 1OPT
(primera optimización) es 10 segundos, la 2OPT (segunda optimización) se observa una media
de 5 segundos.
Las mismas sentencias ejecutadas en POSTGRES 9.0 son ejecutadas en ORACLE 10G, dando
como resultado una media de 40 segundos para la sentencia sin optimización, mediante la
ejecución de la primera optimización se puede observar una media de 8 segundos, para la
segunda optimización la media es de 6 segundos.
Las sentencia ejecutadas en POSTGRES 9.0 y ORACLE 10G fueron ejecutadas en SQL
SERVER 2008 R2 dando como resultado en la sentencia sin optimización una media de 4
segundos, por otro lado se puede observar una media de 3.5 segundos para la primera
41
optimización, mientras que la segunda optimización muestra una media de 12 segundos esto se
debe a que las optimizaciones se hicieron en POSTGRES 9.0. Se pudo observar que las
ejecuciones de sentencias para SQL SERVER 2008 R2 tuvo un comportamiento en cuanto a
tiempo de respuesta diferente debido a la forma como los algoritmos resuelven las estructuras de
sentencias.
10.16 ANÁLISIS DE MEDIAS POR DBMS CON CINCO MILLONES DE DATOS.
POSTGRES 9.0
ORACLE 10G
SQL SERVER 2008 R2
GRÁFICO 30. GRÁFICO DE MEDIAS EN DBMS CON 5 MILLONES DE DATOS
Las sentencias ejecutadas en POSTGRES 9.0 con un millón de datos ahora son sometidas a
pruebas en cinco millones de datos para POSTGRES 9.0 sin optimización muestra una media de
225 segundos, la primera optimización de las pruebas presentan una media de 35 segundos, y
mediante la segunda optimización la media disminuye a 20 segundos.
42
Para ORACLE 10G la sentencia sin optimización retorna un tiempo de respuesta de 175
segundos, para la primera optimización tiene una media de 90 segundos, la segunda
optimización la media es de 70 segundos.
La ejecución de las pruebas en SQL SERVER 2008 R2 muestra un tiempo similar en las
sentencias sin optimización y primer optimización con una media de 55 segundos mientras que
en la segunda optimización la media es de 120 segundos esto se debe a la forma como el gestor
resuelve las estructuras de sentencias hechas en POSTGRES 9.0.
11. PRESUPUESTO.
Cantidad Ítem Detalles Costo
Unitario Costo
1 Computador
Main board MSI
Procesador AMD
Athlon XP
Memoria RAM 512
Mbytes.
Disco Duro de 120 GB0
Tarjeta de Red ETHERNET
10/100
Monitor SVGA
Teclado USB/Ps2
Mouse USB/Ps2
$ 750.00 $ 750.00
1 Regulador APC 400 Vatios $ 60.00 $ 60.00
1 sistema
operativo Microsoft Windows 7 $ 150.00 $ 150.00
1
Paquete de
software de
oficina
Office Word 2003 $ 50.00 $ 50.00
1
Sistemas
Gestores de
base de
datos
POSTGRES SQL 9.0 $ 0.00 $ 0.00
80 horas de
Internet Investigación $ 0.70 $ 56.00
1 Sueldo de
programador
Para crear aplicación de
prueba sobre análisis $ 400.00 $ 400.00
80 Viáticos Pasajes, alimentación,
refrigerios. $ 10.00 $ 800.00
$ 2,266.00
TABLA 7. PRESUPUESTO
Para el desarrollo de este proyecto los gastos generados fueron asumidos por el autor de la tesis.
43
12. CONCLUSIONES.
Las pruebas realizadas demostraron que el tiempo de respuesta disminuye cuando se aplica la
optimización de las sentencias SQL. Al respecto, se determinó que si t (segundos) es el tiempo
de ejecución de una sentencia SQL sin optimizar, la misma sentencia pasada por una etapa de
optimización tarda en ejecutarse t/10 (segundos).
Los procedimientos almacenados para generar uno y cinco millones de datos tardaron
aproximadamente veinte días en crear estos registros. Esto se debió sobre todo a que el equipo
donde se ejecutó estos procedimientos no contaba con las características suficientes para hacerlo
en menos tiempo. Además se generó randomicamente los datos que se depositaron en tablas
temporales para el efecto.
Los requerimientos funcionales fueron bastante exigentes con relación a las condiciones de los
requerimientos por lo tanto se hizo uso de las sentencias SELECT, INSERT, UPDATE y
DELETE las cuales se estructuraron de forma compleja para satisfacer cada caso planteado.
Las cláusulas SELECT fueron optimizadas con mayor frecuencia, puesto que se utilizaron en
operaciones SQL como UPDATE, DELETE, INSERT mediante el uso de subconsultas. El
criterio de optimización que se aplicó en las sentencias SELECT fue seleccionando los campos
necesarios para el objetivo de la consulta, uso de filtro específico para obtener datos, además se
utilizaron uniones de tablas lo que ayudo a la disminución del tiempo de respuesta.
Las pruebas hechas en POSTGRES 9.0 demostraron que el tiempo de respuesta disminuye
cuando se aplica la optimización de las sentencias SQL; mientras que estas fueron ejecutadas en
SQL SERVER 2008 y ORACLE 10G dando resultados diferentes, debido a que los DBMS
tienen diferentes formas de resolver los algoritmos de sentencias SQL.
13. RECOMENDACIONES
De acuerdo a los resultados obtenidos se recomienda que, sobre todo cuando se trabaje con
bases de datos pobladas con millones de registros, las sentencias SQL pasen al menos por una
etapa de optimización.
Se debe tomar en consideración el DBMS en el cual se desea optimizar las sentencias SQL,
puesto que cada uno de ellos resuelve de manera distinta las estructuras.
44
14. BIBLIOGRAFÍA.
C.J. DATE, AÑO 2001, INTRODUCCIÓN A LOS SISTEMAS DE BASES DE DATOS,
SÉPTIMA EDICIÓN.
CARMEN DE PABLO HEREDERO, AÑO 2004, INFORMÁTICA Y
COMUNICACIONES EN LA EMPRESA.
HENRY F. KORTH Y ABRAHAM SILBERSCHATZ, AÑO 2005, FUNDAMENTOS DE
BASES DE DATOS, MCGRAW-HILL, SEGUNDA EDICIÓN.
JEROME GABILLAUD, AÑO 2006, SQL SERVER 2005: SQL, TRANSACT SQL,
CUARTA EDICIÓN.
MERCEDES MARQUÉS, AÑO 2001, APUNTES DE FICHEROS Y BASES DE DATOS.
ROB HAWTHORNE, AÑO 2000, DESARROLLO DE BASE DE DATOS MICROSOFT
SQL SERVER 2000.
ROB HAWTHORNE, AÑO 2000, DESARROLLO DE BASE DE DATOS MS SQL 2000.
SILBERCHATZ, KORTH, AÑO 2006, FUNDAMENTOS DE BASES DE DATOS,
MCGRAW-HILL, QUINTA EDICIÓN SUDARSHAN.
SILBERCHATZ, KORTH, SUDARSHAN, AÑO 2002, FUNDAMENTOS DE BASES DE
DATOS, MCGRAW-HILL, CUARTA EDICIÓN.
SILBERCHATZ, KORTH, SUDARSHAN, AÑO 2007, FUNDAMENTOS DE BASES DE
DATOS, MCGRAW-HILL, QUINTA EDICIÓN.
VÉRTICE S.L., AÑO 2008, APLICACIONES AVANZADAS DE ACCESS EN LA
GESTIÓN DEL COMERCIO PUBLICACIONES.
45
ANEXO 1 DIAGRAMA DE LA BASE DE DATOS DEL SISTEMA DE GESTION MUNICIPAL CABILDO – CASTASTRO URBANO Y RURAL
Gráfico 31. Diagrama de la base de datos
46
ANEXO 2
REQUERIMIENTOS PARA LA SENTENCIA SELECT .
PRUEBA 1
Mostrar todos los predios que tienen escrituras donde las escrituras fuesen creadas en la región costa, sierra y en la Amazonía, cuyos predios tenga un área de construcción mayor 10 m2,
la ocupación sea de tipo no edificado, las características sean inundables, cenagosas y húmedas. Donde la topografía sea a nivel, bajo nivel, escarpado hacia arriba. La localización de los predios sea esquinera, intermedia y en cabecera y cuya forma del predio sea de tipo irregular y muy irregular. También se requiere que los predios en mención tenga una superficie mayor
a 5 m2, que el uso del predio sea para uso de educación, salud, recreación, publico, artesanal y residencial.
También se desean que se tengan los siguientes parámetros: Acera
Que la deuda del contribuyente sea menor de 8000 dólares
PRUEBA 2
Obtener un listado de predios que se encuentren ubicados en las parroquias I, J, K, Z, M, S, Y, K, F, T, D y E. mostrar nombres de propietarios, que tengan conexión de agua y que su la deuda de agua sea mayor de 10 Dólares, donde el área del predio sea mayor a 5 m2, el valor de emisión del predio por cliente sea mayor a 2.1 USD. , que todos los predios cumplan con
las siguientes características:
Paredes de Bloque, Tapial, Madera Fina y Hormigón Armado. Escaleras de Caña, Hormigón Ciclópeo, Hierro, Madera Común.
Revestimiento de pisos Arena-Cemento (Cemento Alisado), Enlucidos Tierra, Marmolina, Vinyl.
PRUEBA 3
Obtener un listado de predios rurales con los nombres de los propietarios, donde predios ingresados se encuentren entre el grupo de los predios que su deuda este entre 1 a 20000 dólares,
por título emitido. Las vías sean fluvial, Línea férrea, primer orden, herraduría, además cumpla con lo siguiente:
Tenga escrituras elaboradas en la Amazonía y Sierra, costa. Área de terreno >10 m2
Abastecimiento de agua.
Drenaje: bien drenado, excesivo, moderado. Área de construcción > 20 m2
Dominio arrendatario, comunas jurídicas y posesionario
PRUEBA 4
Obtener un listado de predios urbanos cuyos propietarios tenga agua potable, mantenga una deuda pendiente por pago de mayor a 20 dólares por predio, además las características general
de la estructura sea de tipo soportante; estado de conservación de la estructura sea en reparación y obsoleto; paredes de caña, tapial, madera fina; entrepiso de madera común, losa
Hormigón armado; entrepiso madera común. Que el contribuyente tenga predios rurales con las siguientes características: Dominio, propietario, arrendatarios, público y posesionario.
Drenaje moderado, excesivo y mal drenado
Uso del suelo: Agrícola, avícola, bioacuatico, ganadero, minero, piscícola, recreación/turismo y forestal.
PRUEBA 5
Se desea obtener un listado de los predios urbanos que sus intereses no sean mayor a 1 dólar por título emitido y que se estén ubicados en las parroquias K, E, R, O, P, T, D. donde el área
sea mayor a 50 m2, donde los propietarios sean de tipos jurídicos, Gobierno, normal y municipal.
Que su localización dentro de la manzana sea en cabecera, interior, esquinero e intermedio. Que el usuario tenga conexión de agua potable.
Además los predios seleccionados deben cumplir con lo siguiente:
Paredes de bloque, caña y madera fina.
Topografía accidentado, escarpado hacia arriba escarpado hacia abajo. Estados de construcción Estable Obsoleto, a Repara.
47
ANEXO 3
REQUERIMIENTOS PARA LA SENTENCIA UPDATE
PRUEBA 1
Se necesita actualizar el 0.3 por ciento de los valores emitidos, un 0.1 por ciento de los intereses, en los títulos de los
predios urbanos ubicados en las parroquias A, K, L, M, I, J, S. que sean de dominio público y privado, tipo de contribuyente
gobierno, jurídico, municipal. Localización en la manzana, en cabecera, interior y en pasaje.
PRUEBA 2
Se desea actualizara el valor del avaluó comercial de los predios urbanos donde el dominio sea público, su área de
construcción mayor a 20 m2, cubierta de loza hormigón armado, puertas de aluminio y enrollables, que tenga más de un
piso. Que su deuda sea mayor de 20 dólares americanos y que el contribuyente tenga agua potable, estados de
conservación obsoleta, a reparar, en reparación.
PRUEBA 3
Se desea hacer un descuento del 10 por ciento del valor de emisión, si cada predio adeuda a la municipalidad valores
menores a 8000 USD, estos predios deben constar con características de suelo seco, cenagoso, ocupación edificado, estado
de conservación a reparar, en reparación, obsoleto. Entrepiso caña, madera fina. Con un historias de dueños mayor a 5.
PRUEBA 4
Se necesita aumentar 1 por ciento al de recargo. Que las vías de acceso hacia los predios sean de primero, segundo y tercer
orden; la deuda por predio sea menor de 100; la topografía sea a nivel plana y pendiente leve; drenaje excesivo, moderado y
mal drenado; estados de conservación estable, obsoleto, a reparar; superficie mayor 100 m2.
PRUEBA 5
Se requiere actualizar el avaluó real de los predios rurales donde el uso del suelo este destinado para uso agrícola, forestal,
minero, bioacuatico, comercial, agro exportación; La deuda no sea mayor a 200 por predio. Vías de herraduría, línea férrea,
fluvial, primer orden, segundo orden; dominio posesionario, arrendatario, publico, usufructuario, comunas jurídicas;
Columnas y Pilastras de adobe, ladrillo, piedra, madera común, tapial; Revestimientos Escaleras madera fina, mármol,
caña, baldosa cerámica, champeado.
48
ANEXO 4
REQUERIMIENTOS PARA LA SENTENCIA DELETE.
PRUEBA 1
Eliminar los predios urbanos que sus escrituras se hayan hecho en la costa, sierra, amazonia; tipo de contribuyente jurídico, religioso, gobierno, normal; la deuda por título emitido sea
menor a 20 dólares; las parroquias sean A, B, C, D, E, F; características de suelo Cenagoso, mal drenado, húmedo, inundable; revestimiento de pisos tablón Gress, madera común, caña,
madera fina, marmolina. Área de terreno mayor 20 m2. Área de construcción 10 m2.
PRUEBA 2
Se desea hacer la eliminación de los títulos emitidos no cancelado por contribuyente donde la deuda por predios sea menor a 600 dólares americanos, estos predios deben estar ubicados
en sectores con aéreas de riegos como por ejemplo F,G,H,I,J,K,L,M,N,Ñ,A Y O. donde los predios cuentes con características que a continuación se detallan.
Su localización sea intermedio, en cabecera, interior, en pasaje y manzanero.
Características del suelo inundable, cenagoso, húmedo.
Estado de conservación en reparación, a reparar y obsoleto.
PRUEBA 3
Mediante el censo hecho en el año de 1996, se les encargo a unos pasantes de colegios que ingresaran algunos datos concernientes al censo de los prediales, algunos de estos ingresos
fueron herrados, por tal motivo se desea eliminar estos predios que fueron ingresaos en diciembre del año antes mencionado. Estos predios cumplen con las siguientes características.
El frente principal mayor 8
Fondo relativo se encuentres entre 10 a 190
Localización esquinero, en cabecera, interior.
Escalera de Hormigón simple, ladrillo, hierro.
Deuda mayor a 30 Dólares Americanos.
PRUEBA 4
Los predios rurales se les encargo a una empresa extranjera que realice el censo del año 1985. Que lo completaron el cincuenta por ciento, la contraparte se contrato personal inexperto en
el tema que como resultado no realizo el censo de forma correcta. Los predios que hay que eliminar cumplieron con las siguientes características.
Traslación de dominio posesión, permuta, adjudicación.
Uso de suelo agrícola, agro exportación, avícola, bioacuatico, porcicola y minero.
La superficie sea mayor de 5 Hectáreas.
Escrituras elaboradas en la sierra, costa, galápagos.
PRUEBA 5
Realizar la eliminación de la deuda de los predios urbanos ubicados en las parroquias A, B, C, D, E, F, G, H. área de terreno entre 50 a 200 m2. La deuda por predio sea menor a 2584
dólares.
Paredes de Bloque, Tapial, Madera Fina y Hormigón Armado.
Escaleras de Caña, Hormigón Ciclópeo, Hierro, Madera Común.
Revestimiento de pisos Arena-Cemento (Cemento Alisado), Enlucidos Tierra, Marmolina, Vinyl.
49
ANEXO 5
REQUERIMIENTOS PARA LA SENTENCIA INSERT.
PRUEBA 1 Hacer una emisión de los predios ubicados en las parroquias A. el contribuyente sea de tipo jurídico; que los predios estén en posición esquinero, interior, en cabecera; tengan escrituras hechas en las ciudades de la sierra.
PRUEBA 2 Realizar una emisión de los predios rurales, los predios rurales deben cumplir con las siguientes especificaciones: dominio propietario, arrendatario, posesionario, traslación de dominio herencia, donación, posesión, drenaje bien drenado, mal drenado y moderado, poblaciones más cercanas cabecera cantonal y cabecera parroquial, vías de primero y segundo orden.
PRUEBA 3 Se no pide hacer una emisión de agua potable desde los meses del año 1992 a diciembre del 2011 los títulos que se deben emitir han de cumplir con el siguiente criterio: los predios urbanos de la parroquia A. Tener aceras y bordillos que tengan construcción con acabados en estado estables y a reparar, números de pisos mayor a 3, entrepisos de losa hormigón armado,
madera común, madera fina, paredes de fibrocemento, hormigón armado, ladrillo.
PRUEBA 4 Se necesita hacer una emisión de predios urbanos donde el área del predio este entre 10 m2 y 200 m2, que los dueños tengan un numero de cedula que termine en los números 1, 9, 6, 3, 4,
0,2 que el estado civil no sea viudo; la construcción debe ser a repara y obsoleto. En los predios seleccionados en la consulta anterior cada dueño debe tener un predio rural con construcción y vías de primero y segundo orden.
PRUEBA 5 Hacer una emisión de predios urbanos donde los predios se encuentras ubicados en la parroquia B. Las características del suelo sea de tipo cenagoso, húmedo e inundable, revestimiento exteriores de tipo cemento, chapeado, enlucidos tierra, grafiado y madera fina que los dueños de los predios tengan agua potable y predios rurales.
50
ANEXO 6
RESULTADOS DE LA SENTENCIA SELECT BAJO DBMS POSTGRES 9.0
Prueba 1 Prueba 2 Prueba 3 Prueba 4 Prueba 5 Prueba 6 Prueba 7 Prueba 8 Prueba 9 Prueba 10 Promedio
42 115,67 3,57 3,60 3,65 3,57 3,60 3,59 3,67 3,59 3,90 14,84 1'
73 300,08 53,60 54,25 55,15 54,11 43,10 52,82 60,99 53,62 57,74 78,55 5'
42 43,71 41,53 41,93 41,73 41,59 41,70 42,14 41,40 41,23 41,29 41,83 1'
73 26,04 25,75 25,81 25,68 6,06 26,02 25,49 25,84 6,06 25,69 21,84 5'
42 12,13 4,15 4,18 4,15 4,10 4,14 4,16 4,14 4,11 4,20 4,95 1'
73 0,74 0,62 0,63 0,62 0,62 0,63 0,62 0,62 0,64 0,64 0,64 5'
182 47,59 46,96 47,18 46,63 49,69 47,24 47,32 47,16 47,19 47,04 47,40 1'
518 272,85 258,44 257,52 258,38 257,33 253,82 257,40 257,94 258,10 258,78 259,05 5'
182 8,49 8,46 8,42 8,52 8,42 8,41 8,46 8,42 8,40 8,52 8,45 1'
518 39,34 38,74 38,52 38,36 38,62 38,36 38,38 38,31 38,63 38,29 38,56 5'
182 2,18 2,08 2,08 2,08 2,12 2,12 2,10 2,14 2,07 2,10 2,11 1'
518 31,15 9,91 10,07 9,93 10,07 10,11 9,93 9,93 9,96 10,01 12,11 5'
4080 14,16 16,16 14,06 13,66 13,84 13,86 14,29 13,68 14,27 14,19 14,22 1'
24352 188,42 1116,86 1199,51 128,31 115,51 117,73 101,76 116,46 126,13 112,48 332,31 5'
4080 2,36 2,30 2,32 2,28 2,29 2,28 2,26 2,26 2,30 2,31 2,30 1'
24352 60,42 2,15 2,12 1,80 1,86 2,16 19,55 2,13 1,95 2,14 9,63 5'
4080 1,66 1,61 1,59 1,61 1,59 1,60 1,58 1,59 1,64 1,59 1,61 1'
24352 236,63 2,81 2,62 2,64 2,65 2,73 2,62 2,71 2,72 2,62 26,08 5'
106 2,96 3,06 3,03 2,96 2,67 2,97 2,95 2,90 2,91 2,97 2,94 1'
339 193,88 5,50 4,15 4,04 4,11 4,14 4,18 4,39 4,31 4,31 23,30 5'
106 1,15 1,43 1,14 1,16 1,13 2,01 1,20 1,14 1,18 1,14 1,27 1'
339 1,29 1,21 1,19 1,17 1,20 1,25 1,22 1,18 1,19 1,19 1,21 5'
106 1,10 1,10 1,09 1,10 1,09 1,11 1,12 1,13 1,09 1,07 1,10 1'
339 1,13 1,12 1,11 1,11 1,15 1,12 1,10 1,13 1,13 1,13 1,12 5'
188 231,43 228,52 228,66 223,52 223,42 231,52 228,91 229,81 228,33 233,56 228,77 1'
557 986,70 77,74 767,03 768,10 854,25 839,12 976,61 779,80 789,80 798,29 763,74 5'
188 4,29 4,40 4,31 4,41 4,39 4,33 4,35 4,29 4,27 4,25 4,33 1'
557 87,63 6,23 6,19 6,15 6,18 6,16 6,30 6,14 6,23 6,14 14,33 5'
188 0,97 0,93 0,95 0,95 0,96 0,93 0,94 0,95 0,95 0,98 0,95 1'
557 1,14 1,13 1,12 1,11 1,12 1,13 1,10 1,20 1,09 1,12 1,13 5'
ConsultaPruebaVolumen
de datos
Tiempo expresado en segundos
Filas Devueltas
Primer optimización3
Segunda optimización
sin optimización
sin optimización
Primer optimización
Segunda optimización
1
4
2
sin optimización
Primer optimización
Segunda optimización
sin optimización
5
sin optimización
Primer optimización
Segunda optimización
Primer optimización
Segunda optimización
51
ANEXO 7
RESULTADOS DE LA SENTENCIA SELECT BAJO DBMS SQL SERVER 2008 R2
Prueba 1 Prueba 2 Prueba 3 Prueba 4 Prueba 5 Prueba 6 Prueba 7 Prueba 8 Prueba 9 Prueba 10 Promedio
42 5,00 1,00 1,00 1,00 0,00 0,00 0,00 0,00 0,00 0,00 0,80 1'
73 40,00 5,00 5,00 5,00 5,00 5,00 5,00 5,00 5,00 5,00 8,50 5'
42 1,00 7,00 1,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,90 1'
73 19,00 16,00 16,00 16,00 16,00 16,00 16,00 16,00 16,00 16,00 16,30 5'
42 4,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,20 1'
73 580,00 599,00 613,00 639,00 621,00 601,00 590,00 630,00 629,00 622,00 612,40 5'
182 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 1'
518 15,00 15,00 15,00 15,00 15,00 15,00 15,00 15,00 15,00 15,00 15,00 5'
182 3,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,10 1'
518 10,00 5,00 6,00 5,00 6,00 6,00 6,00 6,00 6,00 6,00 6,20 5'
182 3,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,10 1'
518 14,00 10,00 10,00 10,00 10,00 10,00 10,00 10,00 10,00 10,00 10,40 5'
4080 13,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 3,10 1'
24352 35,00 15,00 15,00 15,00 15,00 15,00 15,00 15,00 15,00 15,00 17,00 5'
4080 3,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,20 1'
24352 9,00 6,00 7,00 6,00 6,00 6,00 6,00 6,00 6,00 6,00 6,40 5'
4080 3,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,20 1'
24352 9,00 7,00 7,00 7,00 7,00 7,00 7,00 7,00 7,00 7,00 7,20 5'
106 3,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,30 1'
339 9,00 5,00 5,00 5,00 5,00 5,00 5,00 5,00 5,00 5,00 5,40 5'
106 3,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,20 1'
339 8,00 5,00 6,00 6,00 6,00 6,00 6,00 6,00 6,00 6,00 6,10 5'
106 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1'
339 6,00 5,00 5,00 5,00 5,00 5,00 5,00 5,00 5,00 5,00 5,10 5'
188 3,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,20 1'
557 7,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,40 5'
188 2,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,20 1'
557 5,00 1,00 2,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,50 5'
188 1,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,10 1'
557 5,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,20 5'
2
sin optimización
Primer optimización
Segunda optimización
1
sin optimización
Primer optimización
Segunda optimización
Prueba Consulta Filas Devueltas Volumen
de datos
Tiempo expresado en segundos
5
sin optimización
Primer optimización
Segunda optimización
3
sin optimización
Primer optimización
Segunda optimización
4
sin optimización
Primer optimización
Segunda optimización
52
ANEXO 8
RESULTADOS DE LA SENTENCIA SELECT BAJO DBMS ORACLE 10G
Prueba 1 Prueba 2 Prueba 3 Prueba 4 Prueba 5 Prueba 6 Prueba 7 Prueba 8 Prueba 9 Prueba 10 Promedio
42 7,00 7,00 7,00 7,00 6,00 6,00 6,00 7,00 7,00 7,00 6,70 1'
73 27,00 25,00 27,00 28,00 25,00 25,00 25,00 25,00 25,00 25,00 25,70 5'
42 0,33 0,16 0,16 0,14 0,14 0,14 0,14 0,13 0,14 0,16 0,16 1'
73 27,33 29,28 27,68 28,00 29,53 27,83 27,96 27,41 28,41 28,31 28,17 5'
42 0,94 0,23 0,25 0,25 0,25 0,23 0,25 0,25 0,25 0,25 0,31 1'
73 27,58 27,22 27,75 30,11 27,95 28,16 27,40 28,81 27,32 28,29 28,06 5'
182 9,00 9,00 9,00 9,00 9,00 9,00 9,00 9,00 9,00 9,00 9,00 1'
518 57,00 55,00 55,00 55,00 55,00 55,00 55,00 55,00 55,00 55,00 55,20 5'
182 8,00 10,00 10,00 9,00 9,00 9,00 9,00 9,00 9,00 9,00 9,10 1'
518 656,33 603,76 611,73 640,10 612,89 639,28 643,05 638,22 625,52 649,41 632,03 5'
182 4,00 2,00 0,30 0,31 0,31 0,31 0,31 0,31 0,31 0,31 0,85 1'
518 358,27 310,24 313,41 311,16 321,07 327,40 330,07 331,84 319,92 327,69 325,11 5'
4080 14,00 7,00 1,00 0,67 0,67 0,67 0,69 0,67 0,67 0,67 2,67 1'
24352 30,00 31,00 30,00 30,00 30,00 30,00 30,00 30,00 30,00 30,00 30,10 5'
4080 7,00 7,00 7,00 6,00 7,00 7,00 7,00 7,00 7,00 7,00 6,90 1'
24352 28,00 27,00 27,00 27,00 27,00 27,00 27,00 27,00 27,00 27,00 27,10 5'
4080 9,00 8,00 8,00 8,00 8,00 8,00 8,00 8,00 8,00 8,00 8,10 1'
24352 29,00 29,00 29,00 29,00 29,00 29,00 29,00 29,00 29,00 29,00 29,00 5'
106 21,51 18,16 17,27 17,25 20,63 20,48 20,00 17,89 19,84 20,11 19,31 1'
339 48,88 40,92 38,64 39,94 48,87 46,90 44,79 46,68 48,26 45,63 44,95 5'
106 16,00 16,00 15,00 15,00 15,00 15,00 15,00 15,00 15,00 15,00 15,20 1'
339 28,78 29,92 29,45 28,70 29,02 29,02 28,84 29,27 29,41 28,90 29,13 5'
106 16,00 15,00 15,00 16,00 15,00 15,00 15,00 15,00 15,00 15,00 15,20 1'
339 34,13 32,48 32,82 33,98 33,66 33,71 33,82 33,70 32,55 32,70 33,35 5'
188 20,00 1,00 2,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 3,00 1'
557 28,00 27,00 27,00 27,00 27,00 27,00 27,00 27,00 27,00 27,00 27,10 5'
188 0,76 0,77 0,30 0,30 0,28 0,28 0,30 0,30 0,30 0,28 0,39 1'
557 28,00 27,00 27,00 27,00 27,00 27,00 27,00 27,00 27,00 27,00 27,10 5'
188 0,67 0,27 0,27 0,27 0,28 0,27 0,27 0,27 0,27 0,27 0,31 1'
557 28,00 28,00 28,00 28,00 28,00 28,00 28,00 28,00 28,00 28,00 28,00 5'
2
sin optimización
Primer optimización
Segunda optimización
1
sin optimización
Primer optimización
Segunda optimización
Prueba Consulta Filas Devueltas Volumen
de datos
Tiempo expresado en segundos
5
sin optimización
Primer optimización
Segunda optimización
3
sin optimización
Primer optimización
Segunda optimización
4
sin optimización
Primer optimización
Segunda optimización
53
ANEXO 9
RESULTADOS DE LA SENTENCIA UPDATE BAJO DBMS POSTGRES 9.0
Prueba 1 Prueba 2 Prueba 3 Prueba 4 Prueba 5 Prueba 6 Prueba 7 Prueba 8 Prueba 9 Prueba 10 Promedio
9065 15,75 9,00 8,54 9,35 10,15 11,64 8,33 8,81 7,94 10,10 9,96 1'
41280 348,24 244,83 250,54 271,43 263,26 254,13 346,86 271,73 318,08 309,37 287,85 5'
9065 6,90 6,42 6,34 6,85 6,79 6,88 5,40 7,11 6,82 7,92 6,74 1'
41280 61,42 59,04 60,13 60,43 61,00 59,18 59,54 59,55 61,16 59,12 60,06 5'
9065 5,56 5,22 5,46 6,16 6,27 6,13 6,05 6,12 6,33 6,08 5,94 1'
41280 55,76 55,70 55,73 55,70 55,74 55,75 55,71 55,71 55,72 55,72 55,72 5'
21 277,12 273,37 276,40 273,91 275,14 275,85 274,14 273,64 276,13 276,72 275,24 1'
108 358,49 59,16 20,02 20,00 22,30 39,84 45,46 36,76 31,03 23,16 65,62 5'
21 22,45 22,58 22,46 22,47 22,46 22,48 22,46 22,56 22,56 22,53 22,50 1'
108 279,26 11,28 11,41 11,28 11,38 11,35 11,32 11,35 11,36 11,39 38,14 5'
21 39,23 46,76 2,87 2,90 2,81 2,77 2,68 2,75 2,72 2,70 10,82 1'
108 11,84 11,52 11,41 11,28 11,73 11,59 11,44 11,58 11,67 11,70 11,58 5'
2714 6,05 6,36 5,75 5,88 5,78 6,02 5,87 5,84 5,78 5,93 5,93 1'
14563 414,18 38,95 31,10 28,24 32,75 31,97 33,82 32,18 37,13 37,22 71,75 5'
2714 4,50 5,03 4,39 4,63 4,96 4,64 4,60 4,45 5,00 4,47 4,67 1'
14563 32,48 24,48 30,57 28,78 29,24 30,12 30,47 24,91 24,57 26,03 28,16 5'
2714 4,74 4,11 0,45 4,46 4,76 4,46 4,72 4,55 4,73 4,59 4,16 1'
14563 28,42 26,82 23,60 29,51 24,17 28,90 26,97 29,20 27,77 29,16 27,45 5'
702 384,82 13,14 8,52 9,07 8,72 11,06 8,72 11,79 9,55 8,83 47,42 1'
12211 1169,75 164,32 89,07 997,98 655,77 331,28 735,18 668,38 1120,81 228,68 616,12 5'
702 3,96 7,51 4,04 3,84 3,93 6,11 4,62 4,11 6,28 4,37 4,88 1'
12211 53,85 46,92 49,23 49,43 47,54 49,02 50,77 51,13 50,53 48,47 49,69 5'
702 3,91 3,85 4,01 4,02 3,87 3,92 3,97 3,90 3,91 3,91 3,93 1'
12211 31,09 28,96 30,52 29,78 30,64 30,67 30,65 29,00 29,76 30,83 30,19 5'
244 53,82 5,29 5,34 5,35 5,32 5,37 5,31 5,32 5,36 5,32 10,18 1'
978 1118,24 24,32 24,21 81,07 466,99 511,37 822,85 1114,85 973,12 234,93 537,20 5'
244 5,55 5,48 5,40 5,50 5,40 5,43 5,51 5,49 5,41 5,55 5,47 1'
978 24,37 24,21 24,34 24,24 24,30 24,28 24,24 24,34 24,28 24,28 24,29 5'
244 3,26 3,21 3,20 3,20 3,20 3,24 3,23 3,23 3,25 3,21 3,22 1'
978 13,88 13,99 13,95 13,97 13,96 13,98 13,96 13,97 13,95 13,97 13,96 5'
5
sin optimización
Primer optimización
Segunda optimización
3
sin optimización
Primer optimización
Segunda optimización
4
sin optimización
Primer optimización
Segunda optimización
2
sin optimización
Primer optimización
Segunda optimización
1
sin optimización
Primer optimización
Segunda optimización
Volumen
de datosPrueba Consulta
Registros
Actualizadas
Tiempo expresado en segundos
54
ANEXO 10
RESULTADOS DE LA SENTENCIA UPDATE BAJO DBMS SQL SERVER 2008 R2
Prueba 1 Prueba 2 Prueba 3 Prueba 4 Prueba 5 Prueba 6 Prueba 7 Prueba 8 Prueba 9 Prueba 10 Promedio
9065 3,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,20 1'
41280 8,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,50 5'
9065 0,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 1,80 1'
41280 8,00 6,00 6,00 6,00 6,00 6,00 6,00 6,00 6,00 6,00 6,20 5'
9065 2,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,10 1'
41280 8,00 6,00 5,00 6,00 6,00 6,00 5,00 6,00 6,00 6,00 6,00 5'
21 5,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,40 1'
108 35,00 18,00 18,00 18,00 18,00 18,00 18,00 18,00 18,00 18,00 19,70 5'
21 2,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,10 1'
108 8,00 6,00 6,00 6,00 6,00 6,00 6,00 6,00 6,00 6,00 6,20 5'
21 2,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,20 1'
108 9,00 7,00 7,00 7,00 7,00 7,00 7,00 7,00 7,00 7,00 7,20 5'
2714 5,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,20 1'
14563 18,00 10,00 10,00 10,00 10,00 10,00 10,00 10,00 10,00 10,00 10,80 5'
2714 3,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,10 1'
14563 24,00 19,00 19,00 19,00 18,00 19,00 19,00 19,00 19,00 19,00 19,40 5'
2714 3,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,10 1'
14563 21,00 18,00 17,00 17,00 17,00 17,00 17,00 17,00 17,00 17,00 17,50 5'
702 11,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 2,00 1'
12211 19,00 11,00 11,00 12,00 11,00 11,00 11,00 11,00 11,00 11,00 11,90 5'
702 1,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,10 1'
12211 16,00 11,00 11,00 11,00 11,00 11,00 11,00 11,00 11,00 11,00 11,50 5'
702 1,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,10 1'
12211 150,00 147,00 145,00 145,00 145,00 145,00 145,00 145,00 145,00 145,00 145,70 5'
244 2,00 1,00 1,00 0,00 0,00 1,00 1,00 1,00 1,00 1,00 0,90 1'
978 826,00 801,00 798,00 801,00 800,00 801,00 801,00 801,00 801,00 801,00 803,10 5'
244 1,00 1,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,20 1'
978 824,00 812,00 818,00 818,00 818,00 820,00 820,00 820,00 820,00 819,00 818,90 5'
244 1,00 1,00 1,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,30 1'
978 1113,00 1109,00 1109,00 1108,00 1108,00 1109,00 1109,00 1108,00 1109,00 1109,00 1109,10 5'
5
sin optimización
Primer optimización
Segunda optimización
3
sin optimización
Primer optimización
Segunda optimización
4
sin optimización
Primer optimización
Segunda optimización
2
sin optimización
Primer optimización
Segunda optimización
1
sin optimización
Primer optimización
Segunda optimización
Prueba ConsultaVolumen
de datos
Registros
Actualizadas
Tiempo expresado en segundos
55
ANEXO 11
RESULTADOS DE LA SENTENCIA UPDATE BAJO DBMS ORACLE 10G
Prueba 1 Prueba 2 Prueba 3 Prueba 4 Prueba 5 Prueba 6 Prueba 7 Prueba 8 Prueba 9 Prueba 10 Promedio
9065 0,41 0,41 0,04 0,42 0,04 0,41 0,41 0,41 0,41 0,41 0,33 1'
41280 3,04 28,55 28,05 28,56 28,71 28,45 28,34 28,54 28,54 28,54 25,93 5'
9065 9,44 9,63 0,98 9,88 9,58 9,38 9,83 9,85 0,97 9,83 7,94 1'
41280 28,34 28,54 28,66 28,46 28,43 28,46 28,65 28,60 28,35 28,32 28,48 5'
9065 10,02 10,19 10,14 10,13 10,37 10,27 10,65 10,88 10,66 10,75 10,41 1'
41280 28,14 28,38 28,24 28,35 28,32 28,37 28,95 28,32 28,42 28,97 28,45 5'
21 3,85 0,48 0,48 0,48 0,48 0,48 0,48 0,48 0,48 0,48 0,82 1'
108 70,59 71,64 71,55 70,60 71,14 70,85 71,46 71,34 71,39 71,52 71,21 5'
21 1,51 0,50 0,50 0,50 0,50 0,50 0,50 0,50 0,50 0,50 0,60 1'
108 31,48 31,40 30,97 30,99 31,26 31,16 31,38 30,97 31,00 31,04 31,17 5'
21 0,94 0,48 0,48 0,48 0,48 0,48 0,48 0,48 0,48 0,48 0,53 1'
108 28,87 28,22 28,56 28,65 28,32 28,64 28,46 28,41 28,49 28,33 28,50 5'
2714 7,97 0,34 0,36 0,34 0,34 0,34 0,34 0,34 0,34 0,34 1,11 1'
14563 620,99 600,66 612,93 606,91 620,15 602,52 620,17 604,05 602,83 611,51 610,27 5'
2714 0,66 0,30 0,28 0,30 0,30 0,30 0,30 0,30 0,30 0,30 0,33 1'
14563 100,68 150,39 108,48 129,12 135,93 145,20 129,70 121,97 144,31 103,17 126,90 5'
2714 0,34 0,27 0,27 0,27 0,27 0,27 0,27 0,27 0,27 0,27 0,27 1'
14563 98,77 99,31 98,96 99,29 99,00 98,96 98,95 98,93 98,86 98,82 98,98 5'
702 63,10 1,98 0,67 0,47 0,47 0,47 0,47 0,47 0,47 0,47 6,90 1'
14563 980,73 865,87 876,56 885,56 942,71 932,94 883,79 889,70 906,81 891,57 905,62 5'
702 3,87 0,59 0,58 0,59 0,59 0,59 0,59 0,59 0,59 0,59 0,92 1'
14563 250,30 239,56 237,82 247,05 246,26 239,36 245,29 248,95 237,16 244,21 243,60 5'
702 0,44 0,36 0,36 0,37 0,37 0,37 0,37 0,37 0,37 0,37 0,38 1'
14563 63,74 73,98 73,37 71,26 69,61 65,44 70,16 72,78 71,76 69,19 70,13 5'
244 22,67 0,48 0,80 0,31 0,31 0,31 0,31 0,31 0,31 0,31 2,61 1'
978 56,78 55,68 54,76 55,50 55,77 55,57 55,17 56,01 56,75 54,93 55,69 5'
244 0,33 0,31 0,33 0,31 0,33 0,31 0,31 0,31 0,31 0,31 0,32 1'
978 54,90 52,68 50,30 50,46 51,13 52,69 51,49 53,93 51,26 50,67 51,95 5'
244 0,34 0,25 0,25 0,25 0,27 0,03 0,03 0,03 0,03 0,03 0,15 1'
978 52,70 48,84 52,54 51,38 51,99 49,34 51,02 50,28 49,34 50,46 50,79 5'
5
sin optimización
Primer optimización
Segunda optimización
3
sin optimización
Primer optimización
Segunda optimización
4
sin optimización
Primer optimización
Segunda optimización
2
sin optimización
Primer optimización
Segunda optimización
1
sin optimización
Primer optimización
Segunda optimización
Prueba ConsultaRegistros
Actualizadas
Volumen
de datos
Tiempo expresado en segundos
56
ANEXO 12
RESULTADOS DE LA SENTENCIA DELETE BAJO DBMS POSTGRES 9.0
Prueba 1 Prueba 2 Prueba 3 Prueba 4 Prueba 5 Prueba 6 Prueba 7 Prueba 8 Prueba 9 Prueba 10 Promedio
71 589,14 3,61 3,59 3,65 3,51 3,60 3,52 3,54 3,52 3,54 62,12 1'
470 206,01 8,15 7,45 7,42 7,41 7,47 7,38 7,49 7,37 7,33 27,35 5'
71 3,73 3,47 3,34 3,40 3,40 3,33 3,34 3,35 3,34 3,39 3,41 1'
470 194,60 7,40 7,26 7,20 7,14 7,20 7,06 7,05 7,04 7,15 25,91 5'
71 3,42 3,07 2,97 2,95 2,97 2,94 2,99 2,93 2,96 2,93 3,01 1'
470 7,51 5,93 6,03 5,78 5,83 5,91 5,84 5,76 5,79 5,78 6,02 5'
15892 44,62 11,87 7,32 6,46 7,22 6,51 8,64 6,32 7,39 5,13 11,15 1'
90391 388,25 62,71 62,65 66,04 71,73 62,93 69,97 65,12 70,42 63,32 98,31 5'
15892 26,91 4,48 4,24 5,54 5,09 4,29 5,98 4,56 4,24 5,62 7,09 1'
90391 70,70 62,56 58,31 61,78 64,88 63,51 70,92 73,77 64,13 61,31 65,19 5'
15892 7,61 4,02 4,01 5,13 5,21 4,65 7,44 3,78 5,40 3,96 5,12 1'
90391 52,62 56,75 56,11 53,65 50,98 50,19 54,18 48,02 59,59 53,76 53,58 5'
122 41,31 40,90 40,78 40,76 40,80 40,86 40,79 40,87 40,73 40,81 40,86 1'
1155 258,93 246,33 244,50 244,66 250,42 246,17 245,17 245,54 244,91 245,33 247,20 5'
122 47,27 40,96 41,01 40,91 40,89 40,86 40,92 40,79 40,92 40,93 41,54 1'
1155 254,55 185,45 141,80 166,88 163,60 167,73 187,51 145,33 125,71 134,65 167,32 5'
122 28,10 0,90 0,79 0,79 0,79 0,77 0,85 0,79 0,81 0,79 3,54 1'
1155 92,34 1,42 1,28 1,26 1,27 1,27 1,29 1,28 1,28 1,28 10,40 5'
29 41,05 40,74 40,82 40,67 40,73 40,81 40,67 40,67 40,83 40,78 40,78 1'
1559 263,05 244,46 245,12 244,52 245,15 243,71 245,32 244,74 245,18 244,14 246,54 5'
29 22,96 2,04 2,06 2,05 2,04 2,06 2,18 2,03 2,06 2,05 4,15 1'
1559 170,59 160,27 167,35 165,27 162,96 164,39 168,87 164,55 165,00 163,48 165,27 5'
29 54,75 1,06 1,04 1,04 1,07 1,03 1,03 1,03 1,05 1,03 6,41 1'
1559 123,62 3,86 2,95 3,00 2,97 2,95 3,04 2,96 3,04 2,98 15,14 5'
506 41,39 41,07 41,40 41,22 41,35 41,28 41,36 41,26 41,34 41,20 41,29 1'
3103 255,35 244,74 254,19 249,59 246,48 254,36 244,83 244,91 246,29 254,40 249,51 5'
506 45,35 2,12 2,13 2,11 2,16 2,12 2,12 2,11 2,14 2,16 6,45 1'
3103 166,92 5,29 5,18 5,18 5,16 5,16 5,21 5,16 5,16 5,17 21,36 5'
506 40,47 0,40 0,40 0,40 0,40 0,40 0,39 0,40 0,39 0,38 4,40 1'
3103 25,23 0,55 0,54 0,53 0,54 0,54 0,53 0,52 0,54 0,52 3,00 5'
5
sin optimización
Primer optimización
Segunda optimización
3
sin optimización
Primer optimización
Segunda optimización
4
sin optimización
Primer optimización
Segunda optimización
2
sin optimización
Primer optimización
Segunda optimización
1
sin optimización
Primer optimización
Segunda optimización
Prueba ConsultaFilas
Eliminadas
Volumen
de datos
Tiempo expresado en segundos
57
ANEXO 13
RESULTADOS DE LA SENTENCIA DELETE BAJO DBMS SQL SERVER 2008 R2
Prueba 1 Prueba 2 Prueba 3 Prueba 4 Prueba 5 Prueba 6 Prueba 7 Prueba 8 Prueba 9 Prueba 10 Promedio
71 8,00 12,00 11,00 11,00 11,00 11,00 11,00 11,00 11,00 11,00 10,80 1'
470 64,00 25,00 25,00 25,00 25,00 25,00 25,00 25,00 25,00 25,00 28,90 5'
71 8,00 8,00 8,00 8,00 8,00 8,00 8,00 8,00 8,00 8,00 8,00 1'
470 25,00 25,00 25,00 25,00 25,00 25,00 25,00 25,00 25,00 25,00 25,00 5'
71 7,00 7,00 7,00 7,00 7,00 7,00 7,00 7,00 7,00 7,00 7,00 1'
470 23,00 24,00 24,00 24,00 24,00 23,00 23,00 23,00 23,00 23,00 23,40 5'
15892 11,00 10,00 10,00 10,00 10,00 10,00 10,00 10,00 10,00 10,00 10,10 1'
90391 35,00 34,00 34,00 34,00 34,00 34,00 34,00 34,00 34,00 34,00 34,10 5'
15892 11,00 11,00 11,00 11,00 11,00 11,00 11,00 11,00 11,00 11,00 11,00 1'
90391 35,00 35,00 35,00 35,00 35,00 35,00 35,00 35,00 35,00 35,00 35,00 5'
15892 11,00 11,00 11,00 11,00 11,00 11,00 11,00 11,00 11,00 11,00 11,00 1'
90391 38,00 38,00 38,00 38,00 38,00 38,00 38,00 38,00 38,00 38,00 38,00 5'
122 7,00 7,00 7,00 7,00 7,00 7,00 7,00 7,00 7,00 7,00 7,00 1'
1155 25,00 25,00 25,00 25,00 25,00 25,00 25,00 25,00 25,00 25,00 25,00 5'
122 6,00 7,00 6,00 6,00 6,00 6,00 6,00 6,00 6,00 6,00 6,10 1'
1155 27,00 27,00 27,00 27,00 26,00 26,00 27,00 27,00 27,00 27,00 26,80 5'
122 7,00 7,00 7,00 6,00 6,00 7,00 6,00 6,00 6,00 7,00 6,50 1'
1155 23,00 22,00 22,00 22,00 22,00 22,00 22,00 22,00 22,00 22,00 22,10 5'
29 29,00 28,00 28,00 28,00 28,00 28,00 28,00 28,00 28,00 28,00 28,10 1'
1559 24,00 24,00 24,00 24,00 24,00 24,00 24,00 24,00 24,00 24,00 24,00 5'
29 8,00 8,00 8,00 8,00 8,00 8,00 8,00 8,00 8,00 8,00 8,00 1'
1559 24,00 24,00 24,00 24,00 24,00 24,00 24,00 24,00 24,00 24,00 24,00 5'
29 7,00 7,00 7,00 7,00 7,00 7,00 7,00 7,00 7,00 7,00 7,00 1'
1559 24,00 24,00 24,00 24,00 24,00 24,00 24,00 24,00 24,00 24,00 24,00 5'
506 5,00 5,00 5,00 5,00 5,00 5,00 5,00 5,00 5,00 5,00 5,00 1'
3103 14,00 14,00 14,00 14,00 14,00 14,00 14,00 14,00 14,00 14,00 14,00 5'
506 6,00 6,00 6,00 6,00 6,00 6,00 6,00 6,00 6,00 6,00 6,00 1'
3103 26,00 26,00 26,00 26,00 26,00 26,00 26,00 26,00 26,00 26,00 26,00 5'
506 7,00 7,00 7,00 7,00 7,00 7,00 7,00 7,00 7,00 7,00 7,00 1'
3103 27,00 27,00 26,00 27,00 27,00 27,00 27,00 27,00 26,00 26,00 26,70 5'
5
sin optimización
Primer optimización
Segunda optimización
3
sin optimización
Primer optimización
Segunda optimización
4
sin optimización
Primer optimización
Segunda optimización
2
sin optimización
Primer optimización
Segunda optimización
1
sin optimización
Primer optimización
Segunda optimización
Prueba ConsultaFilas
Eliminadas
Volumen
de datos
Tiempo expresado en segundos
58
ANEXO 14
RESULTADOS DE LA SENTENCIA DELETE BAJO DBMS ORACLE 10G
Prueba 1 Prueba 2 Prueba 3 Prueba 4 Prueba 5 Prueba 6 Prueba 7 Prueba 8 Prueba 9 Prueba 10 Promedio
71 1,30 2,06 4,23 0,45 0,45 0,45 0,45 0,45 0,45 0,45 1,08 1'
470 33,73 28,78 30,22 28,25 29,30 28,04 30,31 29,48 29,40 29,87 29,74 5'
71 3,07 0,44 0,44 0,44 0,44 0,44 0,44 0,44 0,44 0,44 0,70 1'
470 29,83 28,78 28,95 28,95 28,67 28,75 28,96 28,94 28,56 28,05 28,85 5'
71 4,34 0,55 0,53 0,55 0,56 0,53 0,55 0,55 0,55 0,55 0,92 1'
470 29,36 28,81 29,02 28,80 30,69 28,99 28,84 28,83 28,35 28,97 29,06 5'
15892 30,10 1,47 1,50 1,58 1,76 1,50 1,44 1,45 0,00 0,01 4,08 1'
90391 497,86 409,89 407,77 459,98 453,69 434,61 466,49 429,40 431,77 444,09 443,55 5'
15892 4,99 1,44 1,54 2,18 1,47 15,43 15,10 14,85 29,46 28,77 11,52 1'
90391 359,23 310,80 299,60 322,95 311,56 302,44 348,69 322,70 313,13 311,31 320,24 5'
15892 3,20 0,95 0,94 0,95 0,95 0,95 0,95 0,95 0,95 0,95 1,18 1'
90391 250,67 239,88 233,96 245,50 249,31 232,37 231,63 248,10 250,59 233,27 241,53 5'
122 9,64 9,56 8,63 8,42 8,42 8,42 8,42 8,42 8,42 8,42 8,68 1'
1155 37,12 29,58 29,89 30,26 29,39 29,43 29,76 29,09 29,08 29,66 30,33 5'
122 9,14 9,19 8,77 9,25 8,88 8,74 8,91 8,66 8,96 8,66 8,91 1'
1155 29,91 29,91 29,47 30,09 29,78 29,99 29,99 29,99 29,56 30,01 29,87 5'
122 0,36 0,34 0,34 0,33 0,34 0,33 0,33 0,33 0,34 0,33 0,34 1'
1155 29,23 35,30 30,30 32,21 34,43 33,51 32,25 32,32 33,35 30,24 32,31 5'
29 12,90 12,68 11,32 12,43 11,13 12,32 12,45 12,66 12,11 12,05 12,20 1'
1559 52,46 50,40 50,69 50,72 50,74 50,44 50,85 50,98 50,92 50,98 50,92 5'
29 10,98 11,09 10,25 10,17 10,92 10,97 10,58 10,87 10,33 10,53 10,67 1'
1559 43,38 42,88 42,43 43,56 42,90 43,27 42,46 42,48 43,54 43,27 43,02 5'
29 38,35 30,29 32,81 38,01 36,59 3,82 19,81 31,08 11,27 9,33 25,13 1'
1559 150,24 148,23 144,53 144,56 148,76 144,83 147,51 145,31 147,71 149,62 147,13 5'
506 22,25 11,67 11,68 11,56 21,08 17,62 14,52 14,79 18,97 18,43 16,26 1'
3103 85,75 80,28 78,34 76,10 82,40 84,90 81,60 82,03 84,14 81,49 81,70 5'
506 8,08 4,96 4,29 5,80 3,12 4,25 1,31 3,51 7,53 3,44 4,63 1'
3103 75,37 70,77 78,57 72,20 71,00 72,96 70,92 78,48 74,70 76,06 74,10 5'
506 2,48 2,37 1,84 1,01 1,07 2,35 0,97 1,97 0,69 0,79 1,55 1'
3103 50,57 50,88 50,79 50,79 50,62 50,70 50,73 50,87 50,61 50,64 50,72 5'
5
sin optimización
Primer optimización
Segunda optimización
3
sin optimización
Primer optimización
Segunda optimización
4
sin optimización
Primer optimización
Segunda optimización
2
sin optimización
Primer optimización
Segunda optimización
1
sin optimización
Primer optimización
Segunda optimización
Prueba ConsultaFilas
Eliminadas
Volumen
de datos
Tiempo expresado en segundos
59
ANEXO 15
RESULTADOS DE LA SENTENCIA INSERT BAJO DBMS POSTGRES 9.0
Prueba 1 Prueba 2 Prueba 3 Prueba 4 Prueba 5 Prueba 6 Prueba 7 Prueba 8 Prueba 9 Prueba 10 Promedio
332 356,52 356,29 356,50 356,34 356,39 356,48 356,30 356,34 356,32 356,39 356,39 1'
332 409,71 352,00 399,89 404,41 407,17 366,19 354,50 393,45 357,08 360,50 380,49 5'
332 19,04 17,84 17,61 17,94 17,76 18,22 17,85 17,93 17,73 17,60 17,95 1'
332 21,34 21,31 21,04 21,09 21,18 21,09 21,05 21,22 21,11 21,04 21,15 5'
332 3,25 3,01 3,10 3,24 3,21 3,08 3,17 3,05 3,16 3,21 3,15 1'
332 6,13 6,02 6,04 6,12 6,10 6,06 6,10 6,08 6,13 6,04 6,08 5'
2554 121,34 56,95 53,48 56,16 50,45 48,66 44,38 55,10 47,89 49,13 58,35 1'
2617 173,10 57,68 52,80 62,46 55,26 54,10 58,45 53,95 45,69 54,27 66,78 5'
2554 11,10 7,45 6,58 2,55 6,26 5,65 5,79 4,96 6,12 13,20 6,97 1'
2617 14,10 11,97 10,30 11,60 34,10 12,84 12,36 10,44 12,68 9,95 14,03 5'
2554 5,30 6,41 4,23 5,63 6,13 4,38 6,46 6,01 6,68 4,52 5,58 1'
2617 27,96 11,11 9,25 9,48 9,64 9,78 9,52 9,19 9,00 27,10 13,20 5'
624 303,22 200,63 180,77 176,84 179,93 174,78 177,47 175,91 166,97 179,20 191,57 1'
600 319,43 186,20 177,53 172,32 164,52 173,13 174,71 175,92 166,33 170,38 188,05 5'
624 64,10 30,75 30,61 29,20 28,53 31,42 32,76 38,31 35,56 34,66 35,59 1'
600 35,00 34,93 31,45 33,84 31,64 33,56 33,15 32,29 33,57 32,79 33,22 5'
624 33,11 34,80 34,32 32,71 31,68 34,91 33,24 29,44 29,14 30,75 32,41 1'
600 33,21 33,63 30,10 31,18 30,27 30,81 32,46 32,57 32,18 30,01 31,64 5'
3472 39,47 9,06 8,52 9,52 8,26 7,94 9,03 7,86 8,27 8,27 11,62 1'
3410 72,79 12,10 12,05 14,90 14,76 15,89 13,63 13,21 13,59 13,47 19,64 5'
3472 9,36 6,18 5,73 6,26 6,44 7,00 5,63 6,37 5,60 5,64 6,42 1'
3410 15,26 19,81 11,83 22,90 9,09 9,29 9,29 9,88 9,65 9,59 12,66 5'
3472 7,01 6,09 5,90 5,86 5,90 6,02 6,18 6,80 5,96 5,17 6,09 1'
3410 12,09 9,62 9,95 9,30 9,90 9,90 9,83 9,32 9,50 9,80 9,92 5'
1677 92,41 80,51 89,24 87,48 89,86 81,57 91,08 86,98 88,15 87,61 87,49 1'
1652 174,30 95,04 173,97 162,13 129,40 108,32 110,29 107,69 172,22 113,62 134,70 5'
1677 6,22 6,16 6,19 6,22 6,18 6,20 6,19 6,19 6,18 6,18 6,19 1'
1652 15,56 14,23 9,66 9,96 9,02 10,90 8,56 9,00 10,09 8,72 10,57 5'
1677 4,50 4,25 4,75 4,36 4,38 4,60 4,71 5,18 4,22 4,38 4,53 1'
1652 12,39 8,26 12,29 12,29 8,07 8,03 7,84 8,14 8,02 9,44 9,48 5'
5
sin optimización
Primer optimización
Segunda optimización
Primer optimización
Segunda optimización
4
sin optimización
Primer optimización
Segunda optimización
3
sin optimización
Primer optimización
Segunda optimización
Prueba ConsultaVolumen
de datosFilas Agregadas
Tiempo expresado en segundos
1
sin optimización
Primer optimización
Segunda optimización
2
sin optimización
60
ANEXO 16
RESULTADOS DE LA SENTENCIA INSERT BAJO DBMS SQL SERVER 2008 R2
Prueba 1 Prueba 2 Prueba 3 Prueba 4 Prueba 5 Prueba 6 Prueba 7 Prueba 8 Prueba 9 Prueba 10 Promedio
332 2,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,10 1'
332 27,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 3,60 5'
332 3,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,20 1'
332 7,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,60 5'
332 2,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,20 1'
332 6,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,50 5'
2554 7,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,60 1'
2617 4,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,10 5'
2554 4,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,30 1'
2617 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 5'
2554 174,00 175,00 175,00 175,00 175,00 175,00 175,00 175,00 175,00 175,00 174,90 1'
2617 176,00 176,00 176,00 176,00 176,00 176,00 176,00 176,00 176,00 176,00 176,00 5'
624 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 1'
600 7,00 4,00 4,00 4,00 4,00 4,00 4,00 4,00 4,00 4,00 4,30 5'
624 23,00 21,00 21,00 21,00 21,00 21,00 21,00 21,00 21,00 21,00 21,20 1'
600 27,00 24,00 24,00 24,00 24,00 24,00 24,00 24,00 24,00 24,00 24,30 5'
624 2,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,00 1,10 1'
600 7,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,40 5'
3472 12,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,90 1'
3410 6,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,40 5'
3472 5,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,30 1'
3410 6,00 3,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,50 5'
3472 6,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,30 1'
3410 6,00 6,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,00 3,60 5'
1677 5,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,30 1'
1652 6,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,40 5'
1677 3,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,10 1'
1652 5,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,30 5'
1677 3,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,00 2,10 1'
1652 7,00 4,00 4,00 4,00 4,00 4,00 4,00 4,00 4,00 4,00 4,30 5'
5
sin optimización
Primer optimización
Segunda optimización
3
sin optimización
Primer optimización
Segunda optimización
4
sin optimización
Primer optimización
Segunda optimización
2
sin optimización
Primer optimización
Segunda optimización
1
sin optimización
Primer optimización
Segunda optimización
Prueba Consulta Filas AgregadasVolumen
de datos
Tiempo expresado en segundos
61
ANEXO 17
RESULTADOS DE LA SENTENCIA INSERT BAJO DBMS ORACLE 10G
Prueba 1 Prueba 2 Prueba 3 Prueba 4 Prueba 5 Prueba 6 Prueba 7 Prueba 8 Prueba 9 Prueba 10 Promedio
332,00 31,60 23,19 24,27 23,73 23,28 23,42 23,88 23,57 23,77 23,88 24,46 1'
332,00 43,69 42,13 42,79 41,32 42,36 43,51 42,50 42,07 42,24 42,46 42,51 5'
332,00 15,49 10,21 11,80 10,46 15,16 10,58 14,01 11,86 13,05 11,18 12,38 1'
332,00 28,71 27,67 31,47 27,77 31,29 29,30 30,32 29,09 30,98 29,27 29,59 5'
332,00 10,47 9,68 10,05 9,99 10,29 10,44 10,27 9,74 9,90 9,77 10,06 1'
332,00 27,80 27,49 32,33 27,90 30,07 31,24 28,77 29,73 29,51 28,34 29,32 5'
2554,00 643,45 661,90 650,96 643,91 671,62 652,30 645,43 664,19 659,73 652,18 654,57 1'
2617,00 737,10 840,08 836,31 833,01 747,05 809,75 788,53 763,59 769,37 791,09 791,59 5'
2554,00 8,10 9,55 8,94 2,55 3,84 7,36 8,83 3,96 8,55 4,62 6,63 1'
2617,00 26,70 27,55 26,88 27,26 13,51 2,95 17,02 13,28 14,46 26,28 19,59 5'
2554,00 8,60 0,92 9,12 9,27 9,11 8,63 8,71 8,74 8,63 8,71 8,04 1'
2617,00 27,37 27,26 38,85 27,46 33,59 34,17 38,35 37,12 37,62 31,19 33,30 5'
624,00 9,06 8,25 8,89 8,69 8,41 8,42 8,44 8,72 8,73 9,02 8,66 1'
600,00 27,77 27,44 27,41 27,47 27,54 27,69 27,73 27,68 27,60 27,45 27,58 5'
624,00 9,58 8,64 9,05 9,00 9,37 9,14 9,44 9,24 9,18 9,51 9,21 1'
600,00 27,44 27,08 27,49 29,47 27,18 28,58 27,88 28,36 28,73 27,88 28,01 5'
624,00 9,67 9,05 8,92 8,77 9,03 8,94 9,13 9,10 9,26 9,25 9,11 1'
600,00 27,31 27,11 27,83 29,22 27,31 29,03 29,00 28,32 28,18 28,86 28,22 5'
5363,00 27,71 15,71 15,90 16,60 24,13 16,87 20,24 15,79 23,16 24,95 20,10 1'
5273,00 33,32 34,09 32,26 32,40 32,87 33,15 33,08 32,88 32,70 33,29 33,00 5'
5363,00 16,36 16,51 16,66 15,57 16,49 16,59 16,59 16,43 16,59 16,44 16,42 1'
5273,00 32,49 32,68 32,45 32,43 32,64 32,57 32,45 32,51 32,46 32,64 32,53 5'
5363,00 14,74 14,01 14,31 15,19 14,24 14,39 14,73 14,32 14,63 14,04 14,46 1'
5273,00 31,31 31,14 31,25 31,24 31,16 31,23 31,14 31,14 31,26 31,30 31,22 5'
1677,00 28,86 21,43 22,31 22,59 23,10 24,55 26,43 21,75 27,44 26,69 24,51 1'
1652,00 57,88 40,11 42,81 42,82 46,51 55,11 48,61 51,75 46,13 45,22 47,69 5'
1677,00 11,39 11,44 11,51 11,51 11,43 11,47 11,50 11,48 11,45 11,44 11,46 1'
1652,00 41,12 29,16 30,80 29,36 37,56 29,92 38,55 30,91 32,49 30,92 33,08 5'
1677,00 12,36 11,65 11,89 11,53 11,62 11,64 11,94 12,16 12,04 11,95 11,88 1'
1652,00 20,47 32,69 30,50 29,55 29,94 26,50 26,92 32,01 30,75 25,30 28,46 5'
5
sin optimización
Primer optimización
Segunda optimización
3
sin optimización
Primer optimización
Segunda optimización
4
sin optimización
Primer optimización
Segunda optimización
2
sin optimización
Primer optimización
Segunda optimización
1
sin optimización
Primer optimización
Segunda optimización
Prueba Consulta Filas AgregadasVolumen
de datos
Tiempo expresado en segundos
62
ANEXO 18
RESULTADOS EN POSTGRES CON 1 MILLON DE DATOS.
Sentencia Sentencias
Delete_1OPT Delete_2OPT Delete_SOPT Insert_1OPT Insert_2OPT Insert_SOPT Select_1OPT Select_2OPT Select_SOPT Update_1OPT Update_2OPT Update_SOPT
Sentencia 1 3,41 3,01 62,12 17,95 3,15 356,39 41,83 4,95 14,84 6,74 5,94 9,96
Sentencia 2 7,09 5,12 11,15 6,97 5,58 58,35 8,45 2,11 47,4 22,5 10,82 275,24
Sentencia 3 41,54 3,54 40,86 35,59 32,41 191,57 2,3 1,61 14,22 4,67 4,16 5,93
Sentencia 4 4,15 6,41 40,78 6,42 6,09 11,62 1,27 1,1 2,94 4,88 3,93 47,42
Sentencia 5 6,45 4,4 41,29 6,19 4,53 87,49 4,33 0,95 228,77 5,47 3,22 10,18
Promedio 12,53 4,50 39,24 14,62 10,35 141,08 11,64 2,14 61,63 8,85 5,61 69,75
Gráfico 32 Resultado con 1 millón de datos en POSTGRES 9.0.
ANEXO 19
RESULTADOS EN POSTGRES CON 5 MILLONES DE DATOS.
Sentencia Sentencias
Delete_1OPT Delete_2OPT Delete_SOPT Insert_1OPT Insert_2OPT Insert_SOPT Select_1OPT Select_2OPT Select_SOPT Update_1OPT Update_2OPT Update_SOPT
Sentencia 1 25,91 6,02 27,35 21,15 6,08 380,49 21,84 0,64 78,55 60,06 55,72 287,85
Sentencia 2 65,19 53,58 98,31 14,03 13,2 66,78 38,56 12,11 259,05 38,14 11,58 65,62
Sentencia 3 167,32 10,4 247,2 33,22 31,64 188,05 9,63 26,08 332,31 28,16 27,45 71,75
Sentencia 4 165,27 15,14 246,54 12,66 9,92 19,64 1,21 1,12 23,3 49,69 30,19 616,12
Sentencia 5 21,36 3 249,51 10,57 9,48 134,7 14,33 1,13 763,74 24,29 13,96 537,2
Promedio 89,01 17,63 173,78 18,33 14,06 157,93 17,11 8,22 291,39 40,07 27,78 315,71
Gráfico 33. Resultado con 5 millones de datos en POSTGRES 9.0.
63
ANEXO 20
RESULTADOS EN SQL SERVER 2008 R2 CON 1 MILLON DE DATOS.
Sentencia Sentencias
Delete_1OPT Delete_2OPT Delete_SOPT Insert_1OPT Insert_2OPT Insert_SOPT Select_1OPT Select_2OPT Select_SOPT Update_1OPT Update_2OPT Update_SOPT
Sentencia 1 8 7 10,8 1,2 0,2 1,1 0,9 2,2 0,8 1,80 1,1 1,2
Sentencia 2 11 11 10,1 1,3 174,9 1,6 2,1 2,1 2 1,1 0,2 1,4
Sentencia 3 6,1 6,5 7 21,2 1,1 2 1,2 1,2 3,1 2,1 2,1 3,2
Sentencia 4 8 7 28,1 2,3 3,3 3,9 1,2 1 0,3 0,1 0,1 2
Sentencia 5 6 7 5 2,1 2,1 2,3 0,2 0,1 1,2 0,2 0,3 0,9
Promedio 7,8 7,7 12,2 5,6 36,3 2,2 1,1 1,3 1,5 1,1 0,8 1,7
Gráfico 34 Resultado con 1 millón de datos en SQL SERVER 2008 R2.
ANEXO 21
RESULTADOS EN SQL SEVER 2008 R2 CON 5 MILLONES DE DATOS.
Sentencia Sentencias
Delete_1OPT Delete_2OPT Delete_SOPT Insert_1OPT Insert_2OPT Insert_SOPT Select_1OPT Select_2OPT Select_SOPT Update_1OPT Update_2OPT Update_SOPT
Sentencia 1 25 23,4 28,9 1,6 1,5 3,6 16,3 612,4 8,5 6,2 6 3,5
Sentencia 2 35 38 34,1 3 176 3,1 6,2 10,4 15 6,2 7,2 19,7
Sentencia 3 26,8 22,1 25 24,3 3,4 4,3 6,4 7,2 17 19,4 17,5 10,8
Sentencia 4 24 24 24 2,5 3,6 2,4 6,1 5,1 5,4 11,5 145,7 11,9
Sentencia 5 26 26,7 14 2,3 4,3 2,4 1,5 3,2 3,4 818,9 1109,1 803,1
Promedio 27,36 26,84 25,20 6,74 37,76 3,16 7,30 127,66 9,86 172,44 257,10 169,80
Gráfico 35. Resultado con 5 millones de datos en SERVER 2008 R2.
64
ANEXO 22
RESULTADOS EN ORACLE 10G CON 1 MILLON DE DATOS.
Sentencia Sentencias
Delete_1OPT Delete_2OPT Delete_SOPT Insert_1OPT Insert_2OPT Insert_SOPT Select_1OPT Select_2OPT Select_SOPT Update_1OPT Update_2OPT Update_SOPT
Sentencia 1 0,7006 0,9236 1,0752 12,3808 10,0593 24,4581 0,1624 0,3149 6,7 7,9352 10,4056 0,3341
Sentencia 2 11,5233 1,175 4,079231 6,6308 8,0444 654,5666 9,1 0,848 9 0,6004 0,5284 0,8201
Sentencia 3 8,914 0,337 8,6799 9,214 9,1117 8,6638 6,9 8,1 2,6713 0,3311 0,2729 1,1076
Sentencia 4 10,668 25,1348 12,2042 16,4222 14,4596 20,1044 15,2 15,2 19,313 0,9182 0,3772 6,9031
Sentencia 5 4,6292 1,5536 16,2561 11,4624 11,8767 24,5147 0,3853 0,3072 3 0,3167 0,1481 2,6129
Promedio 7,29 5,82 8,46 11,22 10,71 146,46 6,35 4,95 8,14 2,02 2,35 2,36
Gráfico 36 Resultado con 1 millón de datos en ORACLE 10G.
ANEXO 23
RESULTADOS EN ORACLE 10G CON 5 MILLONES DE DATOS.
Sentencia Sentencias
Delete_1OPT Delete_2OPT Delete_SOPT Insert_1OPT Insert_2OPT Insert_SOPT Select_1OPT Select_2OPT Select_SOPT Update_1OPT Update_2OPT Update_SOPT
Sentencia 1 28,8452 29,0646 29,7371 29,5858 29,319 42,5061 28,1748 28,0602 25,7 28,4808 28,4458 25,9327
Sentencia 2 320,2425 241,5273 443,5541 19,5888 33,2991 791,5872 632,0267 325,1059 55,2 31,1651 28,495 71,2068
Sentencia 3 29,8686 32,3144 30,3262 28,0085 28,2181 27,5782 27,1 29 30,1 126,8956 98,9837 610,2726
Sentencia 4 43,0167 147,1289 50,9196 32,5329 31,2158 33,0044 29,1307 33,3534 44,9483 243,5972 70,1269 905,6245
Sentencia 5 74,1028 50,7175 81,7026 33,0778 28,4609 47,6932 27,1 28 27,1 51,9493 50,7871 55,6914
Promedio 99,22 100,15 127,25 28,56 30,10 188,47 148,71 88,70 36,61 96,42 55,37 333,75
Gráfico 37. Resultado con 5 millones de datos en ORACLE 10G.
65
ANEXO 24 RECURSOS UTILIZADOS EN POSTGRES 9.0 CON UN MILLON DE DATOS.
cat0
1
cat0
4
ciu
dad
emi0
1
emi0
3
gen
01
gen
02
pro
vin
cia
pru
01
pru
05
pru
10
pru
20
pru
30
pru
50
pu
r01
pu
r02
pu
r04
pu
r05
pu
r06
regi
on
ren
20
ren
21
ren
agu
a
Tota
l Lec
tura
de
tab
las
Seq
Sca
n
Ind
ex S
can
Agg
rega
te
Win
do
ws
Agg
Has
Agr
egat
e
Gro
up
Agg
rega
te
Mat
eria
lize
Sub
qu
ery
Un
iqu
e
Sort
Mer
ge J
oin
Mer
ge S
emi J
oin
Has
sem
i jo
in
Has
Has
Jo
in
Nes
ted
Lo
op
Nes
ted
loo
p S
emi
join
f()
Tota
l Rec
urs
os
Uti
lizad
os
Sin Optimización 1 1 1 1 2 1 6 6 1 20 19 1 6 1 1 1 2 13 11 7 62
Primer Optimización 1 1 1 1 1 1 1 1 6 6 20 18 2 5 1 1 1 10 9 7 1 55
Segunda Optimización 1 1 2 1 1 1 1 1 13 13 35 33 2 2 3 5 4 1 15 65
Sin Optimización 1 1 2 3 1 1 1 1 1 3 3 1 19 17 2 3 1 2 3 1 1 8 8 4 4 54
Primer Optimización 1 1 2 5 1 1 1 1 1 3 3 1 21 21 5 1 1 1 2 1 2 13 11 3 3 64
Segunda Optimización 1 1 2 14 1 1 1 1 1 12 12 47 44 3 1 1 8 1 7 6 2 25 98
Sin Optimización 2 1 3 1 1 1 1 1 1 3 3 1 19 19 4 1 1 12 10 3 3 53
Primer Optimización 2 1 10 1 1 1 1 1 1 1 10 10 40 39 1 3 1 8 7 21 80
Segunda Optimización 2 1 11 1 1 1 1 1 1 11 10 41 40 1 1 10 52
Sin Optimización 1 6 1 1 1 1 6 6 23 21 2 6 1 2 8 8 7 7 62
Primer Optimización 1 16 1 1 1 1 1 15 15 52 50 2 1 1 6 3 3 1 25 92
Segunda Optimización 1 15 1 1 1 1 15 15 50 48 2 1 1 4 3 3 1 24 87
Sin Optimización 1 1 1 4 1 1 2 1 1 1 4 4 22 19 3 1 5 3 3 7 3 44
Primer Optimización 1 2 1 4 1 1 1 1 1 1 4 4 1 23 20 3 5 11 11 5 55
Segunda Optimización 1 1 1 13 1 1 1 1 1 1 13 13 1 49 46 3 2 6 6 1 13 77
Sin Optimización 1 1 1 2 1 1 1 1 1 2 2 14 14 2 1 1 1 1 9 8 2 2 41
Primer Optimización 1 1 1 7 1 1 1 1 2 6 6 28 28 1 2 4 9 5 11 1 61
Segunda Optimización 1 1 1 7 1 1 1 1 1 6 6 27 27 2 3 8 5 11 1 57
Sin Optimización 2 4 2 2 2 4 4 1 21 18 3 2 1 3 1 4 3 6 7 48
Primer Optimización 1 8 2 3 2 7 7 1 31 27 4 1 5 1 2 1 2 18 61
Segunda Optimización 1 7 2 2 2 7 7 1 29 28 1 1 2 1 7 7 1 14 62
Sin Optimización 2 5 1 1 1 4 4 18 16 2 2 1 2 2 5 3 5 2 40
Primer Optimización 2 8 1 1 1 8 8 29 27 2 1 1 2 2 4 2 1 8 50
Segunda Optimización 2 8 1 1 1 8 8 29 27 2 1 1 2 1 3 2 8 47
Sin Optimización 2 5 1 1 1 4 4 18 17 1 3 1 2 1 7 5 4 2 43
Primer Optimización 2 10 1 1 1 9 9 33 32 1 1 1 1 1 4 3 1 9 54
Segunda Optimización 2 11 1 1 1 11 11 38 37 1 1 1 3 2 11 56
Sin Optimización 1 4 1 1 2 1 4 4 18 17 1 3 1 1 1 7 6 4 2 43
Primer Optimización 1 4 1 1 2 1 4 4 18 17 1 3 1 1 1 7 6 4 2 43
Segunda Optimización 1 19 1 1 1 1 19 19 62 61 1 1 6 1 4 3 19 96
Sin Optimización 1 1 1 2 1 1 2 1 1 1 1 2 2 1 18 16 2 3 1 11 10 3 2 48
Primer Optimización 1 1 1 2 1 1 2 1 1 1 1 1 2 2 18 16 2 3 1 11 10 3 2 48
Segunda Optimización 1 1 1 8 2 1 1 1 1 1 1 1 8 8 36 34 2 1 4 9 8 1 16 75
Sin Optimización 2 3 1 1 1 3 3 14 12 2 1 1 1 3 3 4 6 33
Primer Optimización 1 2 3 1 1 1 3 3 15 13 2 1 1 3 3 3 4 6 36
Segunda Optimización 1 2 14 1 1 1 14 14 48 46 2 1 1 3 3 28 84
Sin Optimización 1 2 2 1 1 2 2 11 9 2 4 1 1 1 4 4 4 30
Primer Optimización 1 6 2 1 1 6 6 23 21 2 2 1 1 1 1 2 2 2 6 41
Segunda Optimización 1 7 2 1 1 6 6 24 22 2 1 1 1 2 1 6 36
Sin Optimización 1 1 2 1 1 1 1 1 1 1 11 11 4 1 1 1 8 8 1 35
Primer Optimización 1 1 4 2 2 2 1 1 3 3 20 20 2 1 3 9 6 3 44
Segunda Optimización 1 1 4 2 2 2 1 1 3 3 20 19 1 1 3 8 5 3 40
Sin Optimización 1 1 2 3 1 1 1 3 3 16 15 1 3 1 2 1 2 1 6 5 4 4 45
Primer Optimización 1 1 2 4 1 1 1 3 3 17 15 2 1 4 1 1 4 4 4 7 43
Segunda Optimización 1 1 2 13 1 1 1 12 12 44 42 2 7 1 3 3 1 25 84
Sin Optimización 1 1 1 1 1 1 1 2 1 1 1 12 9 2 1 1 3 2 3 3 6 9 39
Primer Optimización 2 1 1 1 1 1 2 1 1 1 12 10 1 1 1 1 1 6 5 3 9 38
Segunda Optimización 2 1 1 1 1 1 2 1 1 1 12 10 1 1 1 1 8 8 2 9 41
Sin Optimización 1 6 3 1 5 5 21 20 1 1 1 2 2 2 6 10 45
Primer Optimización 1 6 2 1 5 5 20 19 1 1 5 1 1 7 7 6 9 57
Segunda Optimización 2 1 1 1 1 1 2 1 1 1 12 10 1 1 1 1 1 8 8 2 9 42
Sin Optimización 1 6 3 1 5 5 21 20 1 1 1 2 2 2 6 10 45
Primer Optimización 2 2 1 8 2 1 1 7 7 1 32 29 2 1 1 1 4 1 5 5 4 6 9 68
Segunda Optimización 2 1 1 1 1 1 8 8 2 25 23 1 1 1 2 4 1 5 5 2 8 9 62
Sin Optimización 1 2 1 1 1 2 1 1 3 2 2 17 16 1 1 2 1 2 2 11 9 3 9 57
Primer Optimización 1 3 1 1 1 1 1 2 1 1 2 2 2 19 17 1 1 1 2 1 1 8 8 3 2 9 54
Segunda Optimización 1 3 1 1 2 1 1 1 3 3 17 15 1 1 1 1 1 9 8 3 2 9 51
Sin Optimización 2 1 3 1 1 1 2 2 1 1 2 2 1 20 19 1 1 1 1 8 8 4 10 53
Primer Optimización 2 1 3 1 1 2 1 1 1 2 2 1 18 16 1 1 1 3 1 1 1 10 9 4 9 57
Segunda Optimización 1 1 1 9 1 2 1 1 1 8 8 1 35 32 2 1 1 2 4 1 7 7 2 8 9 76
5
Sen
ten
cia
SELE
CT
UP
DA
TED
ELET
E IN
SER
T
5
1
2
3
4
5
1
2
3
4
5
1
2
3
4
Pru
eba
1
2
3
4
Realizar una emisión de los predios rurales, los predios rurales deben cumplir con las
siguientes especificaciones: dominio propietario, arrendatario, posesionario,
traslación de dominio herencia, donación, posesión, drenaje bien drenado, mal
drenado y moderado.
Se no pide hacer una emisión de agua potable desde los meses del año 1992 a
diciembre del 2011 los títulos que se deben emitir han de cumplir con el siguiente
criterio: los predios urbanos de la parroquia A.
Se necesita hacer una emisión de predios urbanos donde el área del predio este entre
10 m2 y 200 m2, que los dueños tengan un numero de cedula que termine en los
números 1,9,6,3,4,0,2 que el estado civil no sea viudo;
Hacer una emisión de predios urbanos donde los predios se encuentras ubicados en la
parroquia B. Las características del suelo sea de tipo cenagoso, húmedo e inundable,
revestimiento exteriores de tipo cemento, chapeado, enlucidos tierra, grafiado y
madera fina.
Descripción
Se desea hacer la eliminación de los títulos emitidos no cancelado por contribuyente
donde la deuda por predios sea menor a 600 dólares americanos, estos predios deben
estar ubicados en sectores con aéreas de riegos como por ejemplo
F,G,H,I,J,K,L,M,N,Ñ,A Y O.
Se desea eliminar los predios que cumplen con estas caracteristicas: El frente
principal mayor 8, Fondo relativo se encuentres entre 10 a 190, Localización
esquinero, en cabecera, interior, Escalera de Hormigón simple, ladrillo, hierro, Deuda
mayor a 30 Dólares Americanos.
Eliminar los predios con las siguientes características: Traslación de dominio posesión,
permuta, adjudicación, Uso de suelo agrícola, agro exportación, avícola, bioacuatico,
porcicola y minero, La superficie sea mayor de 5 Hectáreas.
Realizar la eliminación de la deuda de los predios urbanos ubicados en las parroquias
A, B, C, D, E, F, G, H. área de terreno entre 50 a 200 m2. La deuda por predio sea
menor a 2584 dólares.
Hacer una emisión de los predios ubicados en las parroquias A. el contribuyente sea
de tipo jurídico; que los predios estén en posición esquinero, interior, en cabecera;
tengan escrituras hechas en las ciudades de la sierra.
Se desea actualizara el valor del avaluó comercial de los predios urbanos donde el
dominio sea público, su área de construcción mayor a 20 m2, cubierta de loza
hormigón armado, puertas de aluminio y enrollables, que tenga más de un piso.
Se desea hacer un descuento del 10 por ciento del valor de emisión, si cada predio
adeuda a la municipalidad valores menores a 8000 USD, estos predios deben constar
con características de suelo seco, cenagoso, ocupación edificado.
se necesita aumentar 1 por ciento al de recargo. Que las vías de acceso hacia los
predios sean de primero, segundo y tercer orden; la deuda por predio sea menor de
100; la topografía sea a nivel plana y pendiente leve; drenaje excesivo, moderado y
mal drenado;
Se requiere actualizar el avaluó real de los predios rurales donde el uso del suelo este
destinado para uso agrícola, forestal, minero, bioacuatico, comercial, agro
exportación; La deuda no sea mayor a 200 por predio.
Eliminar los predios urbanos que sus escrituras se hayan hecho en la costa, sierra,
amazonia; tipo de contribuyente jurídico, religioso, gobierno, normal; la deuda por
título emitido sea menor a 20 dólares; las parroquias sean A, B, C, D, E, F;
Obtener un listado de predios que se encuentren ubicados en las parroquias I, J, K, Z,
M, S, Y, K, F, T, D y E. mostrar nombres de propietarios, que tengan conexión de agua y
que su la deuda de agua sea mayor de 10 Dólares.
Obtener un listado de predios rurales con los nombres de los propietarios, donde
predios ingresados se encuentren entre el grupo de los predios que su deuda este
entre 1 a 20000 dólares, por título emitido.
Obtener un listado de predios urbanos cuyos propietarios tenga agua potable,
mantenga una deuda pendiente por pago de mayor a 20 dólares en predios.
Se desea obtener un listado de los predios urbanos que sus intereses no sean mayor a
1 dólar por título emitido y que se estén ubicados en las parroquias K, E, R, O, P, T, D.
donde el área sea mayor a 50 m2.
Se necesita actualizar el 0.3 por ciento de los valores emitidos, un 0.1 por ciento de los
intereses, en los títulos de los predios urbanos ubicados en las parroquias A, K, L, M, I,
J, S. que sean de dominio público y privado,
Consulta
Lectura de tablas
Algoritmos Utilizados
Métodos Para Resolaver Sentencias
Tiempos y datos devueltos
Tablas usadas
Mostrar todos los predios que tienen escrituras donde las escrituras fuesen creadas en
la región costa, sierra y en la Amazonía, cuyos predios tenga un área de construcción
mayor 10 m2
66
ANEXO 25 RECURSOS UTILIZADOS EN POSTGRES 9.0 CON CINCO MILLONES DE DATOS.
cat0
1
cat0
4
ciu
dad
emi0
1
emi0
3
gen
01
gen
02
pro
vin
cia
pru
01
pru
05
pru
10
pru
20
pru
30
pru
50
pu
r01
pu
r02
pu
r04
pu
r05
pu
r06
regi
on
ren
20
ren
21
ren
agu
a
Tota
l Lec
tura
de
tab
las
Seq
Sca
n
Ind
ex S
can
bit
map
ind
ex s
can
bit
map
hea
d s
can
Agg
rega
te
Win
do
ws
Agg
Has
Agr
egat
e
Gro
up
Agg
rega
te
Mat
eria
lize
Sub
qu
ery
Un
iqu
e
Sort
Mer
ge J
oin
Mer
ge S
emi J
oin
Has
sem
i jo
in
Has
Has
Jo
in
Nes
ted
Lo
op
Nes
ted
loo
p S
emi
join
f()
Tota
l Rec
urs
os
Uti
lizad
os
Sin Optimización 1 1 1 1 2 1 6 6 1 20 19 1 6 1 1 1 2 13 11 7 62
Primer Optimización 1 2 1 1 1 1 1 1 6 6 21 18 1 1 1 5 1 1 1 10 9 7 1 56
Segunda Optimización 1 2 2 1 1 1 1 1 13 13 36 33 1 1 1 2 3 5 4 1 15 66
Sin Optimización 1 1 2 3 1 1 1 1 1 3 3 1 19 17 2 3 1 2 3 1 1 8 8 4 4 54
Primer Optimización 1 1 2 5 1 1 1 1 1 3 3 1 21 21 4 1 2 2 1 2 12 11 3 3 62
Segunda Optimización 1 2 1 1 1 1 1 1 13 13 35 32 1 1 1 1 1 3 5 5 1 15 66
Sin Optimización 2 1 3 1 1 1 1 1 1 1 3 3 19 19 3 1 2 12 10 3 3 53
Primer Optimización 2 1 10 1 1 1 1 1 1 1 10 10 40 39 1 3 1 8 7 21 80
Segunda Optimización 2 2 11 1 1 1 1 1 1 1 11 10 43 41 1 1 1 8 7 10 69
Sin Optimización 2 6 1 1 1 1 6 6 24 21 1 1 1 6 1 2 8 8 7 7 63
Primer Optimización 2 16 1 1 1 1 1 15 15 53 50 1 1 1 1 1 6 3 3 1 25 93
Segunda Optimización 1 15 1 1 1 1 15 15 50 48 2 1 1 4 3 3 1 24 87
Sin Optimización 1 1 1 4 1 1 2 1 1 1 4 4 22 19 3 1 5 3 3 7 3 44
Primer Optimización 1 2 2 4 1 1 1 1 1 1 4 4 1 24 20 2 1 1 5 11 11 5 56
Segunda Optimización 1 1 1 13 1 1 1 1 1 1 13 13 1 49 46 3 2 6 6 1 13 77
Sin Optimización 1 1 1 2 1 1 1 1 1 2 2 14 14 2 1 1 1 1 9 8 2 2 41
Primer Optimización 1 1 1 7 1 1 1 1 2 6 6 28 28 1 2 4 9 5 11 1 61
Segunda Optimización 1 1 1 7 1 1 1 1 1 6 6 27 27 2 3 8 5 11 1 57
Sin Optimización 3 4 2 2 2 4 4 1 22 18 2 1 1 1 1 4 1 3 6 8 46
Primer Optimización 1 8 2 3 2 7 7 1 31 27 4 1 5 1 2 1 2 18 61
Segunda Optimización 1 7 2 2 2 7 7 1 29 28 1 2 2 1 1 7 7 1 14 64
Sin Optimización 3 5 1 1 1 4 4 19 16 1 1 1 2 1 2 2 5 3 5 2 41
Primer Optimización 3 8 1 1 1 8 8 30 27 1 1 1 1 1 2 2 4 2 1 8 51
Segunda Optimización 3 8 1 1 1 8 8 30 27 1 1 1 1 1 2 1 3 2 8 48
Sin Optimización 3 5 1 1 1 4 4 19 16 1 1 1 3 1 2 1 7 5 4 2 44
Primer Optimización 3 10 1 1 1 9 9 34 32 1 1 1 1 1 1 4 3 1 9 55
Segunda Optimización 3 11 1 1 1 11 11 39 37 1 1 1 1 3 2 11 57
Sin Optimización 2 4 1 1 2 1 4 4 19 17 1 1 3 1 1 1 7 6 4 2 44
Primer Optimización 2 4 1 1 2 1 4 4 19 17 1 1 3 1 1 1 7 6 4 2 44
Segunda Optimización 2 19 1 1 1 1 19 19 63 61 1 1 1 6 1 4 3 19 97
Sin Optimización 1 1 3 2 1 1 1 1 1 1 1 2 2 1 19 16 1 1 1 3 1 11 10 3 2 49
Primer Optimización 1 1 2 2 1 1 2 1 1 1 1 1 2 2 19 16 1 1 1 3 1 11 10 3 2 49
Segunda Optimización 1 1 2 8 1 1 2 1 1 1 1 1 8 8 37 34 1 1 1 1 4 9 8 1 16 76
Sin Optimización 3 3 1 1 1 3 3 15 12 1 1 1 1 1 2 4 2 5 6 36
Primer Optimización 1 3 3 1 1 1 3 3 16 13 1 1 1 1 1 4 2 2 5 6 37
Segunda Optimización 1 3 14 1 1 1 14 14 49 46 1 1 1 1 1 3 3 28 85
Sin Optimización 1 2 2 1 1 2 2 11 11 2 1 2 1 3 2 4 2 28
Primer Optimización 1 6 2 1 1 6 6 23 23 3 3 2 2 2 6 41
Segunda Optimización 1 7 2 1 1 6 6 24 22 2 1 1 1 2 1 6 36
Sin Optimización 1 1 2 2 1 1 1 1 1 11 11 4 1 3 2 4 4 2 31
Primer Optimización 1 1 4 2 1 1 1 1 4 4 20 20 1 2 1 3 2 1 7 5 3 45
Segunda Optimización 1 1 4 2 2 2 1 1 3 3 20 19 1 1 3 8 5 3 40
Sin Optimización 1 1 2 3 1 1 1 3 3 16 14 1 1 3 1 2 1 2 1 6 5 4 4 45
Primer Optimización 1 1 3 4 1 1 1 3 3 18 15 1 1 1 1 4 1 1 4 4 4 7 44
Segunda Optimización 1 1 3 13 1 1 1 12 12 45 42 1 1 1 7 1 3 3 1 25 85
Sin Optimización 1 1 1 2 1 1 2 1 1 1 1 2 2 1 18 16 2 3 1 11 10 3 2 48
Primer Optimización 1 1 1 2 1 1 2 1 1 1 1 1 2 2 18 16 2 3 1 11 10 3 2 48
Segunda Optimización 1 1 1 8 2 1 1 1 1 1 1 1 8 8 36 34 2 1 4 9 8 1 16 75
Sin Optimización 2 3 1 1 1 3 3 14 12 2 1 1 1 3 3 4 6 33
Primer Optimización 1 2 3 1 1 1 3 3 15 13 2 1 1 3 3 3 4 6 36
Segunda Optimización 1 2 14 1 1 1 14 14 48 46 2 1 1 3 3 28 84
Sin Optimización 1 2 2 1 1 2 2 11 9 2 4 1 1 1 4 4 4 30
Primer Optimización 1 6 2 1 1 6 6 23 21 2 2 1 1 1 1 2 2 2 6 41
Segunda Optimización 2 1 1 1 1 1 8 8 2 25 23 1 1 1 2 4 1 5 5 2 8 9 62
Sin Optimización 1 2 1 1 1 2 1 1 3 2 2 17 16 1 1 2 1 2 2 11 9 3 9 57
Primer Optimización 1 3 1 1 1 1 1 2 1 1 2 2 2 19 17 1 1 1 2 1 1 8 8 3 2 9 54
Segunda Optimización 1 3 1 1 2 1 1 1 3 3 17 15 1 1 1 1 1 9 8 3 2 9 51
Sin Optimización 2 1 3 1 1 1 2 2 1 1 2 2 1 20 19 1 1 1 1 8 8 4 10 53
Primer Optimización 2 1 3 1 1 2 1 1 1 2 2 1 18 16 1 1 1 3 1 1 1 10 9 4 9 57
Segunda Optimización 1 1 1 9 1 2 1 1 1 8 8 1 35 32 2 1 1 2 4 1 7 7 2 8 9 76
INSE
RT
1
2
3
4
5
DEL
ETE
1
2
3
4
5
UP
DA
TE1
2
3
4
5
Se no pide hacer una emisión de agua potable desde los meses del año 1992 a
diciembre del 2011 los títulos que se deben emitir han de cumplir con el siguiente
criterio: los predios urbanos de la parroquia A.
Se necesita hacer una emisión de predios urbanos donde el área del predio este entre
10 m2 y 200 m2, que los dueños tengan un numero de cedula que termine en los
números 1,9,6,3,4,0,2 que el estado civil no sea viudo;
Hacer una emisión de predios urbanos donde los predios se encuentras ubicados en la
parroquia B. Las características del suelo sea de tipo cenagoso, húmedo e inundable,
revestimiento exteriores de tipo cemento, chapeado, enlucidos tierra, grafiado y
madera fina.
Descripción
Se desea eliminar los predios que cumplen con estas caracteristicas: El frente
principal mayor 8, Fondo relativo se encuentres entre 10 a 190, Localización
esquinero, en cabecera, interior, Escalera de Hormigón simple, ladrillo, hierro, Deuda
mayor a 30 Dólares Americanos.
Eliminar los predios con las siguientes características: Traslación de dominio posesión,
permuta, adjudicación, Uso de suelo agrícola, agro exportación, avícola, bioacuatico,
porcicola y minero, La superficie sea mayor de 5 Hectáreas.
Realizar la eliminación de la deuda de los predios urbanos ubicados en las parroquias
A, B, C, D, E, F, G, H. área de terreno entre 50 a 200 m2. La deuda por predio sea
menor a 2584 dólares.
Hacer una emisión de los predios ubicados en las parroquias A. el contribuyente sea
de tipo jurídico; que los predios estén en posición esquinero, interior, en cabecera;
tengan escrituras hechas en las ciudades de la sierra.
Realizar una emisión de los predios rurales, los predios rurales deben cumplir con las
siguientes especificaciones: dominio propietario, arrendatario, posesionario,
traslación de dominio herencia, donación, posesión, drenaje bien drenado, mal
drenado y moderado.
Se desea hacer un descuento del 10 por ciento del valor de emisión, si cada predio
adeuda a la municipalidad valores menores a 8000 USD, estos predios deben constar
con características de suelo seco, cenagoso, ocupación edificado.
se necesita aumentar 1 por ciento al de recargo. Que las vías de acceso hacia los
predios sean de primero, segundo y tercer orden; la deuda por predio sea menor de
100; la topografía sea a nivel plana y pendiente leve; drenaje excesivo, moderado y
mal drenado;
Se requiere actualizar el avaluó real de los predios rurales donde el uso del suelo este
destinado para uso agrícola, forestal, minero, bioacuatico, comercial, agro
exportación; La deuda no sea mayor a 200 por predio.
Eliminar los predios urbanos que sus escrituras se hayan hecho en la costa, sierra,
amazonia; tipo de contribuyente jurídico, religioso, gobierno, normal; la deuda por
título emitido sea menor a 20 dólares; las parroquias sean A, B, C, D, E, F;
Se desea hacer la eliminación de los títulos emitidos no cancelado por contribuyente
donde la deuda por predios sea menor a 600 dólares americanos, estos predios deben
estar ubicados en sectores con aéreas de riegos como por ejemplo
F,G,H,I,J,K,L,M,N,Ñ,A Y O.
Tiempos y datos devueltos
Obtener un listado de predios rurales con los nombres de los propietarios, donde
predios ingresados se encuentren entre el grupo de los predios que su deuda este
entre 1 a 20000 dólares, por título emitido.
Obtener un listado de predios urbanos cuyos propietarios tenga agua potable,
mantenga una deuda pendiente por pago de mayor a 20 dólares en predios.
Se desea obtener un listado de los predios urbanos que sus intereses no sean mayor a
1 dólar por título emitido y que se estén ubicados en las parroquias K, E, R, O, P, T, D.
donde el área sea mayor a 50 m2.
Se necesita actualizar el 0.3 por ciento de los valores emitidos, un 0.1 por ciento de los
intereses, en los títulos de los predios urbanos ubicados en las parroquias A, K, L, M, I,
J, S. que sean de dominio público y privado,
Se desea actualizara el valor del avaluó comercial de los predios urbanos donde el
dominio sea público, su área de construcción mayor a 20 m2, cubierta de loza
hormigón armado, puertas de aluminio y enrollables, que tenga más de un piso.
Consulta
Sen
ten
cia
Pru
eba
SELE
CT
1
2
3
4
5
Tablas usadas
Algoritmos Utilizados
Métodos Para Resolaver SentenciasLectura de tablas
Mostrar todos los predios que tienen escrituras donde las escrituras fuesen creadas en
la región costa, sierra y en la Amazonía, cuyos predios tenga un área de construcción
mayor 10 m2
Obtener un listado de predios que se encuentren ubicados en las parroquias I, J, K, Z,
M, S, Y, K, F, T, D y E. mostrar nombres de propietarios, que tengan conexión de agua y
que su la deuda de agua sea mayor de 10 Dólares.
67
ANEXOS 26 RECURSOS UTILIZADOS EN SQL SERVER 2008 R2 CON UN MILLON DE DATOS.
cat0
1
cat0
4
ciu
dad
emi0
1
emi0
3
gen
01
gen
02
pru
01
pru
05
pru
10
pru
20
pru
30
pru
50
pu
r01
pu
r02
pu
r04
pu
r05
pu
r06
regi
on
ren
20
ren
21
ren
agu
a
Gen
erat
e_se
ries
Tota
l Lec
tura
de
tab
las
Tab
le S
can
Ind
ex S
can
Ind
ex S
eek
Ind
ex D
elet
e
Ind
ex In
sert
RID
Lo
cku
p
Has
h M
atch
Nes
ted
loo
ps
Secu
ence
Stre
am A
ggre
gate
Top
Tab
la V
alu
e
Pro
yect
o d
e
Secu
enci
a
Segm
ent
Tab
le In
sert
Tab
le D
elet
e
Mer
je J
oin
Sort
Ind
ex S
po
ol
Ro
w C
ou
nt
Spo
ol
Tab
le S
po
ol
Co
mp
ute
Sca
lar
Co
nca
tio
nat
er
Filt
er
Ass
ert
Tota
l Rec
urs
os
Uti
lizad
os
Sin Optimización 1 3 1 2 1 5 5 18 11 4 3 10 13 2 5 1 1 1 51
Primer Optimización 2 2 1 2 1 1 1 1 6 6 23 16 4 3 9 13 3 5 1 1 1 56
Segunda Optimización 1 2 1 1 1 1 1 1 13 13 35 31 2 2 7 20 11 1 1 1 4 1 11 92
Sin Optimización 3 1 1 3 1 1 1 1 1 3 3 1 20 17 2 1 14 7 1 2 2 46
Primer Optimización 2 1 2 5 1 2 1 1 1 3 3 1 23 20 2 1 15 7 1 2 1 49
Segunda Optimización 2 1 2 13 1 2 1 1 1 12 12 1 49 46 1 1 1 14 26 12 1 3 2 12 119
Sin Optimización 3 1 3 1 1 1 1 1 1 1 1 3 3 21 19 1 1 11 8 1 3 1 45
Primer Optimización 3 1 10 1 1 1 1 1 1 1 10 10 41 39 1 1 10 23 10 1 1 1 3 10 100
Segunda Optimización 2 1 11 1 1 1 1 1 1 1 10 10 41 41 11 21 22 3 1 1 1 2 19 122
Sin Optimización 2 6 1 3 1 1 6 6 26 22 2 2 9 16 3 6 1 61
Primer Optimización 2 16 1 1 2 1 1 15 15 54 50 2 2 9 34 22 2 1 5 1 21 149
Segunda Optimización 1 15 1 1 2 1 15 15 51 47 2 2 9 34 22 1 1 3 1 20 142
Sin Optimización 1 1 2 4 2 1 1 1 1 1 4 4 1 24 19 3 2 10 12 6 2 1 4 59
Primer Optimización 2 1 2 4 2 1 1 1 1 1 4 4 1 25 20 1 2 2 12 12 4 4 2 1 4 64
Segunda Optimización 1 1 2 13 1 2 2 1 1 1 13 13 1 52 45 4 3 9 31 26 1 4 1 26 150
Sin Optimización 1 1 1 2 1 1 1 1 1 2 2 14 14 9 4 2 1 2 1 2 35
Primer Optimización 1 1 2 6 1 1 1 1 2 6 6 28 28 11 12 7 1 1 2 6 68
Segunda Optimización 1 1 1 7 1 1 1 1 1 6 6 27 27 10 12 6 1 1 1 2 6 66
Sin Optimización 3 4 4 2 2 4 4 1 24 16 5 3 6 17 5 1 4 1 3 1 62
Primer Optimización 2 8 2 3 2 7 7 1 32 23 5 4 6 24 7 1 1 1 1 3 2 1 5 84
Segunda Optimización 3 4 3 2 2 4 4 1 23 15 5 3 6 15 5 1 4 1 4 1 1 61
Sin Optimización 2 5 1 1 4 4 17 15 1 1 8 10 7 1 5 1 2 1 4 56
Primer Optimización 4 10 1 1 1 9 9 35 31 2 2 24 18 1 2 2 3 1 17 103
Segunda Optimización 2 8 1 1 1 8 8 29 28 1 9 16 15 1 1 1 3 1 15 91
Sin Optimización 3 5 1 1 1 4 4 19 17 1 1 8 10 7 1 5 1 2 1 4 58
Primer Optimización 4 10 1 1 1 9 9 35 31 2 2 5 24 18 1 2 2 3 1 17 108
Segunda Optimización 4 11 1 1 11 11 39 35 2 2 5 27 23 1 1 2 3 1 22 124
Sin Optimización 2 4 1 1 3 1 4 4 20 18 1 1 8 9 7 1 4 2 1 3 55
Primer Optimización 2 4 1 1 2 1 4 4 19 17 1 1 8 9 8 1 5 2 1 3 56
Segunda Optimización 2 19 1 1 2 1 19 19 64 62 1 1 8 40 39 1 2 4 1 39 198
Sin Optimización 1 2 2 2 2 2 1 1 1 1 1 2 2 20 16 1 2 1 13 5 1 1 1 1 1 2 1 46
Primer Optimización 1 1 2 2 2 1 1 1 1 1 1 1 2 2 19 14 1 3 1 13 5 1 1 1 1 1 1 43
Segunda Optimización 1 2 2 8 1 1 2 1 1 1 1 1 8 8 38 34 1 2 1 12 18 8 1 1 1 2 8 89
Sin Optimización 1 8 3 1 2 1 3 3 22 16 1 5 7 7 1 3 1 1 8 7 1 2 60
Primer Optimización 1 7 3 1 1 1 3 3 20 13 1 6 7 7 1 3 1 1 8 7 1 2 58
Segunda Optimización 1 8 14 1 1 14 14 53 44 2 6 1 6 30 1 15 1 1 7 7 2 3 2 14 142
Sin Optimización 1 2 2 1 1 2 2 11 10 1 7 4 4 1 1 2 1 2 33
Primer Optimización 1 6 2 1 6 6 22 21 1 6 12 12 1 1 1 2 1 12 70
Segunda Optimización 1 7 2 1 1 6 6 24 23 1 7 12 14 1 1 3 1 1 1 1 12 78
Sin Optimización 1 1 1 2 1 1 1 1 1 1 11 11 9 2 1 1 1 1 1 1 1 1 30
Primer Optimización 1 1 4 1 2 2 1 1 3 3 19 19 12 6 7 1 2 1 1 3 1 1 2 8 64
Segunda Optimización 1 1 4 2 2 2 1 1 3 3 20 20 12 6 9 1 1 2 2 1 1 7 62
Sin Optimización 2 1 8 3 1 1 1 3 3 23 14 2 6 1 8 8 1 1 1 1 9 6 58
Primer Optimización 1 1 2 4 1 1 1 3 3 17 10 1 6 10 7 1 2 1 1 9 7 1 2 58
Segunda Optimización 1 1 2 13 1 1 1 12 12 44 43 1 9 27 1 13 1 1 7 6 1 3 2 12 127
Sin Optimización 1 1 6 3 1 1 2 1 1 1 2 2 1 1 24 17 1 6 12 7 2 3 2 1 1 1 1 1 10 6 3 3 77
Primer Optimización 1 1 2 1 7 1 1 2 1 1 1 2 19 13 1 6 1 9 5 2 2 2 1 1 1 1 1 6 4 1 57
Segunda Optimización 1 1 2 8 1 1 2 1 11 1 1 29 22 1 6 1 8 5 2 2 2 1 1 1 1 1 6 4 1 65
Sin Optimización 1 6 3 1 5 5 1 21 22 8 13 1 9 2 1 1 1 1 5 3 5 72
Primer Optimización 2 6 1 1 5 5 2 20 22 7 13 1 9 2 1 1 1 1 6 3 6 73
Segunda Optimización 1 14 2 1 13 13 2 44 46 3 33 1 28 2 1 1 1 1 1 2 3 5 26 154
Sin Optimización 2 2 1 4 1 1 1 3 3 3 2 21 21 1 1 9 12 1 5 2 1 1 1 1 2 3 3 4 68
Primer Optimización 2 2 1 8 2 1 7 7 3 2 33 33 1 1 8 21 1 14 2 1 1 1 1 1 4 2 3 2 6 13 116
Segunda Optimización 1 1 1 8 2 1 1 8 8 4 2 35 31 3 3 5 18 1 9 2 1 1 1 1 2 3 8 89
Sin Optimización 7 2 1 1 1 2 1 1 3 2 2 2 23 19 6 12 5 2 4 2 1 1 1 1 8 6 3 2 73
Primer Optimización 1 3 1 1 1 2 1 1 1 3 3 2 18 14 6 10 8 2 7 2 1 1 1 1 8 6 3 1 4 75
Segunda Optimización 7 1 1 1 2 1 1 2 3 3 2 22 18 6 11 5 2 4 2 1 1 1 1 2 6 2 1 3 66
Sin Optimización 1 1 7 3 1 1 2 2 1 1 2 2 1 2 25 20 1 6 10 7 2 3 2 1 1 1 1 1 10 6 3 3 78
Primer Optimización 1 1 7 3 1 1 2 1 1 1 2 2 1 2 24 19 1 6 11 7 2 7 2 1 1 1 1 9 6 3 3 80
Segunda Optimización 1 1 7 9 1 1 2 1 1 1 8 8 1 2 42 38 6 9 19 2 18 2 1 1 1 1 7 6 3 17 131
INSE
RT
1
2
3
4
5
DEL
ETE
1
2
3
4
5
UP
DA
TE
1
2
3
4
5
SELE
CT
1
2
3
4
5
Hacer una emisión de los predios ubicados en las parroquias A. el contribuyente sea
de tipo jurídico; que los predios estén en posición esquinero, interior, en cabecera;
tengan escrituras hechas en las ciudades de la sierra.
Realizar una emisión de los predios rurales, los predios rurales deben cumplir con las
siguientes especificaciones: dominio propietario, arrendatario, posesionario,
traslación de dominio herencia, donación, posesión, drenaje bien drenado, mal
drenado y moderado.
Se no pide hacer una emisión de agua potable desde los meses del año 1992 a
diciembre del 2011 los títulos que se deben emitir han de cumplir con el siguiente
criterio: los predios urbanos de la parroquia A.
Se necesita hacer una emisión de predios urbanos donde el área del predio este entre
10 m2 y 200 m2, que los dueños tengan un numero de cedula que termine en los
números 1,9,6,3,4,0,2 que el estado civil no sea viudo;
Hacer una emisión de predios urbanos donde los predios se encuentras ubicados en la
parroquia B. Las características del suelo sea de tipo cenagoso, húmedo e inundable,
revestimiento exteriores de tipo cemento, chapeado, enlucidos tierra, grafiado y
madera fina.
Eliminar los predios urbanos que sus escrituras se hayan hecho en la costa, sierra,
amazonia; tipo de contribuyente jurídico, religioso, gobierno, normal; la deuda por
título emitido sea menor a 20 dólares; las parroquias sean A, B, C, D, E, F;
Se desea hacer la eliminación de los títulos emitidos no cancelado por contribuyente
donde la deuda por predios sea menor a 600 dólares americanos, estos predios deben
estar ubicados en sectores con aéreas de riegos como por ejemplo
F,G,H,I,J,K,L,M,N,Ñ,A Y O.
Se desea eliminar los predios que cumplen con estas caracteristicas: El frente
principal mayor 8, Fondo relativo se encuentres entre 10 a 190, Localización
esquinero, en cabecera, interior, Escalera de Hormigón simple, ladrillo, hierro, Deuda
mayor a 30 Dólares Americanos.
Eliminar los predios con las siguientes características: Traslación de dominio posesión,
permuta, adjudicación, Uso de suelo agrícola, agro exportación, avícola, bioacuatico,
porcicola y minero, La superficie sea mayor de 5 Hectáreas.
Realizar la eliminación de la deuda de los predios urbanos ubicados en las parroquias
A, B, C, D, E, F, G, H. área de terreno entre 50 a 200 m2. La deuda por predio sea
menor a 2584 dólares.
Se necesita actualizar el 0.3 por ciento de los valores emitidos, un 0.1 por ciento de los
intereses, en los títulos de los predios urbanos ubicados en las parroquias A, K, L, M, I,
J, S. que sean de dominio público y privado,
Se desea actualizara el valor del avaluó comercial de los predios urbanos donde el
dominio sea público, su área de construcción mayor a 20 m2, cubierta de loza
hormigón armado, puertas de aluminio y enrollables, que tenga más de un piso.
Se desea hacer un descuento del 10 por ciento del valor de emisión, si cada predio
adeuda a la municipalidad valores menores a 8000 USD, estos predios deben constar
con características de suelo seco, cenagoso, ocupación edificado.
se necesita aumentar 1 por ciento al de recargo. Que las vías de acceso hacia los
predios sean de primero, segundo y tercer orden; la deuda por predio sea menor de
100; la topografía sea a nivel plana y pendiente leve; drenaje excesivo, moderado y
mal drenado;
Se requiere actualizar el avaluó real de los predios rurales donde el uso del suelo este
destinado para uso agrícola, forestal, minero, bioacuatico, comercial, agro
exportación; La deuda no sea mayor a 200 por predio.
Mostrar todos los predios que tienen escrituras donde las escrituras fuesen creadas en
la región costa, sierra y en la Amazonía, cuyos predios tenga un área de construcción
mayor 10 m2
Obtener un listado de predios que se encuentren ubicados en las parroquias I, J, K, Z,
M, S, Y, K, F, T, D y E. mostrar nombres de propietarios, que tengan conexión de agua y
que su la deuda de agua sea mayor de 10 Dólares.
Obtener un listado de predios rurales con los nombres de los propietarios, donde
predios ingresados se encuentren entre el grupo de los predios que su deuda este
entre 1 a 20000 dólares, por título emitido.
Obtener un listado de predios urbanos cuyos propietarios tenga agua potable,
mantenga una deuda pendiente por pago de mayor a 20 dólares en predios.
Se desea obtener un listado de los predios urbanos que sus intereses no sean mayor a
1 dólar por título emitido y que se estén ubicados en las parroquias K, E, R, O, P, T, D.
donde el área sea mayor a 50 m2.
Consulta
Lectura /Escrituras en
TablasTablas usadas
Tiempos y datos devueltos
Métodos Para Resolaver Sentencias
Descripción
Sen
ten
cia
Pru
eba
68
ANEXOS 27 RECURSOS UTILIZADOS EN SQL SERVER 2008 CON CINCO MILLONES DE DATOS
cat0
1
cat0
4
ciu
dad
emi0
1
emi0
2
emi0
3
emi0
5
gen
01
gen
02
pru
01
pru
05
pru
10
pru
20
pru
30
pru
50
pu
r01
pu
r02
pu
r04
pu
r05
pu
r06
regi
on
ren
20
ren
21
ren
agu
a
Gen
erat
e_se
ries
Tota
l Lec
tura
de
tab
las
Tab
le S
can
Ind
ex S
can
Ind
ex S
eek
Ind
ex D
elet
e
Ind
ex In
sert
RID
Lo
cku
p
Ind
ex U
pd
ate
Has
h M
atch
Nes
ted
loo
ps
Secu
ence
Stre
am A
ggre
gate
Top
Bit
Map
Par
alle
lism
Tab
la V
alu
e
Pro
yect
o d
e
Secu
enci
a
Segm
ent
Tab
le In
sert
Tab
le U
pd
ate
Split
Tab
le D
elet
e
Mer
je J
oin
Sort
Ind
ex S
po
ol
Ro
w C
ou
nt
Spo
ol
Tab
le S
po
ol
Co
mp
ute
Sca
lar
Co
nca
tio
nat
er
Filt
er
Ass
ert
Tota
l Rec
urs
os
Uti
lizad
os
Sin Optimización 1 1 1 2 1 2 1 1 6 6 22 20 1 1 10 9 2 1 7 1 1 1 54
Primer Optimización 1 1 1 2 1 1 1 1 6 6 21 19 1 1 12 9 1 1 7 1 1 1 54
Segunda Optimización 1 1 1 2 1 1 1 1 13 13 35 33 1 1 8 19 13 1 1 1 4 11 93
Sin Optimización 1 1 3 3 1 1 1 1 1 3 3 1 20 19 1 14 7 3 17 4 1 2 68
Primer Optimización 1 1 1 5 1 1 1 1 1 3 3 1 20 19 1 16 6 6 17 4 1 70
Segunda Optimización 2 1 2 14 1 1 1 1 1 12 12 1 49 46 1 1 1 14 26 12 1 3 2 12 119
Sin Optimización 2 1 3 1 1 1 1 1 1 1 3 3 19 19 11 6 3 2 6 1 48
Primer Optimización 3 1 10 1 1 1 1 1 1 1 10 10 41 39 1 1 10 23 10 1 1 1 3 10 100
Segunda Optimización 2 1 11 1 1 1 1 1 1 1 10 10 41 41 10 22 22 3 1 1 1 2 21 124
Sin Optimización 1 6 1 1 2 1 6 6 24 22 1 1 10 14 2 7 1 58
Primer Optimización 1 16 1 1 2 1 15 15 52 49 2 1 10 33 22 2 5 1 21 146
Segunda Optimización 1 6 1 1 2 1 6 6 24 21 2 1 9 15 3 6 1 58
Sin Optimización 1 2 4 1 1 1 1 1 1 4 4 1 22 19 2 1 9 9 4 3 6 2 1 4 60
Primer Optimización 1 2 2 4 1 1 1 1 1 1 4 4 1 24 21 1 1 1 10 9 4 4 6 2 1 4 64
Segunda Optimización 1 1 2 13 1 2 2 1 1 1 13 13 1 52 45 4 3 9 33 26 2 4 1 26 153
Sin Optimización 1 1 2 2 1 1 1 1 1 2 2 15 13 1 1 8 5 2 1 1 1 2 4 2 41
Primer Optimización 2 6 1 1 1 1 1 1 6 6 26 24 1 1 10 13 6 1 1 1 2 3 2 1 6 72
Segunda Optimización 1 1 2 7 1 1 1 1 1 6 6 28 26 1 1 9 13 6 1 1 1 2 3 2 1 6 73
Sin Optimización 2 4 4 2 2 4 4 1 23 16 4 3 6 15 5 1 1 4 1 1 1 1 1 60
Primer Optimización 1 8 4 3 3 7 7 1 34 28 4 2 6 23 6 1 1 1 1 1 1 2 1 6 84
Segunda Optimización 1 7 4 2 2 7 7 1 31 26 3 2 5 22 7 1 1 1 2 1 2 1 6 80
Sin Optimización 3 5 1 1 1 4 4 19 15 1 2 1 7 10 8 1 1 1 6 1 3 2 59
Primer Optimización 3 9 1 1 1 8 8 31 27 1 2 1 7 18 16 1 1 1 3 1 3 3 2 15 102
Segunda Optimización 3 8 1 1 1 8 8 30 26 1 2 1 6 18 16 1 1 1 2 1 3 3 2 15 99
Sin Optimización 2 5 1 1 1 4 4 18 17 1 8 8 5 1 5 11 1 1 6 1 1 1 4 71
Primer Optimización 2 10 1 1 1 9 9 33 31 2 5 22 18 1 1 2 1 1 3 1 17 105
Segunda Optimización 2 11 1 1 11 11 37 35 2 5 23 23 1 1 1 1 1 4 1 22 120
Sin Optimización 1 4 1 1 2 1 4 4 18 17 1 8 8 7 1 1 5 1 1 3 53
Primer Optimización 1 4 1 1 2 1 4 4 18 17 1 8 8 7 1 1 5 1 1 3 53
Segunda Optimización 1 19 1 1 2 1 19 19 63 62 1 8 38 39 1 1 1 1 4 1 38 195
Sin Optimización 1 2 1 2 2 2 1 1 1 1 1 2 2 19 15 1 2 1 11 6 1 1 1 1 1 2 1 44
Primer Optimización 1 2 1 2 1 1 2 1 1 1 1 1 2 2 19 15 1 2 1 12 6 1 1 1 1 1 1 43
Segunda Optimización 1 2 1 8 1 1 3 1 1 1 1 1 8 8 38 34 1 2 1 11 19 8 1 1 1 1 2 8 90
Sin Optimización 1 3 3 1 1 1 3 3 16 13 1 1 1 7 7 4 1 1 3 1 1 2 43
Primer Optimización 1 3 3 1 1 1 3 3 16 13 1 1 1 7 7 4 1 1 3 1 1 2 43
Segunda Optimización 1 2 14 1 1 1 14 14 48 45 2 1 6 30 15 1 1 2 1 1 3 2 14 124
Sin Optimización 1 2 2 1 1 2 2 11 9 1 1 5 5 4 1 1 2 1 1 2 33
Primer Optimización 1 6 2 1 1 6 6 23 21 1 1 5 13 13 1 1 1 2 1 12 72
Segunda Optimización 1 7 2 1 1 6 6 24 22 1 1 5 14 14 1 1 1 2 1 13 76
Sin Optimización 1 1 1 1 1 1 1 1 1 1 10 9 1 7 3 3 1 1 1 1 1 1 1 30
Primer Optimización 1 1 4 2 2 2 1 1 3 3 20 19 1 9 8 8 1 1 1 1 1 1 1 1 7 60
Segunda Optimización 1 1 4 2 2 2 1 1 3 3 20 19 1 9 8 8 1 1 1 1 1 1 1 1 7 60
Sin Optimización 2 1 3 3 1 1 1 3 3 18 13 1 2 1 1 8 8 2 1 1 3 1 1 2 45
Primer Optimización 2 1 3 3 1 1 1 3 3 18 13 1 2 1 1 8 10 2 1 1 1 3 1 1 1 2 49
Segunda Optimización 1 1 3 13 1 1 1 12 12 45 42 1 1 1 9 26 13 1 1 2 1 1 3 2 12 116
Sin Optimización 1 1 1 2 1 1 1 2 1 1 1 2 15 14 1 9 3 1 3 2 4 14 1 1 1 1 1 3 1 60
Primer Optimización 1 1 1 2 1 1 1 2 1 1 1 2 15 14 1 9 3 1 3 2 5 14 1 1 1 1 1 7 1 65
Segunda Optimización 1 1 1 2 1 1 1 2 1 1 1 2 15 14 1 9 3 1 3 2 5 16 1 1 1 1 1 4 1 64
Sin Optimización 1 6 3 1 5 5 2 23 23 5 14 1 8 2 1 1 1 1 2 6 1 3 5 74
Primer Optimización 1 6 2 1 5 5 2 22 22 4 14 1 7 2 1 1 1 1 2 5 1 3 6 71
Segunda Optimización 1 14 2 1 13 13 2 46 46 33 1 28 2 1 1 1 1 1 3 5 27 150
Sin Optimización 2 2 1 4 1 1 1 3 3 3 2 23 21 1 1 8 11 1 4 2 1 1 1 1 2 6 3 3 67
Primer Optimización 2 2 1 8 1 1 1 7 7 3 2 35 33 1 1 7 22 1 14 2 1 1 1 1 2 4 3 3 2 6 13 118
Segunda Optimización 1 1 1 1 2 1 1 8 8 4 2 30 24 3 3 5 18 1 9 2 1 1 1 1 2 3 3 8 85
Sin Optimización 1 2 1 1 1 2 1 1 3 2 2 2 19 18 1 12 5 1 4 2 9 18 1 1 1 1 2 3 2 81
Primer Optimización 1 3 1 1 1 2 1 1 3 3 3 2 22 21 1 10 8 1 7 2 9 20 1 1 1 1 2 3 4 92
Segunda Optimización 1 1 1 1 1 2 1 1 1 3 3 2 18 17 1 11 3 1 4 2 8 21 1 1 1 1 1 3 1 3 80
Sin Optimización 1 1 1 3 1 1 2 2 1 1 2 2 1 2 21 19 1 1 12 6 1 4 2 7 17 1 1 1 1 1 3 3 2 83
Primer Optimización 1 1 1 3 1 1 2 1 1 1 2 2 1 2 20 18 1 1 11 5 1 6 2 8 18 1 1 1 1 2 3 3 3 86
Segunda Optimización 1 1 1 9 1 1 2 1 1 1 8 8 1 2 38 37 1 10 19 1 18 2 1 1 1 1 2 3 17 114
INSE
RT
1
2
3
4
5
DEL
ETE
1
2
3
4
5
UP
DA
TE
1
2
3
4
5
SELE
CT
1
2
3
4
5
Hacer una emisión de los predios ubicados en las parroquias A. el contribuyente sea
de tipo jurídico; que los predios estén en posición esquinero, interior, en cabecera;
tengan escrituras hechas en las ciudades de la sierra.
Realizar una emisión de los predios rurales, los predios rurales deben cumplir con las
siguientes especificaciones: dominio propietario, arrendatario, posesionario,
traslación de dominio herencia, donación, posesión, drenaje bien drenado, mal
drenado y moderado.
Se no pide hacer una emisión de agua potable desde los meses del año 1992 a
diciembre del 2011 los títulos que se deben emitir han de cumplir con el siguiente
criterio: los predios urbanos de la parroquia A.
Se necesita hacer una emisión de predios urbanos donde el área del predio este entre
10 m2 y 200 m2, que los dueños tengan un numero de cedula que termine en los
números 1,9,6,3,4,0,2 que el estado civil no sea viudo;
Hacer una emisión de predios urbanos donde los predios se encuentras ubicados en la
parroquia B. Las características del suelo sea de tipo cenagoso, húmedo e inundable,
revestimiento exteriores de tipo cemento, chapeado, enlucidos tierra, grafiado y
madera fina.
Eliminar los predios urbanos que sus escrituras se hayan hecho en la costa, sierra,
amazonia; tipo de contribuyente jurídico, religioso, gobierno, normal; la deuda por
título emitido sea menor a 20 dólares; las parroquias sean A, B, C, D, E, F;
Se desea hacer la eliminación de los títulos emitidos no cancelado por contribuyente
donde la deuda por predios sea menor a 600 dólares americanos, estos predios deben
estar ubicados en sectores con aéreas de riegos como por ejemplo
F,G,H,I,J,K,L,M,N,Ñ,A Y O.
Se desea eliminar los predios que cumplen con estas caracteristicas: El frente
principal mayor 8, Fondo relativo se encuentres entre 10 a 190, Localización
esquinero, en cabecera, interior, Escalera de Hormigón simple, ladrillo, hierro, Deuda
mayor a 30 Dólares Americanos.
Eliminar los predios con las siguientes características: Traslación de dominio posesión,
permuta, adjudicación, Uso de suelo agrícola, agro exportación, avícola, bioacuatico,
porcicola y minero, La superficie sea mayor de 5 Hectáreas.
Realizar la eliminación de la deuda de los predios urbanos ubicados en las parroquias
A, B, C, D, E, F, G, H. área de terreno entre 50 a 200 m2. La deuda por predio sea
menor a 2584 dólares.
Se necesita actualizar el 0.3 por ciento de los valores emitidos, un 0.1 por ciento de los
intereses, en los títulos de los predios urbanos ubicados en las parroquias A, K, L, M, I,
J, S. que sean de dominio público y privado,
Se desea actualizara el valor del avaluó comercial de los predios urbanos donde el
dominio sea público, su área de construcción mayor a 20 m2, cubierta de loza
hormigón armado, puertas de aluminio y enrollables, que tenga más de un piso.
Se desea hacer un descuento del 10 por ciento del valor de emisión, si cada predio
adeuda a la municipalidad valores menores a 8000 USD, estos predios deben constar
con características de suelo seco, cenagoso, ocupación edificado.
se necesita aumentar 1 por ciento al de recargo. Que las vías de acceso hacia los
predios sean de primero, segundo y tercer orden; la deuda por predio sea menor de
100; la topografía sea a nivel plana y pendiente leve; drenaje excesivo, moderado y
mal drenado;
Se requiere actualizar el avaluó real de los predios rurales donde el uso del suelo este
destinado para uso agrícola, forestal, minero, bioacuatico, comercial, agro
exportación; La deuda no sea mayor a 200 por predio.
Mostrar todos los predios que tienen escrituras donde las escrituras fuesen creadas en
la región costa, sierra y en la Amazonía, cuyos predios tenga un área de construcción
mayor 10 m2
Obtener un listado de predios que se encuentren ubicados en las parroquias I, J, K, Z,
M, S, Y, K, F, T, D y E. mostrar nombres de propietarios, que tengan conexión de agua y
que su la deuda de agua sea mayor de 10 Dólares.
Obtener un listado de predios rurales con los nombres de los propietarios, donde
predios ingresados se encuentren entre el grupo de los predios que su deuda este
entre 1 a 20000 dólares, por título emitido.
Obtener un listado de predios urbanos cuyos propietarios tenga agua potable,
mantenga una deuda pendiente por pago de mayor a 20 dólares en predios.
Se desea obtener un listado de los predios urbanos que sus intereses no sean mayor a
1 dólar por título emitido y que se estén ubicados en las parroquias K, E, R, O, P, T, D.
donde el área sea mayor a 50 m2.
Consulta
Tiempos y datos devueltos
Tablas usadas Métodos Para Resolaver SentenciasLectura /Escrituras en Tablas
Descripción
Sen
ten
cia
Pru
eba
69
ANEXOS 28 RECURSOS UTILIZADOS EN ORACLE 10G CON UN MILLON DE DATOS.
CA
T01
CA
T04
CIU
DA
D
EMI0
1
EMI0
3
GEN
01
GEN
02
PR
U0
1
PR
U0
5
PR
U1
0
PR
U2
0
PR
U3
0
PR
U5
0
PU
R01
PU
R02
PU
R04
PU
R05
PU
R06
REG
ION
REN
20
REN
21
REN
AG
UA
GEN
ERA
TE_S
ERIE
S
IND
EX F
AST
FU
LL S
CA
N
IND
EX F
ULL
SC
AN
IND
EX R
AN
GE
SCA
N
TAB
LE A
CC
ESS
FULL
TAB
LE A
CC
ESS
BY
IND
EX
RO
WID
BU
FFER
SO
RT
CO
LLEC
TIO
N IT
ERA
TOR
PIC
KLE
R F
ETC
H
DEL
ETE
DEL
ETE
STA
TEM
EN
T
FILT
ER
HA
SH G
RO
UP
BY
HA
SH J
OIN
HA
SH J
OIN
RIG
HT
SEM
I
HA
SH J
OIN
SEM
I
HA
SH U
NIQ
UE
INSE
RT
STA
TEM
EN
T
ME
RG
E JO
IN
ME
RG
E JO
IN C
AR
TESI
AN
ME
RG
E JO
IN S
EMI
NES
TED
LO
OP
S
NES
TED
LO
OP
S SE
MI
SELE
CT
STA
TEM
EN
T
SOR
T G
RO
UP
BY
SOR
T G
RO
UP
BY
NO
SOR
T
SOR
T JO
IN
SOR
T U
NIQ
UE
UP
DA
TE
UP
DA
TE S
TATE
ME
NT
VIE
W
WIN
DO
W B
UFF
ER
Tota
l Rec
urs
os
Uti
lizad
os
Sin Optimización 1 1 1 1 1 2 1 1 6 6 21 1 1 13 4 3 1 1 7 52
Primer Optimización 1 1 1 1 1 1 1 1 6 6 1 19 1 1 1 10 4 4 1 1 7 50
Segunda Optimización 1 1 1 1 1 1 1 1 13 13 1 33 1 1 1 6 4 11 1 1 3 63
Sin Optimización 1 1 2 3 1 1 1 1 1 3 3 1 1 17 1 3 1 1 10 3 1 3 1 1 4 48
Primer Optimización 1 1 2 5 1 1 1 1 1 3 3 1 1 19 1 3 2 1 11 2 2 3 1 1 1 4 53
Segunda Optimización 1 1 2 14 1 1 1 1 1 12 12 3 45 2 1 9 18 5 1 2 1 1 1 5 94
Sin Optimización 2 1 3 1 1 1 1 1 1 1 3 3 2 17 2 3 1 9 3 3 1 1 1 3 46
Primer Optimización 2 1 10 1 1 1 1 1 1 1 10 10 1 39 1 10 16 1 1 1 1 1 72
Segunda Optimización 2 1 11 1 1 1 1 1 1 1 10 10 1 40 1 6 12 1 1 12 74
Sin Optimización 1 6 1 1 1 1 1 6 6 2 22 2 4 1 12 4 1 4 1 1 1 5 60
Primer Optimización 1 16 1 1 1 1 1 15 15 1 51 1 1 6 10 10 1 2 1 1 1 10 96
Segunda Optimización 1 15 1 1 1 1 1 15 15 1 50 1 1 6 10 10 1 1 1 1 10 93
Sin Optimización 1 1 1 4 1 1 1 1 1 1 4 4 3 19 2 10 1 3 1 1 2 1 5 48
Primer Optimización 1 2 1 4 1 1 1 1 1 1 4 4 3 20 2 11 3 1 1 2 1 1 4 49
Segunda Optimización 1 1 1 13 1 1 1 1 1 1 13 13 1 2 46 2 6 14 1 1 1 13 87
Sin Optimización 1 1 1 2 1 1 1 1 1 2 2 2 12 1 11 2 1 1 1 1 32
Primer Optimización 1 1 2 7 1 1 1 1 2 6 6 1 27 1 1 2 12 1 2 5 2 1 1 6 62
Segunda Optimización 1 1 2 7 1 1 1 1 1 6 6 1 26 1 1 2 11 1 2 5 2 1 1 6 60
Sin Optimización 1 4 2 2 3 4 4 4 17 2 1 14 1 4 1 1 1 2 48
Primer Optimización 1 7 2 2 3 7 7 1 2 26 2 2 1 9 3 1 2 3 4 1 1 1 1 8 68
Segunda Optimización 1 8 2 3 3 7 7 2 29 1 1 15 2 2 5 1 1 1 1 7 68
Sin Optimización 3 5 1 1 4 4 3 15 2 1 1 9 1 2 1 2 1 1 1 40
Primer Optimización 3 9 1 1 8 8 1 2 27 2 2 2 3 2 3 5 1 4 1 1 8 64
Segunda Optimización 2 8 1 1 8 8 1 2 26 1 1 2 3 1 3 5 1 3 1 1 8 59
Sin Optimización 3 5 1 1 1 4 4 1 17 1 1 11 1 1 1 1 1 1 2 39
Primer Optimización 2 10 1 1 1 9 9 1 32 1 5 1 1 8 1 1 1 1 10 63
Segunda Optimización 2 11 1 1 1 11 11 2 36 1 2 2 1 11 1 1 1 1 12 71
Sin Optimización 1 4 1 1 3 1 4 4 18 1 13 1 1 1 1 2 38
Primer Optimización 1 4 1 1 3 1 4 4 18 1 13 1 1 1 1 2 38
Segunda Optimización 1 19 1 1 3 1 19 19 63 1 4 1 4 15 1 4 1 1 21 116
Sin Optimización 1 1 1 2 1 1 2 1 1 1 1 1 2 2 2 16 1 1 1 15 2 1 1 40
Primer Optimización 1 1 1 2 1 1 2 1 1 1 1 1 2 2 2 16 1 1 1 15 2 1 1 40
Segunda Optimización 1 1 1 8 1 1 2 1 1 1 1 1 8 8 1 2 33 2 1 1 16 1 5 5 3 9 79
Sin Optimización 1 2 3 1 1 1 3 3 3 12 2 1 1 1 11 2 1 1 1 36
Primer Optimización 1 2 3 1 1 1 3 3 3 12 2 1 1 1 11 2 1 1 1 36
Segunda Optimización 1 2 14 1 1 1 14 14 2 46 1 1 1 2 17 1 14 1 1 15 102
Sin Optimización 1 2 2 1 1 2 2 1 10 1 1 1 7 1 1 1 2 26
Primer Optimización 1 6 2 1 1 6 6 1 22 1 1 1 3 1 1 5 1 2 8 47
Segunda Optimización 1 7 2 1 1 6 6 2 22 1 1 1 2 2 2 5 1 2 7 48
Sin Optimización 1 1 1 3 1 1 1 1 1 1 1 10 1 1 1 1 7 1 1 1 2 27
Primer Optimización 1 1 4 3 2 2 1 1 3 3 1 19 1 1 1 1 7 1 1 3 1 5 42
Segunda Optimización 1 1 4 3 2 2 1 1 3 3 2 18 2 1 1 2 6 1 1 3 1 4 42
Sin Optimización 1 1 2 3 1 1 1 3 3 2 14 1 1 1 1 13 2 1 1 2 39
Primer Optimización 1 1 2 4 1 1 1 3 3 3 14 2 1 1 1 12 3 1 2 1 41
Segunda Optimización 1 1 2 13 1 1 1 12 12 3 41 2 1 1 2 15 8 7 1 7 13 101
Sin Optimización 1 1 1 1 1 1 2 1 1 1 1 2 8 2 1 1 1 5 1 1 1 2 2 1 28
Primer Optimización 1 1 1 1 1 1 2 1 1 1 1 3 7 3 1 5 1 1 1 3 2 1 1 29
Segunda Optimización 1 1 1 1 1 1 2 1 1 1 1 2 8 2 1 7 1 1 2 2 1 27
Sin Optimización 1 5 3 1 5 5 1 19 5 1 1 2 1 1 5 5 2 1 43
Primer Optimización 1 5 2 1 5 5 1 18 1 8 4 1 1 2 1 5 1 42
Segunda Optimización 1 13 2 1 13 13 1 42 1 2 1 1 13 2 13 1 76
Sin Optimización 2 2 1 3 1 1 1 3 3 2 1 3 15 3 1 7 1 3 1 4 4 1 43
Primer Optimización 2 2 1 7 1 1 1 7 7 2 1 3 27 3 1 5 1 1 1 7 3 3 8 1 64
Segunda Optimización 1 1 1 1 1 1 8 8 2 1 3 20 3 1 2 1 1 1 6 5 2 3 1 1 50
Sin Optimización 1 1 1 1 1 2 1 1 3 2 2 1 15 1 1 9 2 1 1 1 1 2 3 1 38
Primer Optimización 1 2 1 1 1 2 1 1 2 3 3 1 1 16 1 1 7 1 1 1 1 1 2 2 4 1 40
Segunda Optimización 1 1 1 1 2 1 1 2 3 3 1 15 1 1 8 1 1 1 1 2 2 1 1 35
Sin Optimización 1 1 1 2 1 1 2 2 1 1 2 2 1 3 14 2 1 1 1 6 1 1 1 1 1 3 1 2 1 1 41
Primer Optimización 1 1 1 2 1 1 2 1 1 1 2 2 1 3 13 2 1 7 1 2 1 1 2 1 2 2 1 39
Segunda Optimización 1 1 1 8 1 1 2 1 1 1 8 8 1 1 2 31 2 1 5 2 1 1 3 7 2 1 8 1 68
INSE
RT
1
2
3
4
5
3
4
5
DEL
ETE
1
2
3
4
5
Hacer una emisión de los predios ubicados en las parroquias A. el contribuyente sea
de tipo jurídico; que los predios estén en posición esquinero, interior, en cabecera;
tengan escrituras hechas en las ciudades de la sierra.
Realizar una emisión de los predios rurales, los predios rurales deben cumplir con las
siguientes especificaciones: dominio propietario, arrendatario, posesionario,
traslación de dominio herencia, donación, posesión, drenaje bien drenado, mal
drenado y moderado.
Se no pide hacer una emisión de agua potable desde los meses del año 1992 a
diciembre del 2011 los títulos que se deben emitir han de cumplir con el siguiente
criterio: los predios urbanos de la parroquia A.
Se necesita actualizar el 0.3 por ciento de los valores emitidos, un 0.1 por ciento de los
intereses, en los títulos de los predios urbanos ubicados en las parroquias A, K, L, M, I,
J, S. que sean de dominio público y privado,
Se desea actualizara el valor del avaluó comercial de los predios urbanos donde el
dominio sea público, su área de construcción mayor a 20 m2, cubierta de loza
hormigón armado, puertas de aluminio y enrollables, que tenga más de un piso.
Se desea hacer un descuento del 10 por ciento del valor de emisión, si cada predio
adeuda a la municipalidad valores menores a 8000 USD, estos predios deben constar
con características de suelo seco, cenagoso, ocupación edificado.
se necesita aumentar 1 por ciento al de recargo. Que las vías de acceso hacia los
predios sean de primero, segundo y tercer orden; la deuda por predio sea menor de
100; la topografía sea a nivel plana y pendiente leve; drenaje excesivo, moderado y
mal drenado;
Se requiere actualizar el avaluó real de los predios rurales donde el uso del suelo este
destinado para uso agrícola, forestal, minero, bioacuatico, comercial, agro
exportación; La deuda no sea mayor a 200 por predio.
Mostrar todos los predios que tienen escrituras donde las escrituras fuesen creadas en
la región costa, sierra y en la Amazonía, cuyos predios tenga un área de construcción
mayor 10 m2
Obtener un listado de predios que se encuentren ubicados en las parroquias I, J, K, Z,
M, S, Y, K, F, T, D y E. mostrar nombres de propietarios, que tengan conexión de agua y
que su la deuda de agua sea mayor de 10 Dólares.
Obtener un listado de predios rurales con los nombres de los propietarios, donde
predios ingresados se encuentren entre el grupo de los predios que su deuda este
entre 1 a 20000 dólares, por título emitido.
Obtener un listado de predios urbanos cuyos propietarios tenga agua potable,
mantenga una deuda pendiente por pago de mayor a 20 dólares en predios.
Se desea obtener un listado de los predios urbanos que sus intereses no sean mayor a
1 dólar por título emitido y que se estén ubicados en las parroquias K, E, R, O, P, T, D.
donde el área sea mayor a 50 m2.
Lectura /Escrituras en
Tablas
Sen
ten
cia
Hacer una emisión de predios urbanos donde los predios se encuentras ubicados en la
parroquia B. Las características del suelo sea de tipo cenagoso, húmedo e inundable,
revestimiento exteriores de tipo cemento, chapeado, enlucidos tierra, grafiado y
madera fina.
Eliminar los predios urbanos que sus escrituras se hayan hecho en la costa, sierra,
amazonia; tipo de contribuyente jurídico, religioso, gobierno, normal; la deuda por
título emitido sea menor a 20 dólares; las parroquias sean A, B, C, D, E, F;
Se desea hacer la eliminación de los títulos emitidos no cancelado por contribuyente
donde la deuda por predios sea menor a 600 dólares americanos, estos predios deben
estar ubicados en sectores con aéreas de riegos como por ejemplo
F,G,H,I,J,K,L,M,N,Ñ,A Y O.
Se desea eliminar los predios que cumplen con estas caracteristicas: El frente
principal mayor 8, Fondo relativo se encuentres entre 10 a 190, Localización
esquinero, en cabecera, interior, Escalera de Hormigón simple, ladrillo, hierro, Deuda
mayor a 30 Dólares Americanos.
Eliminar los predios con las siguientes características: Traslación de dominio posesión,
permuta, adjudicación, Uso de suelo agrícola, agro exportación, avícola, bioacuatico,
porcicola y minero, La superficie sea mayor de 5 Hectáreas.
Realizar la eliminación de la deuda de los predios urbanos ubicados en las parroquias
A, B, C, D, E, F, G, H. área de terreno entre 50 a 200 m2. La deuda por predio sea
menor a 2584 dólares.
Tiempos y datos devueltos
Métodos Para Resolaver Sentencias
Consulta
Tablas usadas
Se necesita hacer una emisión de predios urbanos donde el área del predio este entre
10 m2 y 200 m2, que los dueños tengan un numero de cedula que termine en los
números 1,9,6,3,4,0,2 que el estado civil no sea viudo;
Descripción
Pru
eba
SELE
CT
1
2
3
4
5
UP
DA
TE
1
2
70
ANEXOS 29 RECURSOS UTILIZADOS EN ORACLE 10G CON CINCO MILLONES DE DATOS.
CA
T01
CA
T04
CIU
DA
D
EMI0
1
EMI0
3
GEN
01
GEN
02
PR
U01
PR
U05
PR
U10
PR
U20
PR
U30
PR
U50
PU
R01
PU
R02
PU
R04
PU
R05
PU
R06
REG
ION
REN
20
REN
21
REN
AG
UA
GEN
ERA
TE_S
ERIE
S
IND
EX F
AST
FU
LL S
CA
N
IND
EX F
ULL
SC
AN
IND
EX R
AN
GE
SCA
N
TAB
LE A
CC
ESS
BY
IND
EX
RO
WID
TAB
LE A
CC
ESS
FULL
BU
FFER
SO
RT
CO
LLEC
TIO
N IT
ERA
TOR
PIC
KLE
R F
ETC
H
DEL
ETE
DEL
ETE
STA
TEM
ENT
FILT
ER
HA
SH G
RO
UP
BY
HA
SH J
OIN
HA
SH J
OIN
RIG
HT
SEM
I
HA
SH J
OIN
SEM
I
HA
SH U
NIQ
UE
INSE
RT
STA
TEM
ENT
MER
GE
JOIN
MER
GE
JOIN
CA
RTE
SIA
N
NES
TED
LO
OP
S
NES
TED
LO
OP
S SE
MI
SELE
CT
STA
TEM
ENT
SOR
T G
RO
UP
BY
SOR
T G
RO
UP
BY
NO
SOR
T
SOR
T JO
IN
SOR
T U
NIQ
UE
UP
DA
TE
UP
DA
TE S
TATE
MEN
T
VIE
W
WIN
DO
W B
UFF
ER
Tota
l Rec
urs
os
Uti
lizad
os
Sin Optimización 1 1 1 1 1 2 1 1 6 6 21 1 1 13 5 2 1 1 7 52
Primer Optimización 1 1 1 1 1 1 1 1 6 6 1 1 19 1 1 10 5 3 1 1 7 50
Segunda Optimización 1 1 1 1 1 1 1 1 13 13 1 1 33 1 1 6 3 12 1 1 3 63
Sin Optimización 1 1 2 3 1 1 1 1 1 3 3 1 18 3 1 1 10 3 2 3 1 4 47
Primer Optimización 1 1 2 5 1 1 1 1 3 3 2 19 3 2 1 11 2 2 3 1 1 1 4 52
Segunda Optimización 1 1 2 14 1 1 1 1 12 12 1 1 46 9 20 7 1 1 6 92
Sin Optimización 2 1 3 1 1 1 1 1 1 1 3 3 1 1 18 3 9 4 1 3 1 1 4 46
Primer Optimización 2 1 10 1 1 1 1 1 1 1 10 10 1 1 39 10 16 1 1 1 1 1 72
Segunda Optimización 2 1 11 1 1 1 1 1 1 1 10 10 1 1 40 6 12 1 1 12 74
Sin Optimización 1 6 1 1 1 1 1 6 6 1 1 23 4 1 12 4 1 4 1 1 1 5 59
Primer Optimización 1 16 1 1 1 1 1 15 15 52 1 6 10 11 1 1 1 1 10 94
Segunda Optimización 1 15 1 1 1 1 1 15 15 51 1 6 10 10 1 1 1 1 10 92
Sin Optimización 1 1 1 4 1 1 1 1 1 1 4 4 2 1 20 10 2 3 1 1 1 1 5 47
Primer Optimización 1 2 1 4 1 1 1 1 1 4 4 1 2 1 20 11 3 2 1 1 1 1 4 48
Segunda Optimización 1 1 1 13 1 1 1 1 1 13 13 2 1 1 46 6 15 1 1 13 86
Sin Optimización 1 1 2 2 1 1 1 1 1 2 2 1 1 13 11 1 1 1 1 1 31
Primer Optimización 1 1 2 7 1 1 1 1 2 6 6 1 1 27 1 2 12 1 2 5 2 1 1 6 62
Segunda Optimización 1 1 2 7 1 1 1 1 1 6 6 1 1 26 1 2 11 1 2 5 2 1 1 6 60
Sin Optimización 2 4 2 2 3 4 4 3 2 18 1 15 1 3 1 1 1 2 48
Primer Optimización 1 8 2 3 3 7 7 2 1 29 1 15 2 2 5 1 1 1 1 7 68
Segunda Optimización 1 7 2 2 3 7 7 1 1 1 27 2 1 10 3 1 2 2 4 1 1 1 1 8 67
Sin Optimización 3 5 1 1 4 4 1 17 1 9 1 2 1 1 1 1 1 36
Primer Optimización 3 9 1 1 8 8 1 29 1 2 3 1 1 3 5 1 3 1 1 8 60
Segunda Optimización 3 8 1 1 8 8 1 28 1 2 3 1 1 2 5 1 2 1 1 8 57
Sin Optimización 3 5 1 1 1 4 4 18 1 11 1 1 1 1 1 1 2 38
Primer Optimización 3 10 1 1 1 9 9 33 1 5 2 8 1 1 1 10 62
Segunda Optimización 3 11 1 1 1 11 11 38 2 2 1 11 1 1 1 12 69
Sin Optimización 1 4 1 1 3 1 4 4 18 1 13 1 1 1 1 2 38
Primer Optimización 1 4 1 1 3 1 4 4 18 1 13 1 1 1 1 2 38
Segunda Optimización 1 19 1 1 3 1 19 19 63 1 4 1 4 15 1 4 1 1 21 116
Sin Optimización 1 1 1 2 1 1 1 1 1 1 1 1 2 2 1 1 16 1 1 16 1 1 1 39
Primer Optimización 1 1 1 2 1 1 1 1 1 1 1 1 2 2 1 1 16 1 1 16 1 1 1 39
Segunda Optimización 1 1 1 8 1 1 1 1 1 1 1 1 8 8 1 1 34 1 1 18 1 3 5 3 9 77
Sin Optimización 1 3 3 1 1 3 3 1 14 1 1 2 12 1 1 1 34
Primer Optimización 1 3 3 1 1 3 3 1 14 1 1 2 12 1 1 1 34
Segunda Optimización 1 3 14 1 1 14 14 1 47 1 1 2 17 1 14 1 15 100
Sin Optimización 1 2 2 1 1 2 2 1 10 1 1 1 7 1 1 1 2 26
Primer Optimización 1 6 2 1 1 6 6 1 22 1 1 1 3 1 1 5 1 1 8 46
Segunda Optimización 1 7 2 1 1 6 6 1 23 1 1 2 2 2 5 1 2 7 47
Sin Optimización 1 1 1 3 1 1 1 1 1 1 1 1 10 1 1 1 7 1 1 1 2 27
Primer Optimización 1 1 4 3 2 2 1 1 3 3 1 1 19 1 1 1 7 1 1 3 1 5 42
Segunda Optimización 1 1 4 3 2 2 1 1 3 3 1 1 19 1 1 2 6 1 1 3 1 4 41
Sin Optimización 1 1 3 3 1 1 1 3 3 1 1 15 1 1 1 13 1 1 1 2 38
Primer Optimización 1 1 3 4 1 1 1 3 3 1 1 16 1 1 1 12 1 1 1 1 1 38
Segunda Optimización 1 1 3 13 1 1 12 12 1 1 1 42 1 1 2 15 1 1 6 7 1 5 13 98
Sin Optimización 1 1 1 1 1 1 2 1 1 1 1 2 2 8 1 1 1 5 1 1 1 2 2 1 28
Primer Optimización 1 1 1 1 1 1 2 1 1 1 1 3 3 7 1 5 1 1 1 3 2 1 1 29
Segunda Optimización 1 1 1 1 1 1 2 1 1 1 1 2 2 8 1 7 1 1 2 2 1 27
Sin Optimización 1 5 3 1 5 5 1 19 5 1 1 2 1 1 5 5 2 1 43
Primer Optimización 1 5 2 1 5 5 1 18 1 8 4 1 1 2 1 5 1 42
Segunda Optimización 1 13 2 1 13 13 1 42 1 2 1 1 13 2 13 1 76
Sin Optimización 2 2 1 3 1 1 1 3 3 2 1 3 3 15 1 7 1 3 1 4 4 1 43
Primer Optimización 2 2 1 7 1 1 1 7 7 2 1 3 3 27 1 5 1 1 1 7 3 3 8 1 64
Segunda Optimización 1 1 1 1 1 1 8 8 2 1 3 3 20 1 2 1 1 1 6 5 2 3 1 1 50
Sin Optimización 1 1 1 1 1 2 1 1 3 2 2 1 15 1 1 9 2 1 1 1 1 2 3 1 38
Primer Optimización 1 2 1 1 1 2 1 1 2 3 3 1 17 1 8 1 1 1 1 2 2 4 1 39
Segunda Optimización 1 1 1 1 2 1 1 2 3 3 1 15 1 1 8 1 1 1 1 2 2 1 1 35
Sin Optimización 1 1 1 2 1 1 2 2 1 1 2 2 1 3 2 14 1 1 1 6 1 1 1 1 1 3 1 2 1 1 41
Primer Optimización 1 1 1 2 1 1 2 1 1 1 2 2 1 3 2 13 1 7 1 2 1 1 2 1 2 2 1 39
Segunda Optimización 1 1 1 8 1 1 2 1 1 1 8 8 1 1 2 2 31 1 5 2 1 1 3 7 2 1 8 1 68
INSE
RT
1
2
3
4
5
3
4
5
DEL
ETE
1
2
3
4
5
Hacer una emisión de los predios ubicados en las parroquias A. el contribuyente sea
de tipo jurídico; que los predios estén en posición esquinero, interior, en cabecera;
tengan escrituras hechas en las ciudades de la sierra.
Realizar una emisión de los predios rurales, los predios rurales deben cumplir con las
siguientes especificaciones: dominio propietario, arrendatario, posesionario,
traslación de dominio herencia, donación, posesión, drenaje bien drenado, mal
drenado y moderado.
Se no pide hacer una emisión de agua potable desde los meses del año 1992 a
diciembre del 2011 los títulos que se deben emitir han de cumplir con el siguiente
criterio: los predios urbanos de la parroquia A.
Se necesita actualizar el 0.3 por ciento de los valores emitidos, un 0.1 por ciento de los
intereses, en los títulos de los predios urbanos ubicados en las parroquias A, K, L, M, I,
J, S. que sean de dominio público y privado,
Se desea actualizara el valor del avaluó comercial de los predios urbanos donde el
dominio sea público, su área de construcción mayor a 20 m2, cubierta de loza
hormigón armado, puertas de aluminio y enrollables, que tenga más de un piso.
Se desea hacer un descuento del 10 por ciento del valor de emisión, si cada predio
adeuda a la municipalidad valores menores a 8000 USD, estos predios deben constar
con características de suelo seco, cenagoso, ocupación edificado.
se necesita aumentar 1 por ciento al de recargo. Que las vías de acceso hacia los
predios sean de primero, segundo y tercer orden; la deuda por predio sea menor de
100; la topografía sea a nivel plana y pendiente leve; drenaje excesivo, moderado y
mal drenado;
Se requiere actualizar el avaluó real de los predios rurales donde el uso del suelo este
destinado para uso agrícola, forestal, minero, bioacuatico, comercial, agro
exportación; La deuda no sea mayor a 200 por predio.
Mostrar todos los predios que tienen escrituras donde las escrituras fuesen creadas en
la región costa, sierra y en la Amazonía, cuyos predios tenga un área de construcción
mayor 10 m2
Obtener un listado de predios que se encuentren ubicados en las parroquias I, J, K, Z,
M, S, Y, K, F, T, D y E. mostrar nombres de propietarios, que tengan conexión de agua y
que su la deuda de agua sea mayor de 10 Dólares.
Obtener un listado de predios rurales con los nombres de los propietarios, donde
predios ingresados se encuentren entre el grupo de los predios que su deuda este
entre 1 a 20000 dólares, por título emitido.
Obtener un listado de predios urbanos cuyos propietarios tenga agua potable,
mantenga una deuda pendiente por pago de mayor a 20 dólares en predios.
Se desea obtener un listado de los predios urbanos que sus intereses no sean mayor a
1 dólar por título emitido y que se estén ubicados en las parroquias K, E, R, O, P, T, D.
donde el área sea mayor a 50 m2.
Métodos Para Resolaver Sentencias
Sen
ten
cia
Hacer una emisión de predios urbanos donde los predios se encuentras ubicados en la
parroquia B. Las características del suelo sea de tipo cenagoso, húmedo e inundable,
revestimiento exteriores de tipo cemento, chapeado, enlucidos tierra, grafiado y
madera fina.
Eliminar los predios urbanos que sus escrituras se hayan hecho en la costa, sierra,
amazonia; tipo de contribuyente jurídico, religioso, gobierno, normal; la deuda por
título emitido sea menor a 20 dólares; las parroquias sean A, B, C, D, E, F;
Se desea hacer la eliminación de los títulos emitidos no cancelado por contribuyente
donde la deuda por predios sea menor a 600 dólares americanos, estos predios deben
estar ubicados en sectores con aéreas de riegos como por ejemplo
F,G,H,I,J,K,L,M,N,Ñ,A Y O.
Se desea eliminar los predios que cumplen con estas caracteristicas: El frente
principal mayor 8, Fondo relativo se encuentres entre 10 a 190, Localización
esquinero, en cabecera, interior, Escalera de Hormigón simple, ladrillo, hierro, Deuda
mayor a 30 Dólares Americanos.
Eliminar los predios con las siguientes características: Traslación de dominio posesión,
permuta, adjudicación, Uso de suelo agrícola, agro exportación, avícola, bioacuatico,
porcicola y minero, La superficie sea mayor de 5 Hectáreas.
Realizar la eliminación de la deuda de los predios urbanos ubicados en las parroquias
A, B, C, D, E, F, G, H. área de terreno entre 50 a 200 m2. La deuda por predio sea
menor a 2584 dólares.
Tiempos y datos devueltos
Consulta
Lectura /Escrituras en
TablasTablas usadas
Se necesita hacer una emisión de predios urbanos donde el área del predio este entre
10 m2 y 200 m2, que los dueños tengan un numero de cedula que termine en los
números 1,9,6,3,4,0,2 que el estado civil no sea viudo;
Descripción
Pru
eba
SELE
CT
1
2
3
4
5
UP
DA
TE
1
2
71
ANEXOS 30 TABLAS UTILIZADAS EN POSTGRES, ORACLE Y SQL SERVER 2008 CON UN MILLON DE DATOS.
PR
U3
0
PR
U5
0
PR
U2
0
PU
R0
5
EMI0
1
EMI0
3
REN
20
REN
21
PU
R0
2
PU
R0
5
GEN
01
PU
R0
6
PR
U1
0
CA
T04
CIU
DA
D
REG
ION
PU
R0
4
PU
R0
5
PU
R0
1
GEN
02
PR
U0
1
Pro
vin
cia
CA
T01
Gen
erat
e_Se
ries
REN
AG
UA
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sen
ten
cia
Pru
eba
3
4
5
DEL
ETE
1
2
3
4
5
INSE
RT
1
2
3
4
5
SELE
CT
1
2
3
4
5
UP
DA
TE
1
2
Se necesita hacer una emisión de predios urbanos donde el área del predio este entre 10 m2 y 200
m2, que los dueños tengan un numero de cedula que termine en los números 1,9,6,3,4,0,2 que el
estado civil no sea viudo;
Hacer una emisión de predios urbanos donde los predios se encuentras ubicados en la parroquia B.
Las características del suelo sea de tipo cenagoso, húmedo e inundable, revestimiento exteriores de
tipo cemento, chapeado, enlucidos tierra, grafiado y madera fina.
Descripción
Eliminar los predios con las siguientes características: Traslación de dominio posesión, permuta,
adjudicación, Uso de suelo agrícola, agro exportación, avícola, bioacuatico, porcicola y minero, La
superficie sea mayor de 5 Hectáreas.
Realizar la eliminación de la deuda de los predios urbanos ubicados en las parroquias A, B, C, D, E,
F, G, H. área de terreno entre 50 a 200 m2. La deuda por predio sea menor a 2584 dólares.
Hacer una emisión de los predios ubicados en las parroquias A. el contribuyente sea de tipo
jurídico; que los predios estén en posición esquinero, interior, en cabecera; tengan escrituras
hechas en las ciudades de la sierra.
Realizar una emisión de los predios rurales, los predios rurales deben cumplir con las siguientes
especificaciones: dominio propietario, arrendatario, posesionario, traslación de dominio herencia,
donación, posesión, drenaje bien drenado, mal drenado y moderado.
Se no pide hacer una emisión de agua potable desde los meses del año 1992 a diciembre del 2011
los títulos que se deben emitir han de cumplir con el siguiente criterio: los predios urbanos de la
parroquia A.
se necesita aumentar 1 por ciento al de recargo. Que las vías de acceso hacia los predios sean de
primero, segundo y tercer orden; la deuda por predio sea menor de 100; la topografía sea a nivel
plana y pendiente leve; drenaje excesivo, moderado y mal drenado;
Se requiere actualizar el avaluó real de los predios rurales donde el uso del suelo este destinado
para uso agrícola, forestal, minero, bioacuatico, comercial, agro exportación; La deuda no sea mayor
a 200 por predio.
Eliminar los predios urbanos que sus escrituras se hayan hecho en la costa, sierra, amazonia; tipo de
contribuyente jurídico, religioso, gobierno, normal; la deuda por título emitido sea menor a 20
dólares; las parroquias sean A, B, C, D, E, F;
Se desea hacer la eliminación de los títulos emitidos no cancelado por contribuyente donde la
deuda por predios sea menor a 600 dólares americanos, estos predios deben estar ubicados en
sectores con aéreas de riegos como por ejemplo F,G,H,I,J,K,L,M,N,Ñ,A Y O.
Se desea eliminar los predios que cumplen con estas caracteristicas: El frente principal mayor 8,
Fondo relativo se encuentres entre 10 a 190, Localización esquinero, en cabecera, interior, Escalera
de Hormigón simple, ladrillo, hierro, Deuda mayor a 30 Dólares Americanos.
Obtener un listado de predios urbanos cuyos propietarios tenga agua potable, mantenga una deuda
pendiente por pago de mayor a 20 dólares en predios.
Se desea obtener un listado de los predios urbanos que sus intereses no sean mayor a 1 dólar por
título emitido y que se estén ubicados en las parroquias K, E, R, O, P, T, D. donde el área sea mayor
a 50 m2.
Tablas
Se necesita actualizar el 0.3 por ciento de los valores emitidos, un 0.1 por ciento de los intereses,
en los títulos de los predios urbanos ubicados en las parroquias A, K, L, M, I, J, S. que sean de
dominio público y privado,
Se desea actualizara el valor del avaluó comercial de los predios urbanos donde el dominio sea
público, su área de construcción mayor a 20 m2, cubierta de loza hormigón armado, puertas de
aluminio y enrollables, que tenga más de un piso.
Se desea hacer un descuento del 10 por ciento del valor de emisión, si cada predio adeuda a la
municipalidad valores menores a 8000 USD, estos predios deben constar con características de
suelo seco, cenagoso, ocupación edificado.
Sentencias
Mostrar todos los predios que tienen escrituras donde las escrituras fuesen creadas en la región
costa, sierra y en la Amazonía, cuyos predios tenga un área de construcción mayor 10 m2
Obtener un listado de predios que se encuentren ubicados en las parroquias I, J, K, Z, M, S, Y, K, F,
T, D y E. mostrar nombres de propietarios, que tengan conexión de agua y que su la deuda de agua
sea mayor de 10 Dólares.
Obtener un listado de predios rurales con los nombres de los propietarios, donde predios
ingresados se encuentren entre el grupo de los predios que su deuda este entre 1 a 20000 dólares,
por título emitido.
72
ANEXO 31 TABLAS UTILIZADAS EN POSTGRES 9.0, ORACLE 10G Y SQL SERVER 2008 R2 CON CINCO MILLONES DE DATOS.
PR
OV
INC
IA
PR
U3
0
PR
U2
0
PR
U5
0
CA
T01
CIU
DA
D
PU
R0
6
EM
I01
EM
I03
RE
N2
0
RE
N2
1
PU
R0
2
PU
R0
5
PU
R0
1
RE
NA
GU
A
GE
N0
2
PU
R0
4
GE
N0
1
RE
GIO
N
Ge
ne
rate
_Se
rie
s
CA
T04
PR
U0
1
PR
U0
5
PR
U1
0
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sen
ten
cia
Pru
eb
a
INSE
RT
1
2
3
4
5
DEL
ETE
1
2
3
4
5
1
2
3
4
5
Se necesita hacer una emisión de predios urbanos donde el área del predio este entre 10 m2 y 200 m2, que
los dueños tengan un numero de cedula que termine en los números 1,9,6,3,4,0,2 que el estado civil no sea
viudo;
Hacer una emisión de predios urbanos donde los predios se encuentras ubicados en la parroquia B. Las
características del suelo sea de tipo cenagoso, húmedo e inundable, revestimiento exteriores de tipo
cemento, chapeado, enlucidos tierra, grafiado y madera fina.
Descripción
Eliminar los predios con las siguientes características: Traslación de dominio posesión, permuta,
adjudicación, Uso de suelo agrícola, agro exportación, avícola, bioacuatico, porcicola y minero, La superficie
sea mayor de 5 Hectáreas.
Realizar la eliminación de la deuda de los predios urbanos ubicados en las parroquias A, B, C, D, E, F, G, H.
área de terreno entre 50 a 200 m2. La deuda por predio sea menor a 2584 dólares.
Hacer una emisión de los predios ubicados en las parroquias A. el contribuyente sea de tipo jurídico; que
los predios estén en posición esquinero, interior, en cabecera; tengan escrituras hechas en las ciudades de la
sierra.
Realizar una emisión de los predios rurales, los predios rurales deben cumplir con las siguientes
especificaciones: dominio propietario, arrendatario, posesionario, traslación de dominio herencia, donación,
posesión, drenaje bien drenado, mal drenado y moderado.
Se no pide hacer una emisión de agua potable desde los meses del año 1992 a diciembre del 2011 los
títulos que se deben emitir han de cumplir con el siguiente criterio: los predios urbanos de la parroquia A.
se necesita aumentar 1 por ciento al de recargo. Que las vías de acceso hacia los predios sean de primero,
segundo y tercer orden; la deuda por predio sea menor de 100; la topografía sea a nivel plana y pendiente
leve; drenaje excesivo, moderado y mal drenado;
Se requiere actualizar el avaluó real de los predios rurales donde el uso del suelo este destinado para uso
agrícola, forestal, minero, bioacuatico, comercial, agro exportación; La deuda no sea mayor a 200 por predio.
Eliminar los predios urbanos que sus escrituras se hayan hecho en la costa, sierra, amazonia; tipo de
contribuyente jurídico, religioso, gobierno, normal; la deuda por título emitido sea menor a 20 dólares; las
parroquias sean A, B, C, D, E, F;
Se desea hacer la eliminación de los títulos emitidos no cancelado por contribuyente donde la deuda por
predios sea menor a 600 dólares americanos, estos predios deben estar ubicados en sectores con aéreas de
riegos como por ejemplo F,G,H,I,J,K,L,M,N,Ñ,A Y O.
Se desea eliminar los predios que cumplen con estas caracteristicas: El frente principal mayor 8, Fondo
relativo se encuentres entre 10 a 190, Localización esquinero, en cabecera, interior, Escalera de Hormigón
simple, ladrillo, hierro, Deuda mayor a 30 Dólares Americanos.
Obtener un listado de predios urbanos cuyos propietarios tenga agua potable, mantenga una deuda
pendiente por pago de mayor a 20 dólares en predios.
Se desea obtener un listado de los predios urbanos que sus intereses no sean mayor a 1 dólar por título
emitido y que se estén ubicados en las parroquias K, E, R, O, P, T, D. donde el área sea mayor a 50 m2.
Tablas
Se necesita actualizar el 0.3 por ciento de los valores emitidos, un 0.1 por ciento de los intereses, en los
títulos de los predios urbanos ubicados en las parroquias A, K, L, M, I, J, S. que sean de dominio público y
privado,
Se desea actualizara el valor del avaluó comercial de los predios urbanos donde el dominio sea público, su
área de construcción mayor a 20 m2, cubierta de loza hormigón armado, puertas de aluminio y enrollables,
que tenga más de un piso.
Se desea hacer un descuento del 10 por ciento del valor de emisión, si cada predio adeuda a la
municipalidad valores menores a 8000 USD, estos predios deben constar con características de suelo seco,
cenagoso, ocupación edificado.
Sentencias
Mostrar todos los predios que tienen escrituras donde las escrituras fuesen creadas en la región costa, sierra
y en la Amazonía, cuyos predios tenga un área de construcción mayor 10 m2
Obtener un listado de predios que se encuentren ubicados en las parroquias I, J, K, Z, M, S, Y, K, F, T, D y E.
mostrar nombres de propietarios, que tengan conexión de agua y que su la deuda de agua sea mayor de 10
Dólares.
Obtener un listado de predios rurales con los nombres de los propietarios, donde predios ingresados se
encuentren entre el grupo de los predios que su deuda este entre 1 a 20000 dólares, por título emitido.
SELE
CT
1
2
3
4
5
UP
DA
TE
73
ANEXO 32 ALGORITMOS UTILIZADOS EN BASES DE DATOS POSTGRES 9.0, SQL SERVER 2008 R2 Y ORACLE 10G CON UN MILLON DE DATOS.
Win
do
w B
uff
er
Inse
rt S
tate
men
t
Co
llect
ion
Iter
ato
r P
ickl
er F
etch
Del
ete
Del
ete
Stat
emen
t
Ind
ex R
ange
Sca
n
Vie
w
Sele
ct S
tate
men
t
Tab
le A
cces
s B
y In
dex
Ro
wid
Up
dat
e
Up
dat
e St
atem
ent
Bu
ffer
So
rt
Win
do
ws
Agg
Agg
rega
te
F()
Gro
up
aggr
egat
e
Mat
eria
lize
Sub
qu
ery
Un
iqu
e
Ind
ex S
eek
Rid
Lo
cku
p
Ass
ert
Co
mp
ute
Sca
lar
Stre
am A
ggre
gate
Top
Tab
le S
po
ol
Tab
le D
elet
e
Co
nca
tio
nat
er
Secu
ence
Tab
le In
sert
Pro
yect
o D
e S
ecu
enci
a
Segm
ent
Tab
la V
alu
e
Ind
ex In
sert
Ind
ex D
elet
e
Ind
ex S
po
ol
Ro
w C
ou
nt
Spo
ol
Esca
neo
de
Tab
la p
or
Ind
ices
Esca
neo
de
tab
las
secu
enci
al
Has
Jo
in
Nes
ted
Lo
op
Mer
je J
oin
Sort
Filt
er
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sen
ten
cia
Pru
eba
3
4
5
INSE
RT
1
2
3
4
5
Se necesita hacer una emisión de predios urbanos donde el área del predio este entre
10 m2 y 200 m2, que los dueños tengan un numero de cedula que termine en los
números 1,9,6,3,4,0,2 que el estado civil no sea viudo;
Hacer una emisión de predios urbanos donde los predios se encuentras ubicados en la
parroquia B. Las características del suelo sea de tipo cenagoso, húmedo e inundable,
revestimiento exteriores de tipo cemento, chapeado, enlucidos tierra, grafiado y
madera fina.
Descripción Consultas
Realizar una emisión de los predios rurales, los predios rurales deben cumplir con las
siguientes especificaciones: dominio propietario, arrendatario, posesionario, traslación
de dominio herencia, donación, posesión, drenaje bien drenado, mal drenado y
moderado.Se no pide hacer una emisión de agua potable desde los meses del año 1992 a
diciembre del 2011 los títulos que se deben emitir han de cumplir con el siguiente
criterio: los predios urbanos de la parroquia A.
Se necesita actualizar el 0.3 por ciento de los valores emitidos, un 0.1 por ciento de los
intereses, en los títulos de los predios urbanos ubicados en las parroquias A, K, L, M, I,
J, S. que sean de dominio público y privado,
SELE
CT
1
2
3
4
5
UP
DA
TE
1
2
Hacer una emisión de los predios ubicados en las parroquias A. el contribuyente sea de
tipo jurídico; que los predios estén en posición esquinero, interior, en cabecera; tengan
escrituras hechas en las ciudades de la sierra.
Se desea actualizara el valor del avaluó comercial de los predios urbanos donde el
dominio sea público, su área de construcción mayor a 20 m2, cubierta de loza hormigón
armado, puertas de aluminio y enrollables, que tenga más de un piso.
Se desea hacer un descuento del 10 por ciento del valor de emisión, si cada predio
adeuda a la municipalidad valores menores a 8000 USD, estos predios deben constar
con características de suelo seco, cenagoso, ocupación edificado.
se necesita aumentar 1 por ciento al de recargo. Que las vías de acceso hacia los
predios sean de primero, segundo y tercer orden; la deuda por predio sea menor de
100; la topografía sea a nivel plana y pendiente leve; drenaje excesivo, moderado y mal
drenado;Se requiere actualizar el avaluó real de los predios rurales donde el uso del suelo este
destinado para uso agrícola, forestal, minero, bioacuatico, comercial, agro exportación;
La deuda no sea mayor a 200 por predio.
Eliminar los predios urbanos que sus escrituras se hayan hecho en la costa, sierra,
amazonia; tipo de contribuyente jurídico, religioso, gobierno, normal; la deuda por
título emitido sea menor a 20 dólares; las parroquias sean A, B, C, D, E, F;
Se desea hacer la eliminación de los títulos emitidos no cancelado por contribuyente
donde la deuda por predios sea menor a 600 dólares americanos, estos predios deben
estar ubicados en sectores con aéreas de riegos como por ejemplo F,G,H,I,J,K,L,M,N,Ñ,A
Y O.
ALGORITMOS UTILIZADOS EN BASES DE DATOS POSTGRES 9.0, SQL SERVER 2008 R2 Y ORACLE 10G
Se desea eliminar los predios que cumplen con estas caracteristicas: El frente principal
mayor 8, Fondo relativo se encuentres entre 10 a 190, Localización esquinero, en
cabecera, interior, Escalera de Hormigón simple, ladrillo, hierro, Deuda mayor a 30
Dólares Americanos. Eliminar los predios con las siguientes características: Traslación de dominio posesión,
permuta, adjudicación, Uso de suelo agrícola, agro exportación, avícola, bioacuatico,
porcicola y minero, La superficie sea mayor de 5 Hectáreas.
Realizar la eliminación de la deuda de los predios urbanos ubicados en las parroquias A,
B, C, D, E, F, G, H. área de terreno entre 50 a 200 m2. La deuda por predio sea menor a
2584 dólares.
Mostrar todos los predios que tienen escrituras donde las escrituras fuesen creadas en
la región costa, sierra y en la Amazonía, cuyos predios tenga un área de construcción
mayor 10 m2
Obtener un listado de predios que se encuentren ubicados en las parroquias I, J, K, Z, M,
S, Y, K, F, T, D y E. mostrar nombres de propietarios, que tengan conexión de agua y que
su la deuda de agua sea mayor de 10 Dólares.
Obtener un listado de predios rurales con los nombres de los propietarios, donde
predios ingresados se encuentren entre el grupo de los predios que su deuda este entre
1 a 20000 dólares, por título emitido.
Obtener un listado de predios urbanos cuyos propietarios tenga agua potable,
mantenga una deuda pendiente por pago de mayor a 20 dólares en predios.
Se desea obtener un listado de los predios urbanos que sus intereses no sean mayor a 1
dólar por título emitido y que se estén ubicados en las parroquias K, E, R, O, P, T, D.
donde el área sea mayor a 50 m2.
3
4
5
DEL
ETE
1
2
74
ANEXO 33 ALGORITMOS UTILIZADOS EN BASES DE DATOS POSTGRES 9.0, SQL SERVER 2008 R2 Y ORACLE 10G CON 5 MILLONES DE DATOS.
Bit
map
Ind
ex
Scan
Bu
ffer
So
rt
Co
llect
ion
Iter
ato
r P
ickl
er F
etch
Del
ete
Del
ete
Stat
emen
t
Inse
rt S
tate
men
t
Ind
ex
Ran
ge S
can
Up
dat
e
Up
dat
e St
atem
ent
Vie
w
Tab
le A
cces
s B
y In
de
x R
ow
id
Sele
ct S
tate
men
t
Win
do
w B
uff
er
Agg
rega
te
Mat
eria
lize
Gro
up
aggr
egat
e
Bit
map
Hea
d S
can
F()
Sub
qu
ery
Win
do
ws
Agg
Un
iqu
e
Ind
ex
Del
ete
Ind
ex
Inse
rt
Ind
ex
Spo
ol
Ind
ex
Up
dat
e
Split
Rid
Lo
cku
p
Ro
w C
ou
nt
Spo
ol
Par
alle
lism
Tab
la V
alu
e
Tab
le I
nse
rt
Pro
yect
o D
e S
ecu
en
cia
Secu
en
ce
Segm
ent
Ass
ert
Co
mp
ute
Sca
lar
Stre
am A
ggre
gate
Ind
ex
See
k
Top
Tab
le D
elet
e
Tab
le S
po
ol
Tab
le U
pd
ate
Co
nca
tio
nat
er
Bit
map
Filt
er
Sort
Lect
ura
s Se
cue
nci
al d
e t
abla
s
Mer
ge J
oin
Nes
ted
Lo
op
Esca
ne
o d
e t
abla
s se
cue
nci
al
Has
Jo
in
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sin Optimización
Primer Optimización
Segunda Optimización
Sen
ten
cia
Pru
eba
INSE
RT
1
2
3
4
5
3
4
5
DEL
ETE
1
2
3
4
5
Se no pide hacer una emisión de agua potable desde los meses del año 1992 a
diciembre del 2011 los títulos que se deben emitir han de cumplir con el siguiente
criterio: los predios urbanos de la parroquia A.
Se necesita hacer una emisión de predios urbanos donde el área del predio este entre
10 m2 y 200 m2, que los dueños tengan un numero de cedula que termine en los
números 1,9,6,3,4,0,2 que el estado civil no sea viudo;
Hacer una emisión de predios urbanos donde los predios se encuentras ubicados en la
parroquia B. Las características del suelo sea de tipo cenagoso, húmedo e inundable,
revestimiento exteriores de tipo cemento, chapeado, enlucidos tierra, grafiado y
madera fina.
ConsultasDescripción
Hacer una emisión de los predios ubicados en las parroquias A. el contribuyente sea
de tipo jurídico; que los predios estén en posición esquinero, interior, en cabecera;
tengan escrituras hechas en las ciudades de la sierra.
Realizar una emisión de los predios rurales, los predios rurales deben cumplir con las
siguientes especificaciones: dominio propietario, arrendatario, posesionario,
traslación de dominio herencia, donación, posesión, drenaje bien drenado, mal
drenado y moderado.
Se desea obtener un listado de los predios urbanos que sus intereses no sean mayor a
1 dólar por título emitido y que se estén ubicados en las parroquias K, E, R, O, P, T, D.
donde el área sea mayor a 50 m2.
SELE
CT
1
2
3
4
5
UP
DA
TE
1
ALGORITMOS UTILIZADOS EN BASES DE DATOS POSTGRES 9.0, SQL SERVER 2008 R2 Y ORACLE 10G
Se desea hacer la eliminación de los títulos emitidos no cancelado por contribuyente
donde la deuda por predios sea menor a 600 dólares americanos, estos predios deben
estar ubicados en sectores con aéreas de riegos como por ejemplo
F,G,H,I,J,K,L,M,N,Ñ,A Y O.Se desea eliminar los predios que cumplen con estas caracteristicas: El frente
principal mayor 8, Fondo relativo se encuentres entre 10 a 190, Localización
esquinero, en cabecera, interior, Escalera de Hormigón simple, ladrillo, hierro, Deuda
mayor a 30 Dólares Americanos.
Eliminar los predios con las siguientes características: Traslación de dominio posesión,
permuta, adjudicación, Uso de suelo agrícola, agro exportación, avícola, bioacuatico,
porcicola y minero, La superficie sea mayor de 5 Hectáreas.
Realizar la eliminación de la deuda de los predios urbanos ubicados en las parroquias
A, B, C, D, E, F, G, H. área de terreno entre 50 a 200 m2. La deuda por predio sea
menor a 2584 dólares.
Se necesita actualizar el 0.3 por ciento de los valores emitidos, un 0.1 por ciento de los
intereses, en los títulos de los predios urbanos ubicados en las parroquias A, K, L, M, I,
J, S. que sean de dominio público y privado,
Se desea actualizara el valor del avaluó comercial de los predios urbanos donde el
dominio sea público, su área de construcción mayor a 20 m2, cubierta de loza
hormigón armado, puertas de aluminio y enrollables, que tenga más de un piso.
Se desea hacer un descuento del 10 por ciento del valor de emisión, si cada predio
adeuda a la municipalidad valores menores a 8000 USD, estos predios deben constar
con características de suelo seco, cenagoso, ocupación edificado.
se necesita aumentar 1 por ciento al de recargo. Que las vías de acceso hacia los
predios sean de primero, segundo y tercer orden; la deuda por predio sea menor de
100; la topografía sea a nivel plana y pendiente leve; drenaje excesivo, moderado y
mal drenado;
Se requiere actualizar el avaluó real de los predios rurales donde el uso del suelo este
destinado para uso agrícola, forestal, minero, bioacuatico, comercial, agro
exportación; La deuda no sea mayor a 200 por predio.
Eliminar los predios urbanos que sus escrituras se hayan hecho en la costa, sierra,
amazonia; tipo de contribuyente jurídico, religioso, gobierno, normal; la deuda por
título emitido sea menor a 20 dólares; las parroquias sean A, B, C, D, E, F;
Mostrar todos los predios que tienen escrituras donde las escrituras fuesen creadas en
la región costa, sierra y en la Amazonía, cuyos predios tenga un área de construcción
mayor 10 m2
Obtener un listado de predios que se encuentren ubicados en las parroquias I, J, K, Z,
M, S, Y, K, F, T, D y E. mostrar nombres de propietarios, que tengan conexión de agua y
que su la deuda de agua sea mayor de 10 Dólares.
Obtener un listado de predios rurales con los nombres de los propietarios, donde
predios ingresados se encuentren entre el grupo de los predios que su deuda este
entre 1 a 20000 dólares, por título emitido.
Obtener un listado de predios urbanos cuyos propietarios tenga agua potable,
mantenga una deuda pendiente por pago de mayor a 20 dólares en predios.
2
75
ANEXO 34 RECURSOS UTILIZADOS POR SENTENCIAS EN POSTGRES 9.0.
Pruebas
Recursos utilizados con 1 millón de datos Recursos utilizados con 5 millones de datos
Sele
ct_
SOP
T
Sele
ct_1
OP
T
Sele
ct_2
OP
T
Up
dat
e_S
OP
T
Up
dat
e_1
OP
T
Up
dat
e_2
OP
T
De
lete
_SO
PT
De
lete
_1O
PT
De
lete
_2O
PT
Inse
rt_S
OP
T
Inse
rt_1
OP
T
Inse
rt_2
OP
T
Sele
ct_
SOP
T
Sele
ct_1
OP
T
Sele
ct_2
OP
T
Up
dat
e_S
OP
T
Up
dat
e_1
OP
T
Up
dat
e_2
OP
T
De
lete
_SO
PT
De
lete
_1O
PT
De
lete
_2O
PT
Inse
rt_S
OP
T
Inse
rt_1
OP
T
Inse
rt_2
OP
T
PRUEBA 1 62 55 65 41 61 57 48 48 75 39 38 41 62 56 66 41 61 57 49 49 76 48 48 75
PRUEBA 2 54 64 98 48 61 62 33 36 84 45 57 42 54 62 66 46 61 64 36 37 85 33 36 84
PRUEBA 3 53 80 52 40 50 47 30 41 36 45 68 62 53 80 69 41 51 48 28 41 36 30 41 62
PRUEBA 4 62 92 87 43 54 56 35 44 40 57 54 51 63 93 87 44 55 57 31 45 40 57 54 51
PRUEBA 5 44 55 77 43 43 96 45 43 84 53 57 76 44 56 77 44 44 97 45 44 85 53 57 76
GRÁFICO 38. RECURSOS UTILIZADOS EN POSTGRES 9.0 POR SENTENCIAS
ANEXO 35 RECURSOS UTILIZADOS POR SENTENCIAS EN SQL SERVER 2008 R2.
Pruebas
Recursos utilizados con 1 millón de datos Recursos utilizados con 5 millones de datos
Sele
ct_
SOP
T
Sele
ct_1
OP
T
Sele
ct_2
OP
T
Up
dat
e_S
OP
T
Up
dat
e_1
OP
T
Up
dat
e_2
OP
T
De
lete
_SO
PT
De
lete
_1O
PT
De
lete
_2O
PT
Inse
rt_S
OP
T
Inse
rt_1
OP
T
Inse
rt_2
OP
T
Sele
ct_
SOP
T
Sele
ct_1
OP
T
Sele
ct_2
OP
T
Up
dat
e_S
OP
T
Up
dat
e_1
OP
T
Up
dat
e_2
OP
T
De
lete
_SO
PT
De
lete
_1O
PT
De
lete
_2O
PT
Inse
rt_S
OP
T
Inse
rt_1
OP
T
Inse
rt_2
OP
T
PRUEBA 1 51 56 92 35 68 66 46 43 89 77 57 65 54 54 93 41 72 73 44 43 90 60 65 64
PRUEBA 2 46 49 119 62 84 61 60 58 142 72 73 154 68 70 119 60 84 80 43 43 124 74 71 150
PRUEBA 3 45 100 122 56 103 91 33 70 78 68 116 89 48 100 124 59 102 99 33 72 76 67 118 85
PRUEBA 4 61 149 142 58 108 124 30 64 62 73 75 66 58 146 58 71 105 120 30 60 60 81 92 80
PRUEBA 5 59 64 150 55 56 198 58 58 127 78 80 131 60 64 153 53 53 195 45 49 116 83 86 114
GRÁFICO 39. RECURSOS UTILIZADOS EN SQL SERVER 2008 R2 POR SENTENCIAS SQL
76
ANEXO 36 RECURSOS UTILIZADOS POR SENTENCIAS EN ORACLE 10G.
Pruebas
Recursos utilizados con 1 millón de datos Recursos utilizados con 5 millones de datos
Sele
ct_
SOP
T
Sele
ct_1
OP
T
Sele
ct_2
OP
T
Up
dat
e_S
OP
T
Up
dat
e_1
OP
T
Up
dat
e_2
OP
T
De
lete
_SO
PT
De
lete
_1O
PT
De
lete
_2O
PT
Inse
rt_S
OP
T
Inse
rt_1
OP
T
Inse
rt_2
OP
T
Sele
ct_
SOP
T
Sele
ct_1
OP
T
Sele
ct_2
OP
T
Up
dat
e_S
OP
T
Up
dat
e_1
OP
T
Up
dat
e_2
OP
T
De
lete
_SO
PT
De
lete
_1O
PT
De
lete
_2O
PT
Inse
rt_S
OP
T
Inse
rt_1
OP
T
Inse
rt_2
OP
T
PRUEBA 1 52 50 63 32 62 60 40 40 79 28 29 27 52 50 63 31 62 60 39 39 77 28 29 27
PRUEBA 2 48 53 94 48 68 68 36 36 102 43 42 76 47 52 92 48 68 67 34 34 100 43 42 76
PRUEBA 3 46 72 74 40 64 59 26 47 48 43 64 50 46 72 74 36 60 57 26 46 47 43 64 50
PRUEBA 4 60 96 93 39 63 71 27 42 42 38 40 35 59 94 92 38 62 69 27 42 41 38 39 35
PRUEBA 5 48 49 87 38 38 116 39 41 101 41 39 68 47 48 86 38 38 116 38 38 98 41 39 68
GRÁFICO 40. RECURSOS UTILIZADOS EN ORACLE 10G POR SENTENCIAS SQL CON 1 MILLÓN DE DATOS.
77
ANEXO 2
14.1.1.1 SCRIPTS PARA PRUEBAS SELECT
14.1.1.1.1 PRUEBA 1 SIN OPTIMIZACIÓN (SENTENCIA SELECT).
Select *
from pur04,
(select pur01pred,trim(substr(pur04escr,2,(position('-' in pur04escr)-3)))canton from pur04 )pur04tmp1,
ciudad,
pur05,
pur01 p1,
pur02 ,
region
where
pur04.pur01pred=pur04tmp1.pur01pred
and pur04tmp1.canton=ciudad.nombre
and pur04.pur01pred=pur05.pur01pred
and pur04.pur01pred=p1.pur01pred
and ciudad.codigo_region=region.codigo_region
and p1.pur01pred=pur02.pur01pred
and ( region.nombre='Sierra'
or region.nombre='Amazonía'
or region.nombre='Amazonía'
)
and p1.pur01pred in
(
select emi01clave
from emi01
where emi01seri in (
select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
group by emi01clave
having sum(emi01vtot)<8000
)
and pur02.pur02ocupa in (
select ren21codi
from ren21 inner join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20desc='Ocupacion'
and ren21desc='NO EDIFICADO'
and ren21acti='S'
)
and pur02.pur02carac in(
select ren21codi
from ren21 inner join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20desc='Caracteristica de Suelo'
and ren21desc in ('CENAGOSO','INUNDABLE','HUMEDO')
) --fin del in
and pur02.pur02topo in(
select ren21codi
from ren21 inner join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20desc='Topografia'
and ren21desc in ('A NIVEL','BAJO NIVEL','HUMEDO','ESCARPADO HACIA ARRIBA')
) --fin del in
and pur02.pur02loca in(
select ren21codi
from ren21 inner join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20desc='Localizacion en la Manzana'
and ren21desc in ('ESQUINERO','INTERMEDIO','EN CABECERA')
) --fin del in
and pur02.pur02forma in(
select ren21codi
from ren21 inner join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20desc='Forma Terreno'
and ren21desc in ('IRREGULAR','MUY IRREGULAR')
) --fin del in
and pur02.pur02alcanta in(
select ren21codi
from ren21 inner join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20desc='Instalaciones Sanitarias'
78
and ren21desc in ('NO TIENE')
) --fin del in
and pur02.pur02aterr>10
and pur05acons>5
and p1.pur01acer='S'
14.1.1.2 PRUEBA 1 PRIMERA OPTIMIZACIÓN (SENTENCIA SELECT).
select pur04.pur01pred,
pur04escr
from pur01 p1
join
pur04 on p1.pur01pred=pur04.pur01pred
join
pur05 on p1.pur01pred=pur05.pur01pred
join
ciudad on substr(pur04.pur04escr,2,(position('-' in pur04.pur04escr)-3))=ciudad.nombre
join
pur02 on p1.pur01pred=pur02.pur01pred
join
region on ciudad.codigo_region=region.codigo_region and (region.nombre='Sierra'
or region.nombre='Amazonía'
or region.nombre='Amazonía' )
where pur02.pur02ocupa in ( select ren21codi
from ren21 inner join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20desc='Ocupacion'
and ren21desc='NO EDIFICADO'
and ren21acti='S'
)
and p1.pur01pred in
(
select emi01clave
from emi01
where emi01seri in (
select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
and emi01clave=p1.pur01pred
group by emi01clave
having sum(emi01vtot)<8000
)
and pur02.pur02carac in( select ren21codi
from ren21 inner join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20desc='Caracteristica de Suelo'
and ren21desc in ('CENAGOSO','INUNDABLE','HUMEDO')
and ren21acti='S'
)
and pur02.pur02topo in (
select ren21codi
from ren21 inner join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20desc='Topografia'
and ren21desc in ('A NIVEL','BAJO NIVEL','HUMEDO','ESCARPADO HACIA ARRIBA')
)
and pur02.pur02loca in (
select ren21codi
from ren21 inner join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20desc='Localizacion en la Manzana'
and ren21desc in ('ESQUINERO','INTERMEDIO','EN CABECERA')
)
and pur02.pur02forma in (
select ren21codi
from ren21 inner join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20desc='Forma Terreno'
and ren21desc in ('IRREGULAR','MUY IRREGULAR')
)
and pur02.pur02alcanta in( select ren21codi
from ren21 inner join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20desc='Instalaciones Sanitarias'
and ren21desc in ('NO TIENE')
)
and p1.pur01acer='S'
and pur05acons>5
and pur02.pur02aterr>10
79
14.1.1.3 PRUEBA 1 SEGUNDA OPTIMIZACIÓN (SENTENCIA SELECT).
select pur04.pur01pred,
pur04escr
from pur01 p1
join
pur04 on p1.pur01pred=pur04.pur01pred
join
pur05 on p1.pur01pred=pur05.pur01pred
join
ciudad on substr(pur04.pur04escr,2,(position('-' in pur04.pur04escr))-3)=ciudad.nombre
join
pur02 on p1.pur01pred=pur02.pur01pred
join
region on ciudad.codigo_region=region.codigo_region and (region.nombre='Sierra'
or region.nombre='Amazonía'
or region.nombre='Amazonía' )
where pur02.pur02ocupa in (select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Ocupacion'
)
and ren21desc='NO EDIFICADO'
and ren21acti='S')
and p1.pur01pred in
(
select emi01clave
from emi01
where emi01seri in (
select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
and emi01.emi01clave=p1.pur01pred
group by emi01clave
having sum(emi01vtot)<8000
)
and pur02.pur02carac in(
(select ren21codi
from ren21
where ren20codi in (select ren20codi
from ren20
where ren20desc='Caracteristica de Suelo'
)
and ren21desc='CENAGOSO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in (select ren20codi
from ren20
where ren20desc='Caracteristica de Suelo'
)
and ren21desc='INUNDABLE'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in (select ren20codi
from ren20
where ren20desc='Caracteristica de Suelo'
)
and ren21desc='HUMEDO'
and ren21acti='S')
) --fin del in
and pur02.pur02topo in (
(select ren21codi
from ren21
where ren20codi in (select ren20codi
from ren20
where ren20desc='Topografia'
)
and ren21desc='A NIVEL'
and ren21acti='S'),
80
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Topografia'
)
and ren21desc='BAJO NIVEL'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Topografia'
)
and ren21desc='ESCARPADO HACIA ARRIBA'
and ren21acti='S')
) --fin de in
and pur02.pur02loca in (
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Localizacion en la Manzana'
)
and ren21desc='ESQUINERO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Localizacion en la Manzana'
)
and ren21desc='INTERMEDIO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Localizacion en la Manzana'
)
and ren21desc='EN CABECERA'
and ren21acti='S')
)
and pur02.pur02forma in (
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Forma Terreno'
)
and ren21desc='IRREGULAR'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Forma Terreno'
)
and ren21desc='MUY IRREGULAR'
and ren21acti='S')
)
and pur02.pur02alcanta in( select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Instalaciones Sanitarias'
)
and ren21desc='NO TIENE'
and ren21acti='S'
)
and p1.pur01acer='S'
and pur05acons>5
and pur02.pur02aterr>10
81
14.1.1.4 PRUEBA 2 SIN OPTIMIZACIÓN (SENTENCIA SELECT).
select *
from pur01 p1,
pur06,
gen01,
cat01,
cat04,
pur05,
pur02
where
p1.pur01pred=pur06.pur01pred
and pur06.gen01codi=gen01.gen01codi
and p1.cat01codi=cat01.cat01codi
and cat01.cat04codi=cat04.cat04codi
and p1.pur01pred=pur02.pur01pred
and p1.pur01pred=pur05.pur01pred
and pur06.pur06prin='S'
and
( cat04.cat04desc like '%Parroquia :A%'
or cat04.cat04desc like '%Parroquia :K%'
or cat04.cat04desc like '%Parroquia :F%'
or cat04.cat04desc like '%Parroquia :Y%'
or cat04.cat04desc like '%Parroquia :T%'
or cat04.cat04desc like '%Parroquia :D%'
or cat04.cat04desc like '%Parroquia :E%'
or cat04.cat04desc like '%Parroquia :I%'
or cat04.cat04desc like '%Parroquia :J%'
or cat04.cat04desc like '%Parroquia :K%'
or cat04.cat04desc like '%Parroquia :Z%'
or cat04.cat04desc like '%Parroquia :M%'
or cat04.cat04desc like '%Parroquia :S%'
)
and pur05.pur05estpare in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Paredes'
and ren20.emi03codi in (select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('BLOQUE','TAPIAL','MADERA FINA','HORMIGON ARMADO')
and ren21acti='S'
)
and pur05.pur05escalera in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Escalera'
and ren20.emi03codi in (select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('CAÑA','HORMIGON CICLOPEO','HIERRO','MADERA COMUN')
and ren21acti='S'
)
and pur05.pur05acapisos in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Revestimiento de Pisos'
and ren20.emi03codi in (select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
82
and emi03pred='S'
)
and ren21desc
in('ARENA-CEMENTO (CEMENTO ALISADO)','ENLUCIDOS
TIERRA','MARMOLINA','VINYL')
and ren21acti='S'
)
and pur02aterr>5
and p1.pur01pred in (
select emi01clave
from emi01,renagua
where emi01.emi01clave=renagua.pur01pred
group by emi01clave
having sum(emi01vtot)>10
)
and p1.pur01pred in (
select emi01clave
from emi01
where emi01vtot>2.1
)
14.1.1.5 PRUEBA 2 PRIMER OPTIMIZACIÓN (SENTENCIA SELECT).
select gen01.gen01codi,
p1.pur01pred,
gen01.gen01com,
cat01.cat01nom barrio,
cat04.cat04desc sectores
from pur01 p1
inner join
pur05 on pur05.pur01pred=p1.pur01pred
inner join
pur06 on pur06.pur01pred=p1.pur01pred and pur06.pur06prin='S'
inner join
pur02 on pur02.pur01pred=p1.pur01pred
inner join
gen01 on gen01.gen01codi=pur06.gen01codi
inner join
cat01 on cat01.cat01codi=p1.cat01codi
inner join
cat04 on cat04.cat04codi=cat01.cat04codi
where
( cat04.cat04desc = 'Parroquia :A'
or cat04.cat04desc ='Parroquia :K'
or cat04.cat04desc ='Parroquia :F'
or cat04.cat04desc ='Parroquia :Y'
or cat04.cat04desc ='Parroquia :T'
or cat04.cat04desc ='Parroquia :D'
or cat04.cat04desc ='Parroquia :E'
or cat04.cat04desc ='Parroquia :I'
or cat04.cat04desc ='Parroquia :J'
or cat04.cat04desc ='Parroquia :K'
or cat04.cat04desc ='Parroquia :Z'
or cat04.cat04desc ='Parroquia :M'
or cat04.cat04desc ='Parroquia :S'
)
and pur05.pur05estpare in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Paredes'
and ren20.emi03codi in (select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('BLOQUE','TAPIAL','MADERA FINA','HORMIGON ARMADO')
and ren21acti='S'
)
and pur05.pur05escalera in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Escalera'
and ren20.emi03codi in (select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
83
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('CAÑA','HORMIGON CICLOPEO','HIERRO','MADERA COMUN')
and ren21acti='S'
)
and pur05.pur05acapisos in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Revestimiento de Pisos'
and ren20.emi03codi in (select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc
in('ARENA-CEMENTO (CEMENTO ALISADO)','ENLUCIDOS
TIERRA','MARMOLINA','VINYL')
and ren21acti='S'
)
and pur02aterr>5
and p1.pur01pred in (
select emi01clave
from emi01,renagua
where emi01.emi01clave=renagua.pur01pred
and emi01seri in (select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
group by emi01clave
having sum(emi01vtot)>10
)
and p1.pur01pred in (
select emi01clave
from emi01
where emi01seri in (select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and emi01vtot>2.1
)
14.1.1.6 PRUEBA 2 SEGUNDA OPTIMIZACIÓN (SENTENCIA SELECT).
select gen01.gen01codi,
p1.pur01pred,
gen01.gen01com,
cat01.cat01nom barrio,
cat04.cat04desc sectores
from pur01 p1
inner join
pur05 on pur05.pur01pred=p1.pur01pred
inner join
pur06 on pur06.pur01pred=p1.pur01pred and pur06.pur06prin='S'
inner join
pur02 on pur02.pur01pred=p1.pur01pred
inner join
gen01 on gen01.gen01codi=pur06.gen01codi
inner join
84
cat01 on cat01.cat01codi=p1.cat01codi
inner join
cat04 on cat04.cat04codi=cat01.cat04codi
where substr(cat04desc,12,1) in ('A','K','F','Y','T','D','E','I','J','K','Z','M','S')
and pur05.pur05estpare in (
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Paredes'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='BLOQUE'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Paredes'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='TAPIAL'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Paredes'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='MADERA FINA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Paredes'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='HORMIGON ARMADO'
and ren21acti='S')
85
)
and pur05.pur05escalera in (
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Escalera'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='CAÑA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Escalera'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='HORMIGON CICLOPEO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in (select ren20codi
from ren20
where ren20desc='Escalera'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='HIERRO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Escalera'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='MADERA COMUN'
and ren21acti='S')
)
and pur05.pur05acapisos in (
86
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Revestimiento de Pisos'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='ARENA-CEMENTO (CEMENTO ALISADO)'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Revestimiento de Pisos'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='ENLUCIDOS TIERRA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Revestimiento de Pisos'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='MARMOLINA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Revestimiento de Pisos'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='VINYL'
and ren21acti='S')
)
and pur02aterr>5
and p1.pur01pred in (
87
select emi01clave
from emi01,renagua
where emi01.emi01clave=renagua.pur01pred
and emi01seri in (select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and p1.pur01pred=emi01clave
group by emi01clave
having sum(emi01vtot)>10
)
and p1.pur01pred in (
select emi01clave
from emi01
where emi01seri in (select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and emi01vtot>2.1
)
14.1.1.7 PRUEBA 3 SIN OPTIMIZACIÓN (SENTENCIA SELECT).
select *
from pru01 p1,
pru10,
gen01,
(select pru01cla,trim(substr(pur04escr,2,(position('-' in pur04escr)-3)))canton from pru50 )pru50tmp1,
ciudad,
pru20,
pru05
where p1.pru01cla=pru10.pru01cla
and pru10.gen01codi=gen01.gen01codi
and pru50tmp1.pru01cla=p1.pru01cla
and ciudad.nombre=pru50tmp1.canton
and p1.pru01cla=pru20.pru01cla
and p1.pru01cla=pru05.pru01cla
and ciudad.codigo_ciudad in (select ciudad.codigo_ciudad
from ciudad,region
where ciudad.codigo_region=region.codigo_region
and ( region.nombre='Sierra'
or region.nombre='Costa'
or region.nombre='Amazonía'
)
)
and p1.pru01cla in (select emi01clave
from emi01
where emi01vtot between 1 and 20000
)
and p1.pru01codd in(
select ren21codi
from ren21 inner join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20desc='Vias'
and ren20.emi03codi in (select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in ('FLUVIAL','LINEA FÉRREA','PRIMER ORDEN','HERRADURA')
and ren21acti='S'
)
88
and pru20supe>10
and fpru01aagua='S'
and pur05acons>20
and fpru01riego in(
select ren21codi
from ren21 inner join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20desc='Drenaje'
and ren20.emi03codi in (select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in ('BIEN DRENADO','EXCESIVO','MODERADO')
and ren21acti='S'
)
and p1.pru01coda in(
select ren21codi
from ren21 inner join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20desc='Dominio'
and ren20.emi03codi in (select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in ('ARRENDATARIO' ,'COMUNAS JURIDICAS','POSESIONARIO')
and ren21acti='S'
)
14.1.1.8 PRUEBA 3 PRIMERA OPTIMIZACIÓN (SENTENCIA SELECT).
select p1.pru01cla,
gen01.gen01codi,
gen01.gen01com
from pru01 p1
inner join
pru10 on p1.pru01cla=pru10.pru01cla
inner join
gen01 gen01 on pru10.gen01codi=gen01.gen01codi
inner join
pru50 pru50 on pru50.pru01cla=p1.pru01cla
inner join
ciudad on ciudad.nombre=substr(pur04escr,2,(position('-' in pur04escr)-3))
inner join
pru20 on p1.pru01cla=pru20.pru01cla
inner join
pru05 on p1.pru01cla=pru05.pru01cla
where p1.pru01cla in ( select emi01clave
from emi01
where emi01vtot between 1 and 20000
)
and ciudad.codigo_ciudad in (select ciudad.codigo_ciudad
from ciudad,region
where ciudad.codigo_region=region.codigo_region
and ( region.nombre='Sierra'
or region.nombre='Costa'
or region.nombre='Amazonía'
)
)
and p1.pru01codd in(
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Vias'
and ren20.emi03codi in ( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
89
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='FLUVIAL'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Vias'
and ren20.emi03codi in ( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='LINEA FÉRREA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Vias'
and ren20.emi03codi in ( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='PRIMER ORDEN'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Vias'
and ren20.emi03codi in ( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='HERRADURA'
and ren21acti='S')
)
and pru20supe>10
and fpru01aagua='S'
and fpru01riego in(
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Drenaje'
and ren20.emi03codi in ( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
90
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='BIEN DRENADO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Drenaje'
and ren20.emi03codi in ( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='EXCESIVO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Drenaje'
and ren20.emi03codi in ( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='MODERADO'
and ren21acti='S')
)
and pur05acons>20
and p1.pru01coda in(
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Dominio'
and ren20.emi03codi in ( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='ARRENDATARIO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Dominio'
and ren20.emi03codi in ( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
91
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='COMUNAS JURIDICAS'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Dominio'
and ren20.emi03codi in ( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='POSESIONARIO'
and ren21acti='S')
)
14.1.1.9 PRUEBA 3 SEGUNDA OPTIMIZACIÓN (SENTENCIA SELECT).
select p1.pru01cla,
gen01.gen01codi,
gen01.gen01com
from pru01 p1
inner join
pru10 on p1.pru01cla=pru10.pru01cla
inner join
gen01 on pru10.gen01codi=gen01.gen01codi
inner join
(select pru01cla,trim(substr(pur04escr,2,(position('-' in pur04escr)-3)))canton from pru50)pru50tmp1
on pru50tmp1.pru01cla=p1.pru01cla
inner join
ciudad on ciudad.nombre=pru50tmp1.canton
inner join
pru20 on p1.pru01cla=pru20.pru01cla
inner join
pru05 on pru05.pru01cla=p1.pru01cla
where p1.pru01cla in ( select emi01clave
from emi01
where emi01clave=p1.pru01cla
and emi01seri=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
and emi01vtot between 1 and 20000
)
and ciudad.codigo_ciudad in (select ciudad.codigo_ciudad
from ciudad,region
where ciudad.codigo_region=region.codigo_region
and ( region.nombre='Sierra'
or region.nombre='Costa'
or region.nombre='Amazonía'
)
)
and p1.pru01codd in(
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Vias'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='FLUVIAL'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
92
from ren20
where ren20desc='Vias'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='LINEA FÉRREA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Vias'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='PRIMER ORDEN'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Vias'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='HERRADURA'
and ren21acti='S')
)
and pru20supe>10
and fpru01aagua='S'
and fpru01riego in(
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Drenaje'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='BIEN DRENADO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Drenaje'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='EXCESIVO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Drenaje'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='MODERADO'
and ren21acti='S')
)
and pur05acons>20
and p1.pru01coda in(
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
93
where ren20desc='Dominio'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='ARRENDATARIO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Dominio'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='COMUNAS JURIDICAS'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Dominio'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='POSESIONARIO'
and ren21acti='S')
)
14.1.1.10 PRUEBA 4 SIN OPTIMIZACIÓN (SENTENCIA SELECT).
select *
from pur01 p1,
pur05,
pur06 g1
where p1.pur01pred=pur05.pur01pred
and g1.pur01pred=p1.pur01pred
and g1.pur06prin='S'
and pur05estructura in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Estructura Edificacion'
and ren20.emi03codi in (
select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('SOPORTANTE')
and ren21acti='S'
)
and pur05estadocons in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Estados de Conservación'
and ren20.emi03codi in (
select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('REPARACION','OBSOLETO')
and ren21acti='S'
)
and pur05estpare in (
select ren21codi
94
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Paredes'
and ren20.emi03codi in (
select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('CAÑA','TAPIAL','MADERA FINA')
and ren21acti='S'
)
and pur05.pur05estepiso in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Entrepisos'
and ren20.emi03codi in (
select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('MADERA COMUN','LOSA HORM. ARMADO')
and ren21acti='S'
)
and p1.pur01pred in (
select emi01clave
from emi01
where p1.pur01pred=emi01.emi01clave
group by emi01clave
having sum(emi01vtot)>20
)
and g1.gen01codi in (
select pru10.gen01codi
from pru01 pr, pru10
where pru10.pru01cla=pr.pru01cla
and pru10.pru10prin='S'
and pr.pru01coda in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Dominio'
and ren20.emi03codi in (
select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc
in('PROPIETARIO','ARRENDATARIO','PUBLICO',
'POSESIONARIO')
and ren21acti='S'
)
and pr.fpru01riego in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Drenaje'
and ren20.emi03codi in (
select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('MODERADO','EXCESIVO','MAL DRENADO')
95
and ren21acti='S'
)
)
14.1.1.11 PRUEBA 4 PRIMER OPTIMIZACIÓN (SENTENCIA SELECT).
select
*
from pur01 p1,
pur05,
pur06 g1
where p1.pur01pred=pur05.pur01pred
and p1.pur01pred=g1.pur01pred
and g1.pur06prin='S'
and pur05estructura in (
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Estructura Edificacion'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='SOPORTANTE'
and ren21acti='S')
)
and pur05estadocons in (
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='REPARACION'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='OBSOLETO'
and ren21acti='S')
)
and pur05estpare in (
(select ren21codi
96
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Paredes'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='CAÑA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Paredes'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='TAPIAL'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Paredes'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='MADERA FINA'
and ren21acti='S')
)
and pur05.pur05estepiso in (
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Entrepisos'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='MADERA COMUN'
and ren21acti='S'),
(select ren21codi
97
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Entrepisos'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='LOSA HORM. ARMADO'
and ren21acti='S')
)
and p1.pur01pred in (
select emi01clave
from emi01
where p1.pur01pred=emi01.emi01clave
and emi01seri in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
group by emi01clave
having sum(emi01vtot)>20
)
and g1.gen01codi in (
select pru10.gen01codi
from pru01 pr
inner join
pru10 on pru10.pru01cla=pr.pru01cla and pru10.pru10prin='S'
and pr.pru01coda in (
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Dominio'
and ren20.emi03codi=
(select emi03codi
from emi03
where
emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='PROPIETARIO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Dominio'
and ren20.emi03codi=
(select emi03codi
from emi03
where
emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
98
)
)
and ren21desc='ARRENDATARIO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Dominio'
and ren20.emi03codi=
(select emi03codi
from emi03
where
emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='PUBLICO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Dominio'
and ren20.emi03codi=
(select emi03codi
from emi03
where
emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='POSESIONARIO'
and ren21acti='S')
)
and pr.fpru01riego in (
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Drenaje'
and ren20.emi03codi=
(select emi03codi
from emi03
where
emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='MODERADO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Drenaje'
and ren20.emi03codi=
(select emi03codi
from emi03
where
emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
99
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='EXCESIVO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Drenaje'
and ren20.emi03codi=
(select emi03codi
from emi03
where
emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='MAL DRENADO'
and ren21acti='S')
)
)
14.1.1.12 PRUEBA 4 SEGUNDA OPTIMIZACIÓN (SENTENCIA SELECT).
select p1.pur01pred,
p1.pur01dir
from pur01 p1
inner join
pur05 on p1.pur01pred=pur05.pur01pred
inner join
pur06 g1 on g1.pur01pred=p1.pur01pred and g1.pur06prin='S'
where pur05estructura in (
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Estructura Edificacion'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='SOPORTANTE'
and ren21acti='S')
)
and pur05estadocons in (
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='REPARACION'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and ren20.emi03codi in
(select emi03codi
from emi03
100
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='OBSOLETO'
and ren21acti='S')
)
and pur05estpare in (
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Paredes'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='CAÑA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Paredes'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='TAPIAL'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Paredes'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='MADERA FINA'
and ren21acti='S')
)
and pur05.pur05estepiso in (
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Entrepisos'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='MADERA COMUN'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Entrepisos'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='LOSA HORM. ARMADO'
and ren21acti='S')
)
and p1.pur01pred in (
select emi01clave
from emi01
where p1.pur01pred=emi01.emi01clave
group by emi01clave
having sum(emi01vtot)>20
101
)
and g1.gen01codi in (
select pru10.gen01codi
from pru01 pr
inner join
pru10 on pru10.pru01cla=pr.pru01cla and pru10.pru10prin='S'
where pr.pru01coda in (
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Dominio'
and ren20.emi03codi=
(select emi03codi
from emi03
where emi03des in
('IMPUESTO PREDIAL RUSTICO')
)
)
and ren21desc='PROPIETARIO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Dominio'
and ren20.emi03codi=
(select emi03codi
from emi03
where emi03des in
('IMPUESTO PREDIAL RUSTICO')
)
) )
and ren21desc='ARRENDATARIO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Dominio'
and ren20.emi03codi=
(select emi03codi
from emi03
where emi03des in
('IMPUESTO PREDIAL RUSTICO')
)
)
and ren21desc='PUBLICO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Dominio'
and ren20.emi03codi=
(select emi03codi
from emi03
where emi03des in
('IMPUESTO PREDIAL RUSTICO')
)
)
and ren21desc='POSESIONARIO'
and ren21acti='S')
)
and pr.fpru01riego in (
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Drenaje'
and ren20.emi03codi=
(select emi03codi
from emi03
where emi03des in
('IMPUESTO PREDIAL RUSTICO')
)
)
and ren21desc='MODERADO'
and ren21acti='S'),
(select ren21codi
102
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Drenaje'
and ren20.emi03codi=
(select emi03codi
from emi03
where emi03des in
('IMPUESTO PREDIAL RUSTICO')
)
)
and ren21desc='EXCESIVO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in (
select ren20codi
from ren20
where ren20desc='Drenaje'
and ren20.emi03codi=
(select emi03codi
from emi03
where emi03des in
('IMPUESTO PREDIAL RUSTICO')
)
)
and ren21desc='MAL DRENADO'
and ren21acti='S')
)
)
14.1.1.13 PRUEBA 5 SIN OPTIMIZACIÓN (SENTENCIA SELECT).
select *
from pur01 p1,
pur06,
pur02,
pur05,
gen01 g1,
gen02
where p1.pur01pred=pur06.pur01pred
and pur06.pur06prin='S'
and pur02.pur01pred=p1.pur01pred
and pur06.gen01codi=g1.gen01codi
and g1.gen02codi=gen02.gen02codi
and p1.pur01pred=pur05.pur01pred
and gen02.gen02desc in ('JURIDICO','GOBIERNO','NORMAL','MUNICIPAL')
and p1.cat01codi in (
select c1.cat01codi
from cat01 c1
where p1.cat01codi=c1.cat01codi
and c1.cat04codi in(
select cat04codi
from cat04
where c1.cat04codi=cat04.cat04codi
and (
substr(cat04desc,12,1) like 'A'
or substr(cat04desc,12,1) like 'B'
or substr(cat04desc,12,1) like 'C'
or substr(cat04desc,12,1) like 'D'
or substr(cat04desc,12,1) like 'E'
or substr(cat04desc,12,1) like 'F'
or substr(cat04desc,12,1) like 'G'
or substr(cat04desc,12,1) like 'H'
or substr(cat04desc,12,1) like 'I'
)
)
)
and pur02aterr>100
and pur02loca in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Localizacion en la Manzana'
and ren21desc in('EN CABECERA','INTERIOR','ESQUINERO','INTERMEDIO')
and ren21acti='S'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
103
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and pur02topo in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Topografia'
and ren21desc in('ACCIDENTADO','ESCARPADO HACIA ARRIBA','ESCARPADO HACIA ABAJO')
and ren21acti='S'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and pur05.pur05estpare in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Paredes'
and ren21desc in('BLOQUE','CAÑA','MADERA FINA')
and ren21acti='S'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and pur05.pur05estadocons in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Estados de Conservación'
and ren21desc in('ESTABLE','OBSOLETO','A REPARAR')
and ren21acti='S'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and p1.pur01pred in(
select renagua.pur01pred
from renagua
where renagua.pur01pred=p1.pur01pred
)
and p1.pur01pred in (
select emi01clave
from emi01
where emi01.emi01clave=p1.pur01pred
and not emi01inte>1
)
104
14.1.1.14 PRUEBA 5 PRIMERA OPTIMIZACIÓN (SENTENCIA SELECT).
select p1.pur01pred,
g1.gen01nom
from pur01 p1
inner join
pur06 on p1.pur01pred=pur06.pur01pred and pur06.pur06prin='S'
inner join
gen01 g1 on g1.gen01codi=pur06.gen01codi
inner join
gen02 on gen02.gen02codi=g1.gen02codi
inner join
pur02 on pur02.pur01pred=p1.pur01pred
inner join
pur05 on pur05.pur01pred=p1.pur01pred
inner join
cat01 on p1.cat01codi=cat01.cat01codi
inner join
cat04 on cat01.cat04codi=cat04.cat04codi
where
gen02.gen02desc in ('JURIDICO','GOBIERNO','NORMAL','MUNICIPAL')
and cat01.cat04codi in(
select cat04codi
from cat04
where (
substr(cat04desc,12,1) like 'A'
or substr(cat04desc,12,1) like 'B'
or substr(cat04desc,12,1) like 'C'
or substr(cat04desc,12,1) like 'D'
or substr(cat04desc,12,1) like 'E'
or substr(cat04desc,12,1) like 'F'
or substr(cat04desc,12,1) like 'G'
or substr(cat04desc,12,1) like 'H'
or substr(cat04desc,12,1) like 'I'
)
)
and pur02aterr>100
and pur02loca in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Localizacion en la Manzana'
and ren21desc in('EN CABECERA','INTERIOR','ESQUINERO','INTERMEDIO')
and ren21acti='S'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and pur02topo in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Topografia'
and ren21desc in('ACCIDENTADO','ESCARPADO HACIA ARRIBA','ESCARPADO HACIA ABAJO')
and ren21acti='S'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and pur05.pur05estpare in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Paredes'
and ren21desc in('BLOQUE','CAÑA','MADERA FINA')
and ren21acti='S'
and emi03codi=( select emi03codi
from emi03
105
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and pur05.pur05estadocons in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Estados de Conservación'
and ren21desc in('ESTABLE','OBSOLETO','A REPARAR')
and ren21acti='S'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and p1.pur01pred in(
select renagua.pur01pred
from renagua
where renagua.pur01pred=p1.pur01pred
)
and p1.pur01pred in (
select emi01clave
from emi01
where emi01.emi01clave=p1.pur01pred
and not emi01inte>1
)
14.1.1.15 PRUEBA 5 SEGUNDA OPTIMIZACIÓN (SENTENCIA SELECT).
select p1.pur01pred,
g1.gen01nom
from pur01 p1
inner join
pur06 on p1.pur01pred=pur06.pur01pred and pur06.pur06prin='S'
inner join
gen01 g1 on g1.gen01codi=pur06.gen01codi
inner join
gen02 on gen02.gen02codi=g1.gen02codi
inner join
pur02 on pur02.pur01pred=p1.pur01pred
inner join
pur05 on pur05.pur01pred=p1.pur01pred
inner join
cat01 on p1.cat01codi=cat01.cat01codi
inner join
cat04 on cat01.cat04codi=cat04.cat04codi
where
gen02.gen02desc in ('JURIDICO','GOBIERNO','NORMAL','MUNICIPAL')
and substr(cat04desc,12,1) in( 'A','B','C','D','E','F','G','H','I')
and pur02aterr>100
and pur02loca in(
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Localizacion en la Manzana'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
106
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='EN CABECERA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Localizacion en la Manzana'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='INTERIOR'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Localizacion en la Manzana'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='ESQUINERO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Localizacion en la Manzana'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='INTERMEDIO'
and ren21acti='S')
)
and pur02topo in(
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Topografia'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
107
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='ACCIDENTADO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Topografia'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='ESCARPADO HACIA ARRIBA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Topografia'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='ESCARPADO HACIA ABAJO'
and ren21acti='S')
)
and pur05.pur05estpare in(
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Paredes'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='BLOQUE'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Paredes'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
108
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='CAÑA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Paredes'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='MADERA FINA'
and ren21acti='S')
)
and pur05.pur05estadocons in(
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='ESTABLE'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='OBSOLETO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
109
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='A REPARAR'
and ren21acti='S')
)
and p1.pur01pred in(
select renagua.pur01pred
from renagua
where renagua.pur01pred=p1.pur01pred
)
and p1.pur01pred in (
select emi01clave
from emi01
where emi01.emi01clave=p1.pur01pred
and not emi01inte>1
)
ANEXO 3
14.1.1.16 SCRIPTS PARA PRUEBAS UPDATE.
14.1.1.17 PRUEBA 1 SIN OPTIMIZACIÓN (SENTENCIA UPDATE).
update emi01 emision
set emi01vtot= emi01vtot+((emi01vtot*0.03)/100)
where emi01clave in
(select p1.pur01pred
from pur01 p1,cat01,cat04,pur02
where p1.cat01codi=cat01.cat01codi
and cat04.cat04codi=cat01.cat04codi
and p1.pur01pred=pur02.pur01pred
and
(substr(cat04desc,12,1) like 'A'
or substr(cat04desc,12,1) like 'B'
or substr(cat04desc,12,1) like 'C'
or substr(cat04desc,12,1) like 'D'
or substr(cat04desc,12,1) like 'E'
or substr(cat04desc,12,1) like 'F'
or substr(cat04desc,12,1) like 'G'
)
and p1.pur01pred in
(select pur01pred
from pur06 p6, gen01,gen02
where pur06prin='S'
and p6.gen01codi=gen01.gen01codi
and gen02.gen02codi=gen01.gen02codi
and gen02.gen02desc in ('GOBIERNO','JURIDICO','MUNICIPAL')
)
and pur02.pur02loca in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Localizacion en la Manzana'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('MANZANERO','EN PASAJE','INTERMEDIO','EN CABECERA')
and ren21acti='S'
)
and p1.pur01coda in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Dominio'
and ren20.emi03codi in (
select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
110
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('PUBLICO','PRIVADO')
and ren21acti='S'
)
)
14.1.1.18 PRUEBA 1 PRIMERA OPTIMIZACIÓN (SENTENCIA UPDATE).
update emi01 emision
set emi01vtot= emi01vtot+((emi01vtot*0.03)/100)
where emi01seri in(
select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
and emi01clave in (
select p1.pur01pred
from pur01 p1
inner join
cat01 on cat01.cat01codi=p1.cat01codi
inner join
cat04 on cat04.cat04codi=cat01.cat04codi
inner join
pur02 on p1.pur01pred=pur02.pur01pred
inner join
pur06 on pur06.pur01pred=p1.pur01pred and pur06prin='S'
where substr(cat04desc,12,1)in ( 'A','B','C','D','E','F','G')
and p1.pur01pred in
(select pur01pred
from pur06 p6
where pur06prin='S'
and p6.gen01codi in
(select gen01codi
from gen01 g1
where gen02codi in (
select gen02codi
from gen02
where gen02.gen02desc in
('GOBIERNO','JURIDICO','MUNICIPAL')
)
)
)
and p1.pur01coda in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Dominio'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='PUBLICO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Dominio'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
and ren21desc='PRIVADO'
and ren21acti='S')
)
)
and pur02.pur02loca in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
111
from ren20
where ren20desc='Localizacion en la Manzana'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='MANZANERO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Localizacion en la Manzana'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='INTERMEDIO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Localizacion en la Manzana'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='EN CABECERA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Localizacion en la Manzana'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='EN PASAJE'
and ren21acti='S')
)
)
14.1.1.19 PRUEBA 1 SEGUNDA OPTIMIZACIÓN (SENTENCIA UPDATE).
update emi01 emision
set emi01vtot= emi01vtot+((emi01vtot*0.03)/100)
where emi01seri in(
select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
and emi01clave in
(select p1.pur01pred
from pur01 p1
inner join
cat01 on cat01.cat01codi=p1.cat01codi
inner join
cat04 on cat04.cat04codi=cat01.cat04codi
inner join
pur02 on p1.pur01pred=pur02.pur01pred
where
(substr(cat04desc,12,1)= 'A'
or substr(cat04desc,12,1) ='B'
or substr(cat04desc,12,1) ='C'
or substr(cat04desc,12,1) ='D'
or substr(cat04desc,12,1) ='E'
112
or substr(cat04desc,12,1) ='F'
or substr(cat04desc,12,1) ='G'
)
and p1.pur01pred in
(select pur01pred
from pur06 p6, gen01,gen02
where pur06prin='S'
and p6.gen01codi=gen01.gen01codi
and gen02.gen02codi=gen01.gen02codi
and gen02.gen02desc in ('GOBIERNO','JURIDICO','MUNICIPAL')
)
and p1.pur01coda in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Dominio'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='PUBLICO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Dominio'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
and ren21desc='PRIVADO'
and ren21acti='S')
)
)
and pur02.pur02loca in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Localizacion en la Manzana'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='MANZANERO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Localizacion en la Manzana'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='INTERMEDIO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Localizacion en la Manzana'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='EN CABECERA'
and ren21acti='S'),
(select ren21codi
from ren21
113
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Localizacion en la Manzana'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='EN PASAJE'
and ren21acti='S')
)
)
14.1.1.20 PRUEBA 2 SIN OPTIMIZACIÓN (SENTENCIA UPDATE).
update pur05 p5
set pur05areal=( select p1.pur01vm2*p2.pur02aterr
from pur01 p1,pur02 p2
where p1.pur01pred=p5.pur01pred
and p1.pur01pred=p2.pur01pred
)
where p5.pur01pred in
(select p1.pur01pred
from pur01 p1,pur05 p5
where p5.pur01pred=p1.pur01pred
and p1.pur01coda in
(select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Dominio'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('PUBLICO')
and ren21acti='S'
)
and p5.pur05estcubier in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Cubierta Estructura'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('LOSA HOMIGON ARMADO')
and ren21acti='S'
)
and p5.pur05acapuer in
(select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Puertas'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('ALUMINIO','ENRROLLABLE')
and ren21acti='S')
and p5.pur05estadocons in
114
(select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Estados de Conservación'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('REPARACION','OBSOLETO','A REPARAR')
and ren21acti='S')
and p1.pur01pred in
(select emi01clave
from emi01
where emi01clave=p1.pur01pred
group by emi01clave
having sum(emi01vtot)>20
)
and exists
(
select *
from emi01,renagua
where emi01.emi01clave=p1.pur01pred
and emi01.emi01clave=renagua.pur01pred
)
and p1.pur01pred in(
select pur02.pur01pred
from pur02
where pur02.pur01pred=p1.pur01pred
and pur02aterr>20
)
and p5.pur05npiso>1
)
14.1.1.21 PRUEBA 2 PRIMERA OPTIMIZACIÓN (SENTENCIA UPDATE).
update pur05 p5
set pur05areal=( select p1.pur01vm2*p2.pur02aterr
from pur01 p1,pur02 p2
where p1.pur01pred=p5.pur01pred
and p1.pur01pred=p2.pur01pred
)
where p5.pur01pred in
(
select p1.pur01pred
from pur01 p1
inner join
pur05 p5 on p5.pur01pred=p1.pur01pred
inner join
pur02 p2 on p2.pur01pred=p1.pur01pred
where p1.pur01coda in(
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Dominio'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='PUBLICO'
and ren21acti='S')
)
and p5.pur05estcubier in(
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Cubierta Estructura'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
115
)
)
and ren21desc='LOSA HOMIGON ARMADO'
and ren21acti='S')
)
and p5.pur05acapuer in(
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Puertas'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='ALUMINIO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Puertas'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='ENRROLLABLE'
and ren21acti='S')
)
and p5.pur05estadocons in(
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='REPARACION'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='OBSOLETO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='A REPARAR'
and ren21acti='S')
)
And p1.pur01pred in
(select emi01clave
from emi01
where emi01seri in
(select emi03codi
116
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
and emi01.emi01clave=p1.pur01pred
group by emi01clave
having sum(emi01vtot)>20
)
and exists
(
select renagua.pur01pred
from renagua
where p1.pur01pred=renagua.pur01pred
)
and p1.pur01pred in(
select pur02.pur01pred
from pur02
where pur02.pur01pred=p1.pur01pred
and pur02aterr>20
)
and p5.pur05npiso>1
)
14.1.1.22 PRUEBA 2 SEGUNDA OPTIMIZACIÓN (SENTENCIA UPDATE).
update pur05 p5
set pur05areal=( select p1.pur01vm2*p2.pur02aterr
from pur01 p1,pur02 p2
where p1.pur01pred=p5.pur01pred
and p1.pur01pred=p2.pur01pred
)
where p5.pur01pred in
(select p1.pur01pred
from pur01 p1
inner join
pur05 p5 on p5.pur01pred=p1.pur01pred
inner join
pur02 p2 on p2.pur01pred=p1.pur01pred
inner join
emi01 on emi01.emi01clave=p1.pur01pred
where p1.pur01coda in(
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Dominio'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='PUBLICO'
and ren21acti='S')
)
and p5.pur05estcubier in(
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Cubierta Estructura'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='LOSA HOMIGON ARMADO'
and ren21acti='S')
)
and p5.pur05acapuer in
(
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Puertas'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
117
)
)
and ren21desc='ALUMINIO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Puertas'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='ENRROLLABLE'
and ren21acti='S')
)
and p5.pur05estadocons in(
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
and ren21desc='REPARACION'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='OBSOLETO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='A REPARAR'
and ren21acti='S')
)
and exists
(
select renagua.pur01pred
from renagua
where p1.pur01pred=renagua.pur01pred
)
and pur02aterr>20
and p5.pur05npiso>1
group by p1.pur01pred
having sum(emi01vtot)>20
)
118
14.1.1.23 PRUEBA 3 SIN OPTIMIZACIÓN (SENTENCIA UPDATE).
update emi01 emision
set emi01vtot=emi01vtot-((emi01vtot*10)/100)
where emi01seri in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
and emi01clave in
(
select p1.pur01pred
from pur01 p1,pur02,pur05
where p1.pur01pred=pur02.pur01pred
and p1.pur01pred=pur05.pur01pred
and pur02.pur02carac in
(select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Caracteristica de Suelo'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('SECO','CENAGOSO')
and ren21acti='S'
)
and pur02.pur02ocupa in
(select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Ocupacion'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('EDIFICADO')
and ren21acti='S'
)
and pur05.pur05estadocons in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Estados de Conservación'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('OBSOLETO','A REPARAR','REPARACION')
and ren21acti='S'
)
and pur05.pur05estepiso in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Entrepisos'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
119
)
and ren21desc in('CAÑA','MADERA FINA')
and ren21acti='S'
)
and exists(
select emi01clave,sum(e1.emi01vtot)
from emi01 e1
where e1.emi01clave=p1.pur01pred
group by emi01clave
having sum(e1.emi01vtot)<15000
)
)
14.1.1.24 PRUEBA 3 PRIMER OPTIMIZACIÓN (SENTENCIA UPDATE).
update emi01 emision
set emi01vtot=emi01vtot-((emi01vtot*10)/100)
where emi01seri in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
and emi01clave in
(
select p1.pur01pred
from pur01 p1
inner join
pur02 on pur02.pur01pred=p1.pur01pred
inner join
pur05 on pur05.pur01pred=p1.pur01pred
where pur02.pur02carac in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Caracteristica de Suelo'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='SECO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Caracteristica de Suelo'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='CENAGOSO'
and ren21acti='S')
)
and pur02.pur02ocupa in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
120
where ren20desc='Ocupacion'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='EDIFICADO'
and ren21acti='S')
)
and pur05.pur05estadocons in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='OBSOLETO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='A REPARAR'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='REPARACION'
and ren21acti='S')
)
and pur05.pur05estepiso in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
121
from ren20
where ren20desc='Entrepisos'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='CAÑA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Entrepisos'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='MADERA FINA'
and ren21acti='S')
)
and exists(
select emi01clave,sum(e1.emi01vtot)
from emi01 e1
where e1.emi01clave=p1.pur01pred
group by emi01clave
having sum(e1.emi01vtot)<15000
)
)
14.1.1.25 PRUEBA 3 SEGUNDA OPTIMIZACIÓN (SENTENCIA UPDATE).
update emi01 emision
set emi01vtot=emi01vtot-((emi01vtot*10)/100)
where
emi01clave in
(
select p1.pur01pred
from pur01 p1
inner join
pur02 on pur02.pur01pred=p1.pur01pred
inner join
pur05 on pur05.pur01pred=p1.pur01pred
where
pur02.pur02carac in
(
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Caracteristica de Suelo'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='SECO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
122
where ren20desc='Caracteristica de Suelo'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='CENAGOSO'
and ren21acti='S')
)
and pur02.pur02ocupa in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Ocupacion'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='EDIFICADO'
and ren21acti='S')
)
and pur05.pur05estadocons in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='OBSOLETO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='A REPARAR'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='REPARACION'
and ren21acti='S')
)
and pur05.pur05estepiso in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Entrepisos'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='CAÑA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
123
where ren20desc='Entrepisos'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='MADERA FINA'
and ren21acti='S')
)
and exists(
select emi01clave,sum(e1.emi01vtot)
from emi01 e1
where e1.emi01clave=p1.pur01pred
group by emi01clave
having sum(e1.emi01vtot)<15000
)
)
14.1.1.26 PRUEBA 4 SIN OPTIMIZACIÓN (SENTENCIA UPDATE).
update emi01 emision
set emi01reca=emi01reca+((emi01reca*1)/100)
where emi01seri in (select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and emi01clave in (
select p1.pru01cla
from pru01 p1,pru20,pru05
where p1.pru01cla=pru20.pru01cla
and p1.pru01cla=pru05.pru01cla
and p1.pru01codd in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Vias'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('PRIMER ORDEN','SEGUNDO ORDEN','TERCER ORDEN')
and ren21acti='S'
)
and p1.pru01topo in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Topografía'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('A NIVEL PLANA','PENDIENTE LEVE')
and ren21acti='S'
)
and p1.fpru01riego in
(select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Drenaje'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
124
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('MAL DRENADO','EXCESIVO','MODERADO')
and ren21acti='S'
)
and pur05estadocons in
(
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Estados de Conservación'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('ESTABLE','OBSOLETO','A REPARAR')
and ren21acti='S'
)
and p1.pru01cla in ( select emi01clave
from emi01 e1
where e1.emi01clave=p1.pru01cla
group by emi01clave
having sum(e1.emi01vtot)<100
)
and pru20supe>50
)
14.1.1.27 PRUEBA 4 PRIMER OPTIMIZACIÓN (SENTENCIA UPDATE).
update emi01 emision
set emi01reca=emi01vtot+((emi01vtot*1)/100)
where emi01clave in (
select p1.pru01cla
from pru01 p1
inner join
pru20 on p1.pru01cla=pru20.pru01cla
inner join
pru05 on p1.pru01cla=pru05.pru01cla
where
p1.pru01codd in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Vias'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='PRIMER ORDEN'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Vias'
and emi03codi=
(select emi03codi
125
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='SEGUNDO ORDEN'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Vias'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='TERCER ORDEN'
and ren21acti='S')
)
and p1.pru01topo in
(
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Topografía'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='A NIVEL PLANA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Topografía'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='PENDIENTE LEVE'
and ren21acti='S')
)
and p1.fpru01riego in
(
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
126
from ren20
where ren20desc='Drenaje'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='EXCESIVO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Drenaje'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='MODERADO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Drenaje'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='MAL DRENADO'
and ren21acti='S')
)
and pru20supe>50
and pur05estadocons in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Estados de Conservación'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('ESTABLE','OBSOLETO','A REPARAR')
and ren21acti='S'
)
and p1.pru01cla in (
select emi01clave
from emi01 e1
where e1.emi01clave=p1.pru01cla
and emi01seri in
(select emi03codi
127
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
group by emi01clave
having sum(e1.emi01vtot)<100
)
)
14.1.1.28 PRUEBA 4 SEGUNDA OPTIMIZACIÓN (SENTENCIA UPDATE).
update emi01 emision
set emi01reca=emi01vtot+((emi01vtot*1)/100)
where emi01clave in (
select p1.pru01cla
from pru01 p1
inner join
pru20 on p1.pru01cla=pru20.pru01cla
inner join
pru05 on p1.pru01cla=pru05.pru01cla
where
p1.pru01codd in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Vias'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='PRIMER ORDEN'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Vias'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='SEGUNDO ORDEN'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Vias'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='TERCER ORDEN'
and ren21acti='S')
)
and p1.pru01topo in
(
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Topografía'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='A NIVEL PLANA'
and ren21acti='S'),
(select ren21codi
128
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Topografía'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='PENDIENTE LEVE'
and ren21acti='S')
)
and p1.fpru01riego in
(
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Drenaje'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='EXCESIVO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Drenaje'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='MODERADO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Drenaje'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='MAL DRENADO'
and ren21acti='S')
)
and pur05estadocons in
(
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='ESTABLE'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
129
)
and ren21desc='OBSOLETO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='A REPARAR'
and ren21acti='S')
)
and p1.pru01cla in ( select emi01clave
from emi01 e1
where e1.emi01clave=p1.pru01cla
group by emi01clave
having sum(e1.emi01vtot)<100
)
and pru20supe>50
)
14.1.1.29 PRUEBA 5 SIN OPTIMIZACIÓN (SENTENCIA UPDATE).
update pru20 p20
set pru20avaluo= p20.pru20supe*p20.pur01vm2
where p20.pru01cla in
(
select p1.pru01cla
from pru01 p1,
pru20,
pru30,
pru05
where p1.pru01cla=pru20.pru01cla
and pru30.pru30codi=pru20.pru30codi
and p1.pru01cla=pru05.pru01cla
and ( pru30desc like 'AGRICOLA'
or pru30desc like 'FORESTAL'
or pru30desc like 'MINERO'
or pru30desc like 'BIOACUATICO'
or pru30desc like 'COMERCIO'
or pru30desc like 'AGROEXPORTACION'
)
and p1.pru01cla in (
select emi01clave
from emi01
where emi01.emi01clave=p1.pru01cla
group by emi01clave
having not sum(emi01vtot)>200
)
and p1.pru01codd in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Vias'
and emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('HERRADURA','LINEA FÉRREA','FLUVIAL','PRIMER ORDEN','SEGUNDO ORDEN')
and ren21acti='S'
)
and p1.pru01coda in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Dominio'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
130
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('POSESIONARIO','ARRENDATARIO','USUSFRUCTUARIO','COMUNAS JURIDICAS')
and ren21acti='S'
)
and pru05.pur05estcolu in
(select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Columnas y Pilastras'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('ADOBE','LADRILLO','PIEDRA','MADERA COMUN','TAPIAL')
and ren21acti='S'
)
and pru05.pur05revesca in
(select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Revestimientos Escaleras'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('MADERA FINA','MARMOL','CAÑA','BALDOSA CERAMICA','CHAMPIADO')
and ren21acti='S'
)
)
14.1.1.30 PRUEBA 5 PRIMER OPTIMIZACIÓN (SENTENCIA UPDATE).
update pru20 p20
set pru20avaluo= pru20supe*pur01vm2
where p20.pru01cla in
(
select p1.pru01cla
from pru01 p1
inner join
pru20 on p1.pru01cla=pru20.pru01cla
inner join
pru30 on pru30.pru30codi=pru20.pru30codi
inner join
pru05 on p1.pru01cla=pru05.pru01cla
where
( pru30desc ='AGRICOLA'
or pru30desc ='FORESTAL'
or pru30desc ='MINERO'
or pru30desc ='BIOACUATICO'
or pru30desc ='COMERCIO'
or pru30desc ='AGROEXPORTACION'
)
and p1.pru01cla in
(select emi01clave
from emi01
where emi01.emi01clave=p1.pru01cla
group by emi01clave
having not sum(emi01vtot)>200
)
and p1.pru01codd in
(
131
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Vias'
and emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('HERRADURA','LINEA FÉRREA','FLUVIAL','PRIMER ORDEN','SEGUNDO ORDEN')
and ren21acti='S'
)
and p1.pru01coda in
(select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Dominio'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('POSESIONARIO','ARRENDATARIO','USUSFRUCTUARIO','COMUNAS JURIDICAS')
and ren21acti='S'
)
and pru05.pur05estcolu in
(select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Columnas y Pilastras'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('ADOBE','LADRILLO','PIEDRA','MADERA COMUN','TAPIAL')
and ren21acti='S'
)
and pru05.pur05revesca in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Revestimientos Escaleras'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('MADERA FINA','MARMOL','CAÑA','BALDOSA CERAMICA','CHAMPIADO')
and ren21acti='S'
)
)
14.1.1.31 PRUEBA 5 SEGUNDA OPTIMIZACIÓN (SENTENCIA UPDATE).
update pru20 p20
set pru20avaluo= pru20supe*pur01vm2
where p20.pru01cla in
(
Select p1.pru01cla
from pru01 p1
inner join
132
pru20 on p1.pru01cla=pru20.pru01cla
inner join
pru30 on pru30.pru30codi=pru20.pru30codi
inner join
pru05 on p1.pru01cla=pru05.pru01cla
where ( pru30desc ='AGRICOLA'
or pru30desc ='FORESTAL'
or pru30desc ='MINERO'
or pru30desc ='BIOACUATICO'
or pru30desc ='COMERCIO'
or pru30desc ='AGROEXPORTACION'
)
and p1.pru01cla in (
select emi01clave
from emi01
where emi01.emi01clave=p1.pru01cla
group by emi01clave
having not sum(emi01vtot)>200
)
and p1.pru01codd in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Vias'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='HERRADURA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Vias'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='LINEA FÉRREA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Vias'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='FLUVIAL'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Vias'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='PRIMER ORDEN'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Vias'
and emi03codi=
133
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='SEGUNDO ORDEN'
and ren21acti='S')
)
and p1.pru01coda in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Dominio'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='POSESIONARIO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Dominio'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='ARRENDATARIO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Dominio'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='USUSFRUCTUARIO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Dominio'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='COMUNAS JURIDICAS'
and ren21acti='S')
)
and pru05.pur05estcolu in
(
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Columnas y Pilastras'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='ADOBE'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
134
(select ren20codi
from ren20
where ren20desc='Columnas y Pilastras'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='LADRILLO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Columnas y Pilastras'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='PIEDRA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Columnas y Pilastras'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='MADERA COMUN'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Columnas y Pilastras'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='TAPIAL'
and ren21acti='S')
)
and pru05.pur05revesca in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Revestimientos Escaleras'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='MADERA FINA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Revestimientos Escaleras'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='MARMOL'
and ren21acti='S'),
(select ren21codi
from ren21
135
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Revestimientos Escaleras'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='CAÑA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Revestimientos Escaleras'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='BALDOSA CERAMICA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Revestimientos Escaleras'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='CHAMPIADO'
and ren21acti='S')
)
)
ANEXO 4
14.1.2 SCRIPTS PARA LA SENTENCIA DELETE.
14.1.2.1 PRUEBA 1 SIN OPTIMIZACIÓN (SENTENCIA DELETE).
delete
from pur01 pu1
where pur01pred in (
select p1.pur01pred
from pur01 p1,
pur04,
ciudad,
region,
pur06,
gen01,
gen02,
pur02,
pur05
where p1.pur01pred=pur04.pur01pred
and pur06.pur01pred=p1.pur01pred
and pur06.pur06prin='S'
and (substr(pur04escr,2,(position('-' in pur04escr)-3)))=ciudad.nombre
and gen01.gen01codi=pur06.gen01codi
and gen01.gen02codi=gen02.gen02codi
and p1.pur01pred=pur02.pur01pred
and p1.pur01pred=pur05.pur01pred
and ciudad.codigo_region=region.codigo_region
and ( region.nombre ='Costa'
or region.nombre ='Sierra'
or region.nombre ='Amazonía'
)
and p1.pur01pred in (
select emi01clave
from emi01
where emi01clave=p1.pur01pred
and emi01vtot<2
136
)
and p1.cat01codi in (
select cat01codi
from cat01
where ( substr(cat01nom,9,1) like 'A'
or substr(cat01nom,9,1) like 'B'
or substr(cat01nom,9,1) like 'C'
or substr(cat01nom,9,1) like 'D'
or substr(cat01nom,9,1) like 'E'
or substr(cat01nom,9,1) like 'F'
)
)
and pur02.pur02carac in
(select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Caracteristica de Suelo'
and ren21desc in('CENAGOSO','HUMEDO','INUNDABLE')
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21acti='S'
)
and pur02.pur02aterr>20
and pur05acons>10
and pur05acapisos in
(select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Revestimiento de Pisos'
and ren21desc in('TABLON GRESS','MADERA COMUN','CAÑA','MADERA FINA','MARMOLINA')
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21acti='S'
)
and ( gen02.gen02desc like 'JURIDICO'
or gen02.gen02desc like 'RELIGIOSO'
or gen02.gen02desc like 'GOBIERNO'
or gen02.gen02desc like 'NORMAL'
)
)
14.1.2.2 PRUEBA 1 PRIMERA OPTIMIZACIÓN (SENTENCIA DELETE).
delete
from pur01 p1
where pur01pred in (
select p1.pur01pred
from pur01 p1
inner join
pur04 on p1.pur01pred=pur04.pur01pred
inner join
ciudad on (substr(pur04escr,2,(position('-' in pur04escr)-3)))=ciudad.nombre
inner join
region on ciudad.codigo_region=region.codigo_region
inner join
pur06 on pur06.pur01pred=p1.pur01pred and pur06.pur06prin='S'
inner join
gen01 on gen01.gen01codi=pur06.gen01codi
inner join
gen02 on gen01.gen02codi=gen02.gen02codi
inner join
pur02 on pur02.pur01pred=p1.pur01pred
inner join
137
pur05 on pur05.pur01pred=p1.pur01pred
where
( region.nombre ='Costa'
or region.nombre ='Sierra'
or region.nombre ='Amazonía'
)
and p1.pur01pred in (
select emi01clave
from emi01
where emi01clave=p1.pur01pred
and emi01vtot<2
)
and p1.cat01codi in (
select cat01codi
from cat01
where ( substr(cat01nom,9,1) = 'A'
or substr(cat01nom,9,1) ='B'
or substr(cat01nom,9,1) ='C'
or substr(cat01nom,9,1) ='D'
or substr(cat01nom,9,1) ='E'
or substr(cat01nom,9,1) ='F'
)
)
and pur02.pur02carac in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Caracteristica de Suelo'
and ren21desc in('CENAGOSO','HUMEDO','INUNDABLE')
and ren20.emi03codi in (
select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21acti='S'
)
and pur02.pur02aterr>20
and pur05acons>10
and pur05acapisos in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Revestimiento de Pisos'
and ren21desc in('TABLON GRESS','MADERA COMUN','CAÑA','MADERA FINA','MARMOLINA')
and ren20.emi03codi in (
select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21acti='S'
)
and ( gen02.gen02desc ='JURIDICO'
or gen02.gen02desc ='RELIGIOSO'
or gen02.gen02desc ='GOBIERNO'
or gen02.gen02desc ='NORMAL'
)
)
14.1.2.3 PRUEBA 1 SEGUNDA OPTIMIZACIÓN (SENTENCIA DELETE).
delete
from pur01 p1
where pur01pred in (
select p1.pur01pred
from pur01 p1
inner join
pur04 on p1.pur01pred=pur04.pur01pred
inner join
138
ciudad on (substr(pur04escr,2,(position('-' in pur04escr)-3)))=ciudad.nombre
inner join
region on ciudad.codigo_region=region.codigo_region
inner join
pur06 on pur06.pur01pred=p1.pur01pred and pur06.pur06prin='S'
inner join
gen01 on gen01.gen01codi=pur06.gen01codi
inner join
gen02 on gen01.gen02codi=gen02.gen02codi
inner join
pur02 on pur02.pur01pred=p1.pur01pred
inner join
pur05 on pur05.pur01pred=p1.pur01pred
where
( region.nombre ='Costa'
or region.nombre ='Sierra'
or region.nombre ='Amazonía'
)
and p1.pur01pred in (
select emi01clave
from emi01
where emi01clave=p1.pur01pred
and emi01vtot<2
)
and p1.cat01codi in (
select cat01codi
from cat01
where ( substr(cat01nom,9,1) ='A'
or substr(cat01nom,9,1) ='B'
or substr(cat01nom,9,1) ='C'
or substr(cat01nom,9,1) ='D'
or substr(cat01nom,9,1) ='E'
or substr(cat01nom,9,1) ='F'
)
)
and pur02.pur02carac in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Caracteristica de Suelo'
and ren20.emi03codi in(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='CENAGOSO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Caracteristica de Suelo'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='HUMEDO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Caracteristica de Suelo'
139
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='INUNDABLE'
and ren21acti='S')
)
and pur02.pur02aterr>20
and pur05acons>10
and pur05acapisos in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Revestimiento de Pisos'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='TABLON GRESS'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Revestimiento de Pisos'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='MADERA COMUN'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Revestimiento de Pisos'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='CAÑA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Revestimiento de Pisos'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='MADERA FINA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Revestimiento de Pisos'
and ren20.emi03codi in
(select emi03codi
140
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='MARMOLINA'
and ren21acti='S')
)
and (gen02.gen02desc ='JURIDICO'
or gen02.gen02desc ='RELIGIOSO'
or gen02.gen02desc ='GOBIERNO'
or gen02.gen02desc ='NORMAL'
)
)
14.1.2.4 PRUEBA 2 SIN OPTIMIZACIÓN (SENTENCIA DELETE).
delete
from emi01
where emi01clave in
(
select p1.pur01pred
from pur01 p1,
pur02,
pur05,
cat01
where p1.pur01pred=pur02.pur01pred
and p1.pur01pred=pur05.pur01pred
andp1.cat01codi=cat01.cat01codi
and (substr(cat01nom,9,1) like 'F'
or substr(cat01nom,9,1) like 'G'
or substr(cat01nom,9,1) like 'H'
or substr(cat01nom,9,1) like 'I'
or substr(cat01nom,9,1) like 'J'
or substr(cat01nom,9,1) like 'K'
or substr(cat01nom,9,1) like 'L'
or substr(cat01nom,9,1) like 'M'
or substr(cat01nom,9,1) like 'N'
or substr(cat01nom,9,1) like 'Ñ'
or substr(cat01nom,9,1) like 'O'
or substr(cat01nom,9,1) like 'A'
)
and p1.pur01pred in (
select emi01clave
from emi01
where emi01clave=p1.pur01pred
group by emi01clave
having sum(emi01vtot)<600
)
and pur02.pur02locain (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Localizacion en la Manzana'
and ren21desc in('INTERMEDIO','EN CABECERA','INTERIOR','EN PASAJE','MANZANERO')
and ren20.emi03codi in( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21acti='S'
)
and pur02.pur02carac in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Caracteristica de Suelo'
and ren21desc in('INUNDABLE','CENAGOSO','HUMEDO')
and ren20.emi03codi in( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
141
and emi03pred='S'
)
and ren21acti='S'
)
and pur05.pur05estadocons in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Estados de Conservación'
and ren21desc in('REPARACION','A REPARAR','OBSOLETO')
and ren20.emi03codi in( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21acti='S'
)
)
14.1.2.5 PRUEBA 2 PRIMER OPTIMIZACIÓN (SENTENCIA DELETE).
delete
from emi01 e
where emi01clave in
(
select p1.pur01pred
from pur01 p1,a
pur02,
pur05,
cat01
where p1.pur01pred=pur02.pur01pred
and p1.pur01pred=pur05.pur01pred
andp1.cat01codi=cat01.cat01codi
and (substr(cat01nom,9,1) like 'F'
or substr(cat01nom,9,1) like 'G'
or substr(cat01nom,9,1) like 'H'
or substr(cat01nom,9,1) like 'I'
or substr(cat01nom,9,1) like 'J'
or substr(cat01nom,9,1) like 'K'
or substr(cat01nom,9,1) like 'L'
or substr(cat01nom,9,1) like 'M'
or substr(cat01nom,9,1) like 'N'
or substr(cat01nom,9,1) like 'Ñ'
or substr(cat01nom,9,1) like 'O'
or substr(cat01nom,9,1) like 'A'
)
and p1.pur01pred in (
select emi01clave
from emi01
where emi01clave=p1.pur01pred
group by emi01clave
having sum(emi01vtot)<600
)
and pur02.pur02loca in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Localizacion en la Manzana'
and ren21desc in('INTERMEDIO','EN CABECERA','INTERIOR','EN PASAJE','MANZANERO')
and ren20.emi03codi in( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21acti='S'
)
and pur02.pur02carac in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Caracteristica de Suelo'
and ren21desc in('INUNDABLE','CENAGOSO','HUMEDO','EN
PASAJE','MANZANERO')
142
and ren20.emi03codi in( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21acti='S'
)
and pur05.pur05estadocons in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Estados de Conservación'
and ren21desc in('INUNDABLE','REPARACION','A REPARAR','OBSOLETO')
and ren20.emi03codi in( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21acti='S'
)
)
14.1.2.6 PRUEBA 2 SEGUNDA OPTIMIZACIÓN (SENTENCIA DELETE).
delete
from emi01 e
where emi01clave in
(
select p1.pur01pred
from pur01 p1
inner join
pur02 on p1.pur01pred=pur02.pur01pred
inner join
pur05 on p1.pur01pred=pur05.pur01pred
inner join
cat01 on p1.cat01codi=cat01.cat01codi
where
( substr(cat01nom,9,1) ='F'
or substr(cat01nom,9,1) ='G'
or substr(cat01nom,9,1) ='H'
or substr(cat01nom,9,1) ='I'
or substr(cat01nom,9,1) ='J'
or substr(cat01nom,9,1) ='K'
or substr(cat01nom,9,1) ='L'
or substr(cat01nom,9,1) ='M'
or substr(cat01nom,9,1) ='N'
or substr(cat01nom,9,1) ='Ñ'
or substr(cat01nom,9,1) ='O'
or substr(cat01nom,9,1) ='A'
)
and p1.pur01pred in (
select emi01clave
from emi01
where emi01clave=p1.pur01pred
group by emi01clave
having sum(emi01vtot)<600
)
and pur02.pur02loca in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Localizacion en la Manzana'
and ren20.emi03codi in( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
143
and ren21desc='INTERMEDIO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Localizacion en la Manzana'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='EN CABECERA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Localizacion en la Manzana'
and ren20.emi03codi in(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='INTERIOR'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Localizacion en la Manzana'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='EN PASAJE'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Localizacion en la Manzana'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='MANZANERO'
and ren21acti='S')
)
and pur02.pur02carac in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Caracteristica de Suelo'
and ren20.emi03codi in( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='INUNDABLE'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Caracteristica de Suelo'
and ren20.emi03codi in
(select emi03codi
144
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='CENAGOSO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Caracteristica de Suelo'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='HUMEDO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Caracteristica de Suelo'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='EN PASAJE'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Caracteristica de Suelo'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='MANZANERO'
and ren21acti='S')
)
and pur05.pur05estadocons in(
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='INUNDABLE'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='REPARACION'
and ren21acti='S'),
(select ren21codi
from ren21
145
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='A REPARAR'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Estados de Conservación'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='OBSOLETO'
and ren21acti='S')
)
)
14.1.2.7 PRUEBA 3 SIN OPTIMIZACIÓN (SENTENCIA DELETE).
delete
from pur01
where pur01pred in
(
select p1.pur01pred
from pur01 p1,
pur02,
pur05
where
p1.pur01pred=pur02.pur01pred
and p1.pur01pred=pur05.pur01pred
and date_part('year', pur01fcre::abstime)>=1996
and p1.pur01pred in
(select emi01clave
from emi01
group by emi01clave
having sum(emi01vtot)>30
)
and pur02long>8
and pur02fondrela between 10 and 190
and pur02.pur02loca in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Localizacion en la Manzana'
and ren21desc in('ESQUINERO','EN CABECERA','INTERIOR')
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21acti='S'
)
and pur05.pur05escalera in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Escalera'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
146
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('HORMIGON SIMPLE','LADRILLO','HIERRO')
and ren21acti='S'
)
)
14.1.2.8 PRUEBA 3 PRIMER OPTIMIZACIÓN (SENTENCIA DELETE).
delete
from pur01
where pur01pred in
(
select p1.pur01pred
from pur01 p1,
pur02,
pur05
where
p1.pur01pred=pur02.pur01pred
and p1.pur01pred=pur05.pur01pred
and date_part('year', pur01fcre::abstime)>=1996
and p1.pur01pred in ( select emi01clave
from emi01
group b01clave
having sum(emi01vtot)>30
)
and pur02long>8
and pur02fondrela between 10 and 190
and pur02.pur02loca in (
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Localizacion en la Manzana'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc='ESQUINERO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Localizacion en la Manzana'
emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='EN CABECERA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Localizacion en la Manzana'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
147
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='INTERIOR'
and ren21acti='S')
)
andpur05.pur05escalera in (
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Escalera'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='HORMIGON SIMPLE'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Escalera'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='LADRILLO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Escalera'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='HIERRO'
and ren21acti='S')
)
)
14.1.2.9 PRUEBA 3 SEGUNDA OPTIMIZACIÓN (SENTENCIA DELETE).
delete
from pur01
where pur01pred in
(
select p1.pur01pred
from pur01 p1,
pur02,
pur05
where
p1.pur01pred=pur02.pur01pred
and p1.pur01pred=pur05.pur01pred
and datepart(year, pur01fcre)>=1996
148
and p1.pur01pred in
(select emi01clave
from emi01
where emi01seri =
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and emi01clave=p1.pur01pred
group by emi01clave
having sum(emi01vtot)>30
)
and pur02long>8
and pur02fondrela between 10 and 190
and pur02.pur02loca in (
(select ren21codi
from ren21
where ren20codi in (select ren20codi
from ren20
where ren20desc='Localizacion en la Manzana'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='ESQUINERO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Localizacion en la Manzana'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='EN CABECERA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Localizacion en la Manzana'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='INTERIOR'
and ren21acti='S')
)
and pur05.pur05escalera in (
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
149
from ren20
where ren20desc='Escalera'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='HORMIGON SIMPLE'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Escalera'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='LADRILLO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Escalera'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='HIERRO'
and ren21acti='S')
)
)
14.1.2.10 PRUEBA 4 SIN OPTIMIZACIÓN (SENTENCIA DELETE).
delete
from pru01
where pru01clave in
(
select pru01.pru01cla
from pru01,
(select pru01cla,trim(substr(pur04escr,2,(position('-' in pur04escr)-3)))canton from pru50)cantones,
ciudad,
pru20,
pru30
where pru01.pru01cla=cantones.pru01cla
and cantones.canton=ciudad.nombre
and pru01.pru01cla=pru20.pru01cla
and pru20.pru30codi=pru30.pru30codi
and ciudad.codigo_region in
(
select codigo_region
from region
where nombre ='Costa'
or nombre ='Sierra'
or nombre ='Galápagos'
)
and date_part('year', pru01fing::abstime)>=1985
and pru01.pru01cla in
150
(select emi01clave
from emi01
group by emi01clave
having sum(emi01vtot)>30
)
and pru20.pru20supe>5
and pru30.pru30desc in
('AGRICOLA','AGROEXPORTACION','AVICOLA','BIOACUATICO','PORCICOLA','MINERO')
and pru01.pru01codb in
(
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Traslacion de Dominio'
and ren21desc in('POSESIÓN','PERMUTA','ADJUDICACIÓN')
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21acti='S'
)
)
14.1.2.11 PRUEBA 4 PRIMERA OPTIMIZACIÓN (SENTENCIA DELETE).
delete
from pru01
where pru01clave in
(
select p1.pru01cla
from pru01 p1
inner join
pru20 on p1.pru01cla=pru20.pru01cla
inner join
pru50 on p1.pru01cla=pru50.pru01cla
inner join
pru30 on pru20.pru30codi=pru30.pru30codi
inner join
ciudad on substr(pru50.pur04escr,2,(position('-' in pru50.pur04escr)-3))=ciudad.nombre
inner join
region on ciudad.codigo_region=region.codigo_region
and( region.nombre ='Costa'
or region.nombre ='Sierra'
or region.nombre ='Galápagos'
)
where date_part('year', pru01fing::abstime)>=1985
and p1.pru01cla in
(select emi01clave
from emi01
where emi01seri =
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
group by emi01clave
having sum(emi01vtot)>30
)
and pru20.pru20supe>5
and p1.pru01cla in
(
select pru01cla
from pru20
where pru30codi in
(select pru30codi
from pru30
where pru30desc='AGRICOLA'
151
or pru30desc='AGROEXPORTACION'
or pru30desc='AVICOLA'
or pru30desc='BIOACUATICO'
or pru30desc='PORCICOLA'
or pru30desc='MINERO'
)
)
and p1.pru01codb in
(
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Traslacion de Dominio'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='POSESIÓN'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Traslacion de Dominio'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='PERMUTA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Traslacion de Dominio'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='ADJUDICACIÓN'
and ren21acti='S')
)
)
14.1.2.12 PRUEBA 4 SEGUNDA OPTIMIZACIÓN (SENTENCIA DELETE).
delete
from pru01
where pru01clave in
(
select p1.pru01cla
152
from pru01 p1
inner join
pru20 on p1.pru01cla=pru20.pru01cla
inner join
pru50 on p1.pru01cla=pru50.pru01cla
inner join
pru30 on pru20.pru30codi=pru30.pru30codi
inner join
ciudad on substr(pru50.pur04escr,2,(position('-' in pru50.pur04escr)-3))=ciudad.nombre
inner join
region on ciudad.codigo_region=region.codigo_region
and( region.nombre ='Costa'
or region.nombre ='Sierra'
or region.nombre ='Galápagos'
)
where date_part('year', pru01fing::abstime)>=1985
and p1.pru01cla in
(select emi01clave
from emi01
where emi01seri =
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
and emi01.emi01clave=p1.pru01cla
group by emi01clave
having sum(emi01vtot)>30
)
and pru20.pru20supe>5
and p1.pru01cla in
(
select pru01cla
from pru20
where pru30codi in
(select pru30codi
from pru30
where pru30desc='AGRICOLA'
or pru30desc='AGROEXPORTACION'
or pru30desc='AVICOLA'
or pru30desc='BIOACUATICO'
or pru30desc='PORCICOLA'
or pru30desc='MINERO'
)
)
and p1.pru01codb in
(
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Traslacion de Dominio'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='POSESIÓN'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Traslacion de Dominio'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='PERMUTA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Traslacion de Dominio'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
153
and ren21desc='ADJUDICACIÓN'
and ren21acti='S')
)
)
14.1.2.13 PRUEBA 5 SIN OPTIMIZACIÓN (SENTENCIA DELETE).
delete
from emi01 e
where emi01clave in
(
select p1.pur01pred
from pur01 p1,
pur05,
cat01,
cat04,
pur02
where pur05.pur01pred=p1.pur01pred
and cat01.cat01codi=p1.cat01codi
and cat04.cat04codi=cat01.cat04codi
and p1.pur01pred=pur02.pur01pred
and ( substr(cat04desc,12,1) like 'A'
or substr(cat04desc,12,1) like 'B'
or substr(cat04desc,12,1) like 'C'
or substr(cat04desc,12,1) like 'D'
or substr(cat04desc,12,1) like 'E'
or substr(cat04desc,12,1) like 'F'
or substr(cat04desc,12,1) like 'G'
or substr(cat04desc,12,1) like 'H'
)
and pur05.pur05estpare in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Paredes'
and ren21desc in('BLOQUE','TAPIAL','MADERA FINA','HORMIGON ARMADO')
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21acti='S'
)
and pur05.pur05escalera in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Escalera'
and ren21desc in('CAÑA','HORMIGON CICLOPEO','HIERRO','MADERA COMUN')
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21acti='S'
)
and pur05.pur05acapisos in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Revestimiento de Pisos'
and ren21desc in
('ARENA-CEMENTO (CEMENTO ALISADO)','ENLUCIDOS
TIERRA','MARMOLINA','VINYL')
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
154
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21acti='S'
)
and pur02aterr between 50 and 200
and p1.pur01pred in (
select emi01clave
from emi01
group by emi01clave
having sum(emi01vtot)<2584
)
)
14.1.2.14 PRUEBA 5 PRIMER OPTIMIZACIÓN (SENTENCIA DELETE).
delete
from emi01 e
where emi01clave in(
select p1.pur01pred
from pur01 p1
inner join
pur05 on pur05.pur01pred=p1.pur01pred
inner join
cat01 on cat01.cat01codi=p1.cat01codi
inner join
cat04 on cat04.cat04codi=cat01.cat04codi
inner join
pur02 on pur02.pur01pred=p1.pur01pred
where substr(cat04desc,12,1) in ('A','B','C','D','E','F','G','H')
and pur05.pur05estpare in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Paredes'
and ren21desc in('BLOQUE','TAPIAL','MADERA FINA','HORMIGON ARMADO')
and ren20.emi03codi in
(emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21acti='S'
)
and pur05.pur05escalera in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Escalera'
and ren21desc in('CAÑA','HORMIGON CICLOPEO','HIERRO','MADERA COMUN')
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21acti='S'
)
and pur05.pur05acapisos in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Revestimiento de Pisos'
and ren21desc in('ARENA-CEMENTO (CEMENTO ALISADO)',
'ENLUCIDOS TIERRA','MARMOLINA','VINYL')
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
155
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21acti='S'
)
and pur02aterr between 50 and 200
and p1.pur01pred in
(select emi01clave
from emi01
where emi01.emi01clave=p1.pur01pred
and emi01seri in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
group by emi01clave
having sum(emi01vtot)<2584
)
)
14.1.2.15 PRUEBA 5 SEGUNDA OPTIMIZACIÓN (SENTENCIA DELETE).
delete
from emi01 e
where emi01clave in(
select p1.pur01pred
from pur01 p1
inner join
pur05 on pur05.pur01pred=p1.pur01pred
inner join
cat01 on cat01.cat01codi=p1.cat01codi
inner join
cat04 on cat04.cat04codi=cat01.cat04codi
inner join
pur02 on pur02.pur01pred=p1.pur01pred
where substr(cat04desc,12,1) in ('A','B','C','D','E','F','G','H')
and pur05.pur05estpare in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Paredes'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='BLOQUE'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Paredes'
and ren20.emi03codi in
(select emi03codi
from emi03
whereemi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='TAPIAL'
156
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Paredes'
and ren20.emi03codi in(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='MADERA FINA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Paredes'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='HORMIGON ARMADO'
and ren21acti='S')
)
and pur05.pur05escalera in
(
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Escalera'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='CAÑA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Escalera'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
157
)
)
and ren21desc='HORMIGON CICLOPEO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Escalera'
and ren20.emi03codi in(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='HIERRO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Escalera'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='MADERA COMUN'
and ren21acti='S')
)
and pur05.pur05acapisos in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Revestimiento de Pisos'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='ARENA-CEMENTO (CEMENTO ALISADO)'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Revestimiento de Pisos'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
158
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='ENLUCIDOS TIERRA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Revestimiento de Pisos'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='MARMOLINA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Revestimiento de Pisos'
and ren20.emi03codi in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='VINYL'
and ren21acti='S')
)
and pur02aterr between 50 and 200
and p1.pur01pred in
(
select emi01clave
from emi01
where emi01.emi01clave=p1.pur01pred
and emi01seri in
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
group by emi01clave
having sum(emi01vtot)<2584
)
)
159
ANEXO 5
14.2 PRUEBAS PARA LA SENTENCIA INSERT.
14.2.1.1 PRUEBA 1 SIN OPTIMIZACIÓN (SENTENCIA INSERT).
INSERT INTO emi01(
emi01codi, gen01codi, emi01seri, emi01clave, emi01anio, emi01mes,
emi01dia, emi01fobl,emi01femi, emi01vtot,emi01inte,emi01desc,
emi01reca, emi01exo, emi01esta, emi01titu,emi01fcre, emi01lcre)
select row_number()over (order by 1 asc)+(select max(emi01codi) from emi01)emi01codi,
pur06.gen01codi gen01codi,
(select emi03codi from emi03 where emi03des='IMPUESTO PREDIAL URBANO')emi01seri,
P1.pur01pred emi01clave,
(select date_part('year',emision_urbano.f_actual::abstime)) emi01anio,
(select date_part('month',emision_urbano.f_actual::abstime)) emi01mes,
(select date_part('day',emision_urbano.f_actual::abstime)) emi01dia,
emision_urbano.f_obl emi01fobl,
emision_urbano.f_actual emi01femi,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01vtot,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01inte,
(select round(((random()*(1.5-0.25)+0.02) :: NUMERIC),2)) emi01desc,
(select round(((random()*(2.1+0.15)+0.05) :: NUMERIC),2) )emi01reca,
(substr('SN',trunc(random()*2+1)::integer,1)) emi01exo,
(select substr('EEEEEEBAR',trunc(random()*9+1)::integer,1)) emi01esta,
p1.pur01dir emi01titu,
emision_urbano.f_actual emi01fcre,
genera_usuario() emi01lcre
from pur01 P1
inner join
cat01 on p1.cat01codi=cat01.cat01codi
inner join
cat04 on cat01.cat04codi=cat04.cat04codi and substr(cat04desc,12,1) in ('A')
inner join
pur06 on P1.pur01pred=pur06.pur01pred and pur06.pur06prin='S'
inner join
gen01 on gen01.gen01codi=pur06.gen01codi
inner join
gen02 g2 on g2.gen02codi=gen01.gen02codi and g2.gen02desc='JURIDICO'
inner join
(select pur01pred emi01clave,
period.calendar_date f_actual,
(date_part('year',period.calendar_date::timestamp)||'/12/31')::timestamp f_obl
from pur01 inner join
( select generate_series calendar_date
from generate_series('2010/01/01 0:00'::timestamp,'2011/01/31 23:59:59', '1
year')
) as period
on period.calendar_date between pur01.pur01fcre and now()
where pur01.pur01fcre between pur01.pur01fcre and now()
)emision_urbano
on p1.pur01pred=emision_urbano.emi01clave
where p1.pur01pred in
(
select pur04.pur01pred
from pur04,ciudad,region
where p1.pur01pred=pur04.pur01pred
and substr(pur04escr,2,(position('-' in pur04escr)-3))=ciudad.nombre
and region.codigo_region=ciudad.codigo_region and region.nombre='Sierra'
)
14.2.1.2 PRUEBA 1 PRIMERA OPTIMIZACIÓN (SENTENCIA INSERT).
INSERT INTO emi01(
emi01codi, gen01codi, emi01seri, emi01clave, emi01anio, emi01mes,
emi01dia, emi01fobl,emi01femi, emi01vtot,emi01inte,emi01desc,
emi01reca, emi01exo, emi01esta, emi01titu,emi01fcre, emi01lcre)
select row_number()over (order by 1 asc)+(select max(emi01codi) from emi01)emi01codi,
pur06.gen01codi gen01codi,
(select emi03codi from emi03 where emi03des='IMPUESTO PREDIAL URBANO')emi01seri,
P1.pur01pred emi01clave,
(select date_part('year',emision_urbano.f_actual::abstime)) emi01anio,
(select date_part('month',emision_urbano.f_actual::abstime)) emi01mes,
(select date_part('day',emision_urbano.f_actual::abstime)) emi01dia,
emision_urbano.f_obl emi01fobl,
emision_urbano.f_actual emi01femi,
160
(select round(((random()*3+0.10) :: NUMERIC),2))emi01vtot,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01inte,
(select round(((random()*(1.5-0.25)+0.02) :: NUMERIC),2)) emi01desc,
(select round(((random()*(2.1+0.15)+0.05) :: NUMERIC),2) )emi01reca,
(substr('SN',trunc(random()*2+1)::integer,1)) emi01exo,
(select substr('EEEEEEBAR',trunc(random()*9+1)::integer,1)) emi01esta,
p1.pur01dir emi01titu,
emision_urbano.f_actual emi01fcre,
genera_usuario() emi01lcre
from pur01 P1
inner join
cat01 on p1.cat01codi=cat01.cat01codi
inner join
cat04 on cat01.cat04codi=cat04.cat04codi and substr(cat04desc,12,1) in ('A')
inner join
pur06 on P1.pur01pred=pur06.pur01pred and pur06.pur06prin='S'
inner join
gen01 on gen01.gen01codi=pur06.gen01codi
inner join
gen02 g2 on g2.gen02codi=gen01.gen02codi and g2.gen02desc='JURIDICO'
inner join
(select pur01pred emi01clave,
period.calendar_date f_actual,
(date_part('year',period.calendar_date::timestamp)||'/12/31')::timestamp f_obl
from pur01 inner join
(select generate_series calendar_date
from generate_series('2010/01/01 0:00'::timestamp,'2011/01/31 23:59:59', '1 year')
) as period
on period.calendar_date between pur01.pur01fcre and now()
where pur01.pur01fcre between pur01.pur01fcre and now()
)emision_urbano
on p1.pur01pred=emision_urbano.emi01clave
where p1.pur01pred in
(
select p4.pur01pred
from pur04 p4
where substr(pur04escr,2,(position('-' in pur04escr)-3)) in
(
select ciudad.nombre
from ciudad,region
where ciudad.codigo_region=region.codigo_region
and substr(pur04escr,2,(position('-' in pur04escr)-3))=ciudad.nombre
and region.nombre='Sierra'
)
)
14.2.1.3 PRUEBA 1 SEGUNDA OPTIMIZACIÓN (SENTENCIA INSERT).
INSERT INTO emi01(
emi01codi, gen01codi, emi01seri, emi01clave, emi01anio, emi01mes,
emi01dia, emi01fobl,emi01femi, emi01vtot,emi01inte,emi01desc,
emi01reca, emi01exo, emi01esta, emi01titu,emi01fcre, emi01lcre)
select row_number()over (order by 1 asc)+(select max(emi01codi) from emi01)emi01codi,
pur06.gen01codi gen01codi,
(select emi03codi from emi03 where emi03des='IMPUESTO PREDIAL URBANO')emi01seri,
P1.pur01pred emi01clave,
(select date_part('year',emision_urbano.f_actual::abstime)) emi01anio,
(select date_part('month',emision_urbano.f_actual::abstime)) emi01mes,
(select date_part('day',emision_urbano.f_actual::abstime)) emi01dia,
emision_urbano.f_obl emi01fobl,
emision_urbano.f_actual emi01femi,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01vtot,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01inte,
(select round(((random()*(1.5-0.25)+0.02) :: NUMERIC),2)) emi01desc,
(select round(((random()*(2.1+0.15)+0.05) :: NUMERIC),2) )emi01reca,
(substr('SN',trunc(random()*2+1)::integer,1)) emi01exo,
(select substr('EEEEEEBAR',trunc(random()*9+1)::integer,1)) emi01esta,
p1.pur01dir emi01titu,
161
emision_urbano.f_actual emi01fcre,
genera_usuario() emi01lcre
from pur01 P1
inner join
cat01 on p1.cat01codi=cat01.cat01codi
inner join
cat04 on cat01.cat04codi=cat04.cat04codi and substr(cat04desc,12,1) in ('A')
inner join
pur06 on P1.pur01pred=pur06.pur01pred and pur06.pur06prin='S'
inner join
gen01 on gen01.gen01codi=pur06.gen01codi
inner join
gen02 g2 on g2.gen02codi=gen01.gen02codi and g2.gen02desc='JURIDICO'
inner join
pur04 on p1.pur01pred=pur04.pur01pred
inner join
ciudad on substr(pur04escr,2,(position('-' in pur04escr)-3))=ciudad.nombre
inner join
region on region.codigo_region=ciudad.codigo_region and region.nombre='Sierra'
inner join
(select pur01pred emi01clave,
period.calendar_date f_actual,
(date_part('year',period.calendar_date::timestamp)||'/12/31')::timestamp f_obl
from pur01 inner join
(select generate_series calendar_date
from generate_series('2010/01/01 0:00'::timestamp,'2011/01/31 23:59:59', '1 year')
) as period
on period.calendar_date between pur01.pur01fcre and now()
where pur01.pur01fcre between pur01.pur01fcre and now()
)emision_urbano
on p1.pur01pred=emision_urbano.emi01clave
14.2.1.4 PRUEBA 2 SIN OPTIMIZACIÓN (SENTENCIA INSERT).
INSERT INTO emi01(
emi01codi, gen01codi, emi01seri, emi01clave, emi01anio, emi01mes,
emi01dia, emi01fobl,emi01femi, emi01vtot,emi01inte,emi01desc,
emi01reca, emi01exo, emi01esta, emi01titu,emi01fcre, emi01lcre)
select row_number()over (order by 1 asc)+(select max(emi01codi) from emi01) emi01codi,
pru10.gen01codi gen01codi,
(select emi03codi from emi03 where emi03des='IMPUESTO PREDIAL RUSTICO')emi01seri,
P1.pru01cla emi01clave,
(select date_part('year',emision_rural.f_actual::abstime)) emi01anio,
(select date_part('month',emision_rural.f_actual::abstime)) emi01mes,
(select date_part('day',emision_rural.f_actual::abstime)) emi01dia,
emision_rural.f_obl emi01fobl,
emision_rural.f_actual emi01femi,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01vtot,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01inte,
(select round(((random()*(1.5-0.25)+0.02) :: NUMERIC),2)) emi01desc,
(select round(((random()*(2.1+0.15)+0.05) :: NUMERIC),2) )emi01reca,
(substr('SN',trunc(random()*2+1)::integer,1)) emi01exo,
(select substr('EEEEEEBAR',trunc(random()*9+1)::integer,1)) emi01esta,
p1.pru01nota emi01titu,
emision_rural.f_actual emi01fcre,
genera_usuario() emi01lcre
from pru01 P1,
pru10,
(select pru01cla emi01clave,
period.calendar_date f_actual,
(date_part('year',period.calendar_date::timestamp)||'/12/31')::timestamp f_obl
from pru01
join
(select generate_series calendar_date
from generate_series('2010/01/01 0:00'::timestamp,'2011/01/31 23:59:59', '1 year')
162
) as period
on period.calendar_date between pru01.pru01fing and now()
where pru01.pru01fing between pru01.pru01fing and now()
)emision_rural
where P1.pru01cla=pru10.pru01cla
and not pru10.pru10prin='N'
and p1.pru01cla=emision_rural.emi01clave
and p1.pru01cla in
(
select pru01cla
from pru01
where p1.pru01coda in (
select ren21codi
from ren21, ren20
where ren21.ren20codi=ren20.ren20codi
and ren20.ren20desc='Dominio'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('PROPIETARIO','ARRENDATARIO','POSESIONARIO')
and ren21acti='S'
)
and p1.pru01codb in (
select ren21codi
from ren21, ren20
where ren21.ren20codi=ren20.ren20codi
and ren20.ren20desc='Traslacion de Dominio'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('HERENCIA','DONACION','POSESIÓN')
and ren21acti='S'
)
and p1.fpru01riego in (
select ren21codi
from ren21, ren20
where ren21.ren20codi=ren20.ren20codi
and ren20.ren20desc='Drenaje'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('BIEN DRENADO','MAL DRENADO','MODERADO')
and ren21acti='S'
)
and p1.pru01codc in (
select ren21codi
from ren21, ren20
where ren21.ren20codi=ren20.ren20codi
and ren20.ren20desc='Poblaciones más Cercanas'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('CABECERA CANTONAL','CABECERA PARROQUIAL')
and ren21acti='S'
163
)
and p1.pru01codd in (
select ren21codi
from ren21, ren20
where ren21.ren20codi=ren20.ren20codi
and ren20.ren20desc='Vias'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('PRIMER ORDEN','SEGUNDO ORDEN')
and ren21acti='S'
)
)
14.2.1.5 PRUEBA 2 PRIMER OPTIMIZACIÓN (SENTENCIA INSERT).
INSERT INTO emi01(
emi01codi, gen01codi, emi01seri, emi01clave, emi01anio, emi01mes,
emi01dia, emi01fobl,emi01femi, emi01vtot,emi01inte,emi01desc,
emi01reca, emi01exo, emi01esta, emi01titu,emi01fcre, emi01lcre)
select row_number()over (order by 1 asc)+(select max(emi01codi) from emi01) emi01codi,
pru10.gen01codi gen01codi,
(select emi03codi from emi03 where emi03des='IMPUESTO PREDIAL RUSTICO')emi01seri,
P1.pru01cla emi01clave,
(select date_part('year',emision_rural.f_actual::abstime)) emi01anio,
(select date_part('month',emision_rural.f_actual::abstime)) emi01mes,
(select date_part('day',emision_rural.f_actual::abstime)) emi01dia,
emision_rural.f_obl emi01fobl,
emision_rural.f_actual emi01femi,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01vtot,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01inte,
(select round(((random()*(1.5-0.25)+0.02) :: NUMERIC),2)) emi01desc,
(select round(((random()*(2.1+0.15)+0.05) :: NUMERIC),2) )emi01reca,
(substr('SN',trunc(random()*2+1)::integer,1)) emi01exo,
(select substr('EEEEEEBAR',trunc(random()*9+1)::integer,1)) emi01esta,
p1.pru01nota emi01titu,
emision_rural.f_actual emi01fcre,
genera_usuario() emi01lcre
from pru01 P1,
pru10,
(select pru01cla emi01clave,
period.calendar_date f_actual,(date_part('year',
period.calendar_date::timestamp)||'/12/31')::timestamp f_obl
from pru01 join
(select generate_series calendar_date
from generate_series('2010/01/01 0:00'::timestamp,'2011/01/31 23:59:59', '1 year')
) as period
on period.calendar_date between pru01.pru01fing and now()
where pru01.pru01fing between pru01.pru01fing and now()
)emision_rural
where P1.pru01cla=pru10.pru01cla
and pru10.pru10prin='S'
and p1.pru01cla=emision_rural.emi01clave
and p1.pru01coda in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Dominio'
and ren21desc in('PROPIETARIO','ARRENDATARIO','POSESIONARIO')
and ren21acti='S'
)
and p1.pru01codb in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Traslacion de Dominio'
and ren21desc in('HERENCIA','DONACION','POSESIÓN')
and ren21acti='S'
)
and p1.fpru01riego in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Drenaje'
and ren21desc in('BIEN DRENADO','MAL DRENADO','MODERADO')
164
and ren21acti='S'
)
and p1.pru01codc in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Poblaciones más Cercanas'
and ren21desc in('CABECERA CANTONAL','CABECERA PARROQUIAL')
and ren21acti='S'
)
and p1.pru01codd in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Vias'
and ren21desc in('PRIMER ORDEN','SEGUNDO ORDEN')
and ren21acti='S'
)
14.2.1.6 PRUEBA 2 SEGUNDA OPTIMIZACIÓN (SENTENCIA INSERT).
INSERT INTO emi01(
emi01codi, gen01codi, emi01seri, emi01clave, emi01anio, emi01mes,
emi01dia, emi01fobl,emi01femi, emi01vtot,emi01inte,emi01desc,
emi01reca, emi01exo, emi01esta, emi01titu,emi01fcre, emi01lcre)
select row_number()over (order by 1 asc)+(select max(emi01codi) from emi01) emi01codi,
pru10.gen01codi gen01codi,
(select emi03codi from emi03 where emi03des='IMPUESTO PREDIAL RUSTICO')emi01seri,
P1.pru01cla emi01clave,
(select date_part('year',emision_rural.f_actual::abstime)) emi01anio,
(select date_part('month',emision_rural.f_actual::abstime)) emi01mes,
(select date_part('day',emision_rural.f_actual::abstime)) emi01dia,
emision_rural.f_obl emi01fobl,
emision_rural.f_actual emi01femi,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01vtot,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01inte,
(select round(((random()*(1.5-0.25)+0.02) :: NUMERIC),2)) emi01desc,
(select round(((random()*(2.1+0.15)+0.05) :: NUMERIC),2) )emi01reca,
(substr('SN',trunc(random()*2+1)::integer,1)) emi01exo,
(select substr('EEEEEEBAR',trunc(random()*9+1)::integer,1)) emi01esta,
p1.pru01nota emi01titu,
emision_rural.f_actual emi01fcre,
genera_usuario() emi01lcre
from pru01 P1,
pru10,
(select pru01cla emi01clave,period.calendar_date f_actual,(date_part('year',period.calendar_date::timestamp)||'/12/31')::timestamp
f_obl
from pru01 join
(select generate_series calendar_date
from generate_series('2010/01/01 0:00'::timestamp,'2011/01/31 23:59:59', '1 year')
) as period
on period.calendar_date between pru01.pru01fing and now()
where pru01.pru01fing between pru01.pru01fing and now()
)emision_rural
where P1.pru01cla=pru10.pru01cla
and pru10.pru10prin='S'
and p1.pru01cla=emision_rural.emi01clave
and p1.pru01coda in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Dominio'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='PROPIETARIO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Dominio'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='ARRENDATARIO'
and ren21acti='S'),
(select ren21codi
165
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Dominio'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='POSESIONARIO'
and ren21acti='S')
)
and p1.pru01codb in (
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Traslacion de Dominio'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='HERENCIA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Traslacion de Dominio'
and emi03coselect emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='DONACION'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Traslacion de Dominio'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='POSESIÓN'
and ren21acti='S')
)
and p1.fpru01riego in (
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Drenaje'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='BIEN DRENADO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Drenaje'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='MAL DRENADO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Drenaje'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='MODERADO'
166
and ren21acti='S')
)
and p1.pru01codc in (
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Poblaciones más Cercanas'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='CABECERA CANTONAL'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Poblaciones más Cercanas'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='CABECERA PARROQUIAL'
and ren21acti='S')
)
and p1.pru01codd in (
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Vias'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='PRIMER ORDEN'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Vias'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
)
)
and ren21desc='SEGUNDO ORDEN'
and ren21acti='S')
)
14.2.1.7 PRUEBA 3 SIN OPTIMIZACIÓN (SENTENCIA INSERT).
INSERT INTO emi01(
emi01codi, gen01codi, emi01seri, emi01clave, emi01anio, emi01mes,
emi01dia, emi01fobl,emi01femi, emi01vtot,emi01inte,emi01desc,
emi01reca, emi01exo, emi01esta, emi01titu,emi01fcre, emi01lcre)
select row_number()over (order by 1 asc)+(select max(emi01codi) from emi01)emi01codi,
r1.gen01codi gen01codi,
(select emi03codi from emi03 where emi03des='AGUA POTABLE')emi01seri,
r1.renclaant emi01clave,
(select date_part('year',emision_agua.f_actual::abstime)) emi01anio,
(select date_part('month',emision_agua.f_actual::abstime)) emi01mes,
(select date_part('day',emision_agua.f_actual::abstime)) emi01dia,
emision_agua.f_obl emi01fobl,
emision_agua.f_actual emi01femi,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01vtot,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01inte,
(select round(((random()*(1.5-0.25)+0.02) :: NUMERIC),2)) emi01desc,
(select round(((random()*(2.1+0.15)+0.05) :: NUMERIC),2) )emi01reca,
(substr('SN',trunc(random()*2+1)::integer,1)) emi01exo,
(select substr('EEEEEEBAR',trunc(random()*9+1)::integer,1)) emi01esta,
r1.ren04dir emi01titu,
emision_agua.f_actual emi01fcre,
genera_usuario() emi01lcre
from renagua r1,
(select renclaant emi01clave,
period.calendar_date f_actual,
167
( '/'||date_part('year',period.calendar_date)||'/'||date_part('month',period.calendar_date)||'/28' )::timestamp f_obl
from renagua join
(select generate_series calendar_date
from generate_series('2010/01/01 0:00'::timestamp,'2011/12/31 23:59:59', '1 month')
) as period on period.calendar_date between renagua.ren04fini and now()
where renagua.ren04fini between renagua.ren04fini and now()
)emision_agua,
cat01,
cat04,
pur01 p1,
pur02 p2,
pur05 p5
where r1.renclaant=emision_agua.emi01clave
and r1.pur01pred=p1.pur01pred
and cat01.cat01codi=p1.cat01codi
and cat04.cat04codi=cat01.cat04codi
and p2.pur01pred=p1.pur01pred
and p5.pur01pred=p1.pur01pred
and r1.ren04fini between '01/01/1992' and '31/12/2011'
and p1.cat01codi in (select cat01codi
from cat01 c1
where c1.cat01codi=p1.cat01codi
and c1.cat04codi in
(select cat04codi
from cat04
where cat04.cat04codi=c1.cat04codi
and substring(cat04desc,12,1)like'A')
)
and p5.pur05estadocons in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Estados de Conservación'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('ESTABLE','A REPARAR')
and ren21acti='S'
)
and p5.pur05npiso>3
and p2.pur02tp=1
and p1.pur01acer='S'
and p5.pur05estepiso in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Entrepisos'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('LOSA HORM. ARMADO','MADERA COMUN','MADERA FINA')
and ren21acti='S'
)
and p5.pur05estpare in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Paredes'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
168
and ren21desc in('FIBRO CEMENTO','HORMIGON ARMADO','LADRILLO')
and ren21acti='S'
)
14.2.1.8 PRUEBA 3 PRIMER OPTIMIZACIÓN (SENTENCIA INSERT).
INSERT INTO emi01(
emi01codi, gen01codi, emi01seri, emi01clave, emi01anio, emi01mes,
emi01dia, emi01fobl,emi01femi, emi01vtot,emi01inte,emi01desc,
emi01reca, emi01exo, emi01esta, emi01titu,emi01fcre, emi01lcre)
select row_number()over (order by 1 asc)+(select max(emi01codi) from emi01)emi01codi,
r1.gen01codi gen01codi,
(select emi03codi from emi03 where emi03des='AGUA POTABLE')emi01seri,
r1.renclaant emi01clave,
(select date_part('year',emision_agua.f_actual::abstime)) emi01anio,
(select date_part('month',emision_agua.f_actual::abstime)) emi01mes,
(select date_part('day',emision_agua.f_actual::abstime)) emi01dia,
emision_agua.f_obl emi01fobl,
emision_agua.f_actual emi01femi,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01vtot,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01inte,
(select round(((random()*(1.5-0.25)+0.02) :: NUMERIC),2)) emi01desc,
(select round(((random()*(2.1+0.15)+0.05) :: NUMERIC),2) )emi01reca,
(substr('SN',trunc(random()*2+1)::integer,1)) emi01exo,
(select substr('EEEEEEBAR',trunc(random()*9+1)::integer,1)) emi01esta,
r1.ren04dir emi01titu,
emision_agua.f_actual emi01fcre,
genera_usuario() emi01lcre
from renagua r1
inner join
(select renclaant emi01clave,
period.calendar_date f_actual,
( '/'||date_part('year',period.calendar_date)||'/'||date_part('month',period.calendar_date)||'/28' )::timestamp f_obl
from renagua join
(select generate_series calendar_date
from generate_series('2010/01/01 0:00'::timestamp,'2011/12/31 23:59:59', '1 month')
) as period on period.calendar_date between renagua.ren04fini and now()
where renagua.ren04fini between renagua.ren04fini and now()
)emision_agua on r1.renclaant=emision_agua.emi01clave
inner join
pur01 p1 on p1.pur01pred=r1.pur01pred
inner join
cat01 on cat01.cat01codi=p1.cat01codi
inner join
cat04 on cat04.cat04codi=cat01.cat04codi
inner join
pur05 p5 on p5.pur01pred=p1.pur01pred
inner join
pur02 p2 on p2.pur01pred=p1.pur01pred
where r1.ren04fini between '01/01/1992' and '31/12/2011'
and p1.pur01pred=p2.pur01pred
and p1.pur01pred=p5.pur01pred
and p1.cat01codi in (select cat01codi
from cat01 c1
where c1.cat01codi=p1.cat01codi
and c1.cat04codi in
(select cat04codi
from cat04
where cat04.cat04codi=c1.cat04codi
and substring(cat04desc,12,1)like'A')
)
and p1.pur01acer='S'
and p2.pur02tp=1
and p5.pur05npiso>3
and p5.pur05estadocons in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Estados de Conservación'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('ESTABLE','A REPARAR')
169
and ren21acti='S'
)
and p5.pur05estepiso in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Entrepisos'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='LOSA HORM. ARMADO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Entrepisos'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='MADERA COMUN'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Entrepisos'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='MADERA FINA'
and ren21acti='S')
)
and p5.pur05estpare in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Paredes'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
170
)
)
and ren21desc='FIBRO CEMENTO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Paredes'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='HORMIGON ARMADO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Paredes'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='LADRILLO'
and ren21acti='S')
)
14.2.1.9 PRUEBA 3 SEGUNDA OPTIMIZACIÓN (SENTENCIA INSERT).
INSERT INTO emi01(
emi01codi, gen01codi, emi01seri, emi01clave, emi01anio, emi01mes,
emi01dia, emi01fobl,emi01femi, emi01vtot,emi01inte,emi01desc,
emi01reca, emi01exo, emi01esta, emi01titu,emi01fcre, emi01lcre)
select row_number()over (order by 1 asc)+(select max(emi01codi) from emi01)emi01codi,
r1.gen01codi gen01codi,
(select emi03codi from emi03 where emi03des='AGUA POTABLE')emi01seri,
r1.renclaant emi01clave,
(select date_part('year',emision_agua.f_actual::abstime)) emi01anio,
(select date_part('month',emision_agua.f_actual::abstime)) emi01mes,
(select date_part('day',emision_agua.f_actual::abstime)) emi01dia,
emision_agua.f_obl emi01fobl,
emision_agua.f_actual emi01femi,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01vtot,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01inte,
(select round(((random()*(1.5-0.25)+0.02) :: NUMERIC),2)) emi01desc,
(select round(((random()*(2.1+0.15)+0.05) :: NUMERIC),2) )emi01reca,
(substr('SN',trunc(random()*2+1)::integer,1)) emi01exo,
(select substr('EEEEEEBAR',trunc(random()*9+1)::integer,1)) emi01esta,
r1.ren04dir emi01titu,
emision_agua.f_actual emi01fcre,
genera_usuario() emi01lcre
from pur01 p1
inner join
renagua r1 on r1.pur01pred=p1.pur01pred
inner join
pur02 p2 on p1.pur01pred=p2.pur01pred
inner join
pur05 p5 on p1.pur01pred=p5.pur01pred
inner join
171
(select renclaant emi01clave,period.calendar_date f_actual,(
'/'||date_part('year',period.calendar_date)||'/'||date_part('month',period.calendar_date)||'/28' )::timestamp f_obl
from renagua join
( select generate_series calendar_date
from generate_series('2010/01/01
0:00'::timestamp,'2011/12/31 23:59:59', '1 month')
) as period
on period.calendar_date between renagua.ren04fini and now()
where renagua.ren04fini between renagua.ren04fini and now()
)emision_agua on r1.renclaant=emision_agua.emi01clave
where
r1.ren04fini between '01/01/1992' and '31/12/2011'
and p1.cat01codi in (select cat01codi
from cat01 c1
where c1.cat04codi in
(select cat04codi
from cat04
where substring(cat04desc,12,1)='A')
)
and p1.pur01acer='S'
and p2.pur02tp=1
and p5.pur05npiso>3
and p5.pur05estadocons in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Estados de Conservación'
)
and ren21desc='ESTABLE'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Estados de Conservación'
)
and ren21desc='A REPARAR'
and ren21acti='S')
)
and p5.pur05estepiso in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Entrepisos'
)
and ren21desc='LOSA HORM. ARMADO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Entrepisos'
)
and ren21desc='MADERA COMUN'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Entrepisos'
)
and ren21desc='MADERA FINA'
and ren21acti='S')
)
and p5.pur05estpare in (
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Paredes'
)
and ren21desc='FIBRO CEMENTO'
and ren21acti='S'),
(select ren21codi
172
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Paredes'
)
and ren21desc='HORMIGON ARMADO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in
(select ren20codi
from ren20
where ren20desc='Paredes'
)
and ren21desc='LADRILLO'
and ren21acti='S')
)
14.2.1.10 PRUEBA 4 SIN OPTIMIZACIÓN (SENTENCIA INSERT).
INSERT INTO emi01(
emi01codi, gen01codi, emi01seri, emi01clave, emi01anio, emi01mes,
emi01dia, emi01fobl,emi01femi, emi01vtot,emi01inte,emi01desc,
emi01reca, emi01exo, emi01esta, emi01titu,emi01fcre, emi01lcre)
select row_number()over (order by 1 asc)+(select max(emi01codi) from emi01)emi01codi,
pur06.gen01codi gen01codi,
(select emi03codi from emi03 where emi03des='IMPUESTO PREDIAL URBANO')emi01seri,
P1.pur01pred emi01clave,
(select date_part('year',emision_urbano.f_actual::abstime)) emi01anio,
(select date_part('month',emision_urbano.f_actual::abstime)) emi01mes,
(select date_part('day',emision_urbano.f_actual::abstime)) emi01dia,
emision_urbano.f_obl emi01fobl,
emision_urbano.f_actual emi01femi,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01vtot,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01inte,
(select round(((random()*(1.5-0.25)+0.02) :: NUMERIC),2)) emi01desc,
(select round(((random()*(2.1+0.15)+0.05) :: NUMERIC),2) )emi01reca,
(substr('SN',trunc(random()*2+1)::integer,1)) emi01exo,
(select substr('EEEEEEBAR',trunc(random()*9+1)::integer,1)) emi01esta,
p1.pur01dir emi01titu,
emision_urbano.f_actual emi01fcre,
genera_usuario() emi01lcre
from pur01 P1,
pur06,
( select pur01pred emi01clave,
period.calendar_date f_actual,
(date_part('year',period.calendar_date::timestamp)||'/12/31')::timestamp f_obl
from pur01 join
(select generate_series calendar_date
from generate_series('2010/01/01 0:00'::timestamp,'2011/01/31 23:59:59', '1 year')
) as period
on period.calendar_date between pur01.pur01fcre and now()
where pur01.pur01fcre between pur01.pur01fcre and now()
)emision_urbano,
pur02 p2,
pur05 p5
where P1.pur01pred=pur06.pur01pred
and pur06.pur06prin='S'
and p1.pur01pred=emision_urbano.emi01clave
and p1.pur01pred=p2.pur01pred
and p1.pur01pred=p5.pur01pred
and p2.pur02aterr between 10 and 200
and pur06.gen01codi in
(
select p6.gen01codi
from pur06 p6
where p6.gen01codi in
(select gen01codi
from gen01 g1
where substr(g1.gen01ced,10,1)::integer=1
and not g1.gen01eciv='V'
)
and p6.pur06prin='S'
)
and p5.pur05estadocons in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
173
where ren20.ren20desc='Estados de Conservación'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('A REPARAR','OBSOLETO')
and ren21acti='S'
)
and pur06.gen01codi in (
select pru10.gen01codi
from pru01
inner join
pru10 on pru01.pru01cla=pru10.pru01cla
inner join
ren21 on pru01.pru01codd=ren21.ren21codi
and ren21desc in('PRIMER ORDEN','SEGUNDO ORDEN') and ren21acti='S'
inner join
ren20 on ren21.ren20codi=ren20.ren20codi and ren20.ren20desc='Vias'
inner join
pur06 on pur06.gen01codi=pru10.gen01codi and pru10prin='S'
)
14.2.1.11 PRUEBA 4 PRIMERA OPTIMIZACIÓN (SENTENCIA INSERT).
INSERT INTO emi01(
emi01codi, gen01codi, emi01seri, emi01clave, emi01anio, emi01mes,
emi01dia, emi01fobl,emi01femi, emi01vtot,emi01inte,emi01desc,
emi01reca, emi01exo, emi01esta, emi01titu,emi01fcre, emi01lcre)
select row_number()over (order by 1 asc)+(select max(emi01codi) from emi01)emi01codi,
pur06.gen01codi gen01codi,
(select emi03codi from emi03 where emi03des='IMPUESTO PREDIAL URBANO')emi01seri,
P1.pur01pred emi01clave,
(select date_part('year',emision_urbano.f_actual::abstime)) emi01anio,
(select date_part('month',emision_urbano.f_actual::abstime)) emi01mes,
(select date_part('day',emision_urbano.f_actual::abstime)) emi01dia,
emision_urbano.f_obl emi01fobl,
emision_urbano.f_actual emi01femi,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01vtot,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01inte,
(select round(((random()*(1.5-0.25)+0.02) :: NUMERIC),2)) emi01desc,
(select round(((random()*(2.1+0.15)+0.05) :: NUMERIC),2) )emi01reca,
(substr('SN',trunc(random()*2+1)::integer,1)) emi01exo,
(select substr('EEEEEEBAR',trunc(random()*9+1)::integer,1)) emi01esta,
p1.pur01dir emi01titu,
emision_urbano.f_actual emi01fcre,
genera_usuario() emi01lcre
from pur01 P1
inner join
pur06 on p1.pur01pred=pur06.pur01pred and pur06.pur06prin='S'
inner join
(select pur01pred emi01clave,
period.calendar_date f_actual,
(date_part('year',period.caleestamp)||'/12/31')::timestamp f_obl
from pur01 join
(select generate_series calendar_date
from generate_series('2010/01/01 0:00'::timestamp,'2011/01/31 23:59:59', '1 year')
) as period
on period.calendar_date between pur01.pur01fcre and now()
where pur01.pur01fcre between pur01.pur01fcre and now()
)emision_urbano on p1.pur01pred=emision_urbano.emi01clave
inner join
pur02 p2 on p2.pur01pred=p1.pur01pred
inner join
pur05 p5 on p5.pur01pred=p1.pur01pred
inner join
gen01 g1 on g1.gen01codi=pur06.gen01codi
where p2.pur02aterr between 10 and 200
and substr(g1.gen01ced,10,1)='1'
and not g1.gen01eciv='V'
and p5.pur05estadocons in
(
174
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Estados de Conservación'
and ren21desc in('A REPARAR','OBSOLETO')
and ren21acti='S'
)
and pur06.gen01codi in (
select p10.gen01codi
from pru01,pru10 p10,pur06
where pru01.pru01cla=p10.pru01cla
and pru10prin='S'
and pur06.gen01codi=p10.gen01codi
and pru01codd in (
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Vias'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='PRIMER ORDEN'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Vias'
and emi03codi=
(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL RUSTICO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
)
and ren21desc='SEGUNDO ORDEN'
and ren21acti='S')
)
)
14.2.1.12 PRUEBA 4 SEGUNDA OPTIMIZACIÓN (SENTENCIA INSERT).
INSERT INTO emi01(
emi01codi, gen01codi, emi01seri, emi01clave, emi01anio, emi01mes,
emi01dia, emi01fobl,emi01femi, emi01vtot,emi01inte,emi01desc,
emi01reca, emi01exo, emi01esta, emi01titu,emi01fcre, emi01lcre)
select row_number()over (order by 1 asc)+(select max(emi01codi) from emi01)emi01codi,
pur06.gen01codi gen01codi,
(select emi03codi from emi03 where emi03des='IMPUESTO PREDIAL URBANO')emi01seri,
P1.pur01pred emi01clave,
(select date_part('year',emision_urbano.f_actual::abstime)) emi01anio,
(select date_part('month',emision_urbano.f_actual::abstime)) emi01mes,
(select date_part('day',emision_urbano.f_actual::abstime)) emi01dia,
emision_urbano.f_obl emi01fobl,
emision_urbano.f_actual emi01femi,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01vtot,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01inte,
(select round(((random()*(1.5-0.25)+0.02) :: NUMERIC),2)) emi01desc,
(select round(((random()*(2.1+0.15)+0.05) :: NUMERIC),2) )emi01reca,
(substr('SN',trunc(random()*2+1)::integer,1)) emi01exo,
(select substr('EEEEEEBAR',trunc(random()*9+1)::integer,1)) emi01esta,
p1.pur01dir emi01titu,
emision_urbano.f_actual emi01fcre,
genera_usuario() emi01lcre
175
from pur01 P1
inner join
pur06 on p1.pur01pred=pur06.pur01pred and pur06.pur06prin='S'
inner join
(select pur01pred emi01clave,
period.calendar_date f_actual,
(date_part('year',period.calendar_date::timestamp)||'/12/31')::timestamp f_obl
from pur01 join
(select generate_series calendar_date
from generate_series('2010/01/01 0:00'::timestamp,'2011/01/31 23:59:59', '1 year')
) as period
on period.calendar_date between pur01.pur01fcre and now()
where pur01.pur01fcre between pur01.pur01fcre and now()
)emision_urbano on p1.pur01pred=emision_urbano.emi01clave
inner join
pur02 p2 on p2.pur01pred=p1.pur01pred
inner join
pur05 p5 on p5.pur01pred=p1.pur01pred
inner join
gen01 g1 on g1.gen01codi=pur06.gen01codi
where p2.pur02aterr between 10 and 200
and substr(g1.gen01ced,10,1)='1'
and not g1.gen01eciv='V'
and p5.pur05estadocons in (
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Estados de Conservación'
)
and ren21desc='A REPARAR'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Estados de Conservación'
)
and ren21desc='OBSOLETO'
and ren21acti='S')
)
and g1.gen01codi in (
select pru10.gen01codi
from pru01
inner join
pru10 on pru01.pru01cla=pru10.pru01cla
inner join
ren21 on pru01.pru01codd=ren21.ren21codi
and ren21desc in('PRIMER ORDEN','SEGUNDO ORDEN')
and ren21acti='S'
inner join
ren20 on ren21.ren20codi=ren20.ren20codi and ren20.ren20desc='Vias'
inner join
pur06 on pur06.gen01codi=pru10.gen01codi and pru10prin='S'
)
14.2.1.13 PRUEBA 5 SIN OPTIMIZACIÓN (SENTENCIA INSERT).
INSERT INTO emi01(
emi01codi, gen01codi, emi01seri, emi01clave, emi01anio, emi01mes,
emi01dia, emi01fobl,emi01femi, emi01vtot,emi01inte,emi01desc,
emi01reca, emi01exo, emi01esta, emi01titu,emi01fcre, emi01lcre)
select row_number()over (order by 1 asc)+(select max(emi01codi) from emi01)emi01codi,
pur06.gen01codi gen01codi,
(select emi03codi from emi03 where emi03des='IMPUESTO PREDIAL URBANO')emi01seri,
P1.pur01pred emi01clave,
(select date_part('year',emision_urbano.f_actual::abstime)) emi01anio,
(select date_part('month',emision_urbano.f_actual::abstime)) emi01mes,
(select date_part('day',emision_urbano.f_actual::abstime)) emi01dia,
emision_urbano.f_obl emi01fobl,
emision_urbano.f_actual emi01femi,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01vtot,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01inte,
(select round(((random()*(1.5-0.25)+0.02) :: NUMERIC),2)) emi01desc,
(select round(((random()*(2.1+0.15)+0.05) :: NUMERIC),2) )emi01reca,
(substr('SN',trunc(random()*2+1)::integer,1)) emi01exo,
(select substr('EEEEEEBAR',trunc(random()*9+1)::integer,1)) emi01esta,
p1.pur01dir emi01titu,
emision_urbano.f_actual emi01fcre,
genera_usuario() emi01lcre
from pur01 P1,
176
pur06,
pur02 p2,
pur05 p5,
gen01 g1,
cat01,
cat04,
( select pur01pred emi01clave,
period.calendar_date f_actual,
(date_part('year',period.calendar_date::timestamp)||'/12/31')::timestamp f_obl
from pur01 join
(select generate_series calendar_date
from generate_series('2010/01/01 0:00'::timestamp,'2011/01/31 23:59:59', '1 year')
) as period
on period.calendar_date between pur01.pur01fcre and now()
where pur01.pur01fcre between pur01.pur01fcre and now()
)emision_urbano
where substr(cat04desc,12,1) ='B'
and p1.pur01pred=pur06.pur01pred and pur06.pur06prin='S'
and p2.pur01pred=p1.pur01pred
and p5.pur01pred=p1.pur01pred
and g1.gen01codi=pur06.gen01codi
and cat01.cat01codi=p1.cat01codi
and cat04.cat04codi=cat01.cat04codi
and p1.pur01pred=emision_urbano.emi01clave
and p1.pur01pred in (
select pur01pred
from pur02
where p2.pur02carac in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Caracteristica de Suelo'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('CENAGOSO','HUMEDO','INUNDABLE')
and ren21acti='S'
)
)
and p5.pur05acaenlu in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Revestimientos Exteriores'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('CEMENTO ALISADO','CHAMPIADO','ENLUCIDOS TIERRA','GRAFIADO','MADERA FINA')
and ren21acti='S'
)
and g1.gen01codi in ( select gen01codi
from pru10
where pru10.pru10prin='S'
)
and g1.gen01codi in ( select gen01codi
from renagua
where renagua.gen01codi=g1.gen01codi
and g1.gen01codi=renagua.gen01codi
)
177
14.2.1.14 PRUEBA 5 PRIMER OPTIMIZACIÓN (SENTENCIA INSERT).
INSERT INTO emi01(
emi01codi, gen01codi, emi01seri, emi01clave, emi01anio, emi01mes,
emi01dia, emi01fobl,emi01femi, emi01vtot,emi01inte,emi01desc,
emi01reca, emi01exo, emi01esta, emi01titu,emi01fcre, emi01lcre)
select row_number()over (order by 1 asc)+(select max(emi01codi) from emi01)emi01codi,
pur06.gen01codi gen01codi,
(select emi03codi from emi03 where emi03des='IMPUESTO PREDIAL URBANO')emi01seri,
P1.pur01pred emi01clave,
(select date_part('year',emision_urbano.f_actual::abstime)) emi01anio,
(select date_part('month',emision_urbano.f_actual::abstime)) emi01mes,
(select date_part('day',emision_urbano.f_actual::abstime)) emi01dia,
emision_urbano.f_obl emi01fobl,
emision_urbano.f_actual emi01femi,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01vtot,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01inte,
(select round(((random()*(1.5-0.25)+0.02) :: NUMERIC),2)) emi01desc,
(select round(((random()*(2.1+0.15)+0.05) :: NUMERIC),2) )emi01reca,
(substr('SN',trunc(random()*2+1)::integer,1)) emi01exo,
(select substr('EEEEEEBAR',trunc(random()*9+1)::integer,1)) emi01esta,
p1.pur01dir emi01titu,
emision_urbano.f_actual emi01fcre,
genera_usuario() emi01lcre
from pur01 P1
inner join
pur06 on p1.pur01pred=pur06.pur01pred and pur06.pur06prin='S'
inner join
(select pur01pred emi01clave,
period.calendar_date f_actual,
(date_part('year',period.calendar_date::timestamp)||'/12/31')::timestamp f_obl
from pur01 join
(select generate_series calendar_date
from generate_series('2010/01/01 0:00'::timestamp,'2011/01/31 23:59:59', '1 year')
) as period
on period.calendar_date between pur01.pur01fcre and now()
where pur01.pur01fcre between pur01.pur01fcre and now()
)emision_urbano on p1.pur01pred=emision_urbano.emi01clave
inner join
pur02 p2 on p2.pur01pred=p1.pur01pred
inner join
pur05 p5 on p5.pur01pred=p1.pur01pred
inner join
gen01 g1 on g1.gen01codi=pur06.gen01codi
inner join
cat01 on cat01.cat01codi=p1.cat01codi
inner join
cat04 on cat04.cat04codi=cat01.cat04codi
where substr(cat04desc,12,1) ='B'
and p2.pur02carac in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Caracteristica de Suelo'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in('CENAGOSO','HUMEDO','INUNDABLE')
and ren21acti='S'
)
and p5.pur05acaenlu in (
select ren21codi
from ren21 join ren20 on ren21.ren20codi=ren20.ren20codi
where ren20.ren20desc='Revestimientos Exteriores'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
and emi03tipo='I'
and emi03pant='N'
178
and emi03cond='S'
and emi03inte='S'
and emi03reca='S'
and emi03desc='S'
and emi03pred='S'
)
and ren21desc in
('CEMENTO ALISADO','CHAMPIADO','ENLUCIDOS TIERRA','GRAFIADO','MADERA FINA')
and ren21acti='S'
)
and g1.gen01codi in ( select gen01codi
from pru10
where pru10.pru10prin='S'
)
and g1.gen01codi in ( select gen01codi
from renagua
)
14.2.1.15 PRUEBA 5 SEGUNDA OPTIMIZACIÓN (SENTENCIA INSERT).
INSERT INTO emi01(
emi01codi, gen01codi, emi01seri, emi01clave, emi01anio, emi01mes,
emi01dia, emi01fobl,emi01femi, emi01vtot,emi01inte,emi01desc,
emi01reca, emi01exo, emi01esta, emi01titu,emi01fcre, emi01lcre)
select row_number()over (order by 1 asc)+(select max(emi01codi) from emi01)emi01codi,
pur06.gen01codi gen01codi,
(select emi03codi from emi03 where emi03des='IMPUESTO PREDIAL URBANO')emi01seri,
P1.pur01pred emi01clave,
(select date_part('year',emision_urbano.f_actual::abstime)) emi01anio,
(select date_part('month',emision_urbano.f_actual::abstime)) emi01mes,
(select date_part('day',emision_urbano.f_actual::abstime)) emi01dia,
emision_urbano.f_obl emi01fobl,
emision_urbano.f_actual emi01femi,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01vtot,
(select round(((random()*3+0.10) :: NUMERIC),2))emi01inte,
(select round(((random()*(1.5-0.25)+0.02) :: NUMERIC),2)) emi01desc,
(select round(((random()*(2.1+0.15)+0.05) :: NUMERIC),2) )emi01reca,
(substr('SN',trunc(random()*2+1)::integer,1)) emi01exo,
(select substr('EEEEEEBAR',trunc(random()*9+1)::integer,1)) emi01esta,
p1.pur01dir emi01titu,
emision_urbano.f_actual emi01fcre,
genera_usuario() emi01lcre
from pur01 P1
inner join
pur06 on p1.pur01pred=pur06.pur01pred and pur06.pur06prin='S'
inner join
pur02 p2 on p2.pur01pred=p1.pur01pred
inner join
pur05 p5 on p5.pur01pred=p1.pur01pred
inner join
gen01 g1 on g1.gen01codi=pur06.gen01codi
inner join
cat01 on cat01.cat01codi=p1.cat01codi
inner join
cat04 on cat04.cat04codi=cat01.cat04codi
inner join
(select pur01pred emi01clave,
period.calendar_date f_actual,
(date_part('year',period.calendar_date::timestamp)||'/12/31')::timestamp f_obl
from pur01 join
(select generate_series calendar_date
from generate_series('2010/01/01 0:00'::timestamp,'2011/01/31 23:59:59', '1 year')
) as period
on period.calendar_date between pur01.pur01fcre and now()
where pur01.pur01fcre between pur01.pur01fcre and now()
)emision_urbano on p1.pur01pred=emision_urbano.emi01clave
where substr(cat04desc,12,1) ='B'
and p2.pur02carac in (
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Caracteristica de Suelo'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='CENAGOSO'
and ren21acti='S'),
179
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Caracteristica de Suelo'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='HUMEDO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Caracteristica de Suelo'
and emi03codi=(select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='INUNDABLE'
and ren21acti='S')
)
and p5.pur05acaenlu in (
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Revestimientos Exteriores'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='CEMENTO ALISADO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Revestimientos Exteriores'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='CHAMPIADO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Revestimientos Exteriores'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='ENLUCIDOS TIERRA'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Revestimientos Exteriores'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='GRAFIADO'
and ren21acti='S'),
(select ren21codi
from ren21
where ren20codi in ( select ren20codi
from ren20
where ren20desc='Revestimientos Exteriores'
and emi03codi=( select emi03codi
from emi03
where emi03des='IMPUESTO PREDIAL URBANO'
)
)
and ren21desc='MADERA FINA'
180
and ren21acti='S')
)
and g1.gen01codi in ( select gen01codi
from pru10
where pru10.pru10prin='S'
)
and g1.gen01codi in ( select gen01codi
from renagua
where renagua.gen01codi=g1.gen01codi
)
181
DUBLIN CORE (ESQUEMA DE CODIFICACIÓN)
1 Título/TITLE M
“ANALISIS DEL TIEMPO DE RESPUESTA DE
LAS SENTENCIAS SQL COMPLEJAS
UTILIZANDO VOLUMENES DE MILLONES
DE DATOS”
2 Creador/Creator M Hidalgo C; Universidad Técnica Estatal de
Quevedo
3 Materia/Subject M
Ciencias de la Ingeniería; Ingeniería en Sistemas;
Análisis SQL; Optimización; Tiempo; Millones de
Datos; Sentencias;
4 Descricción/Description M
El objetivo de este proyecto fue determinar cómo
mejora rendimiento del tiempo de respuesta de
operaciones complejas escritas en el Lenguaje de
Consulta Estructurado (SQL) pasando por un
proceso de optimización para el gestor de base de
datos POSTGRES 9.0, las mismas que fueron
ejecutadas en SQL SERVER 2008 y ORACLE
10G.
5 Editor/Publisher M FCI; Carrera de Ingeniería en Sistemas; Hidalgo C
6 Colaborador/Contributor O Niguno
7 Fecha/Date M 6 de septiembre del 2012
8 Tipo/Type M Tesis de Grado
9 Formato/Format R Microsoft Office Word 97-2003(*.doc)
Adobe Acrobat Document(*.pdf)