Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 13th, 2005, 11:43 AM
HereSomeHow HereSomeHow is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Guadalajara, Jalisco, México
Posts: 62 HereSomeHow User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 51 m 29 sec
Reputation Power: 4
How to force a Plan to a view?

Hi...
Is there some way to force a Plan to a view definition, so when invoked through ODBC it applies?

If I run the next query without defining a Plan, it takes about 2 hours for Access 2003 to export an Excel File (I tried the query within IBExpert and it takes aout 15 minutes to give me the first 13 rows) :
Code:
select "Temp3".BUC, "NombreCliente", "Segmento", "NombreSegmento", "Cve_Prod", "Promedio", "Saldo", "Oficial", "Cve_Suc", "Cve_Zon", "Cve_Reg"
from ((((("Temp3" inner join "Clientes" on "Clientes".BUC = "Temp3".BUC)    inner join "Segmentos" on "Clientes"."Segmento"="Segmentos"."Segmento")
      inner join "AsignacionClientes" on "Temp3".BUC = "AsignacionClientes".BUC)
        inner join "ArbolOficiales" on "AsignacionClientes"."Oficial" = "ArbolOficiales"."Oficial")
          inner join "Sucursales" on "Sucursales"."Cve_Suc" = "ArbolOficiales"."Cve_Suc")
            inner join "Zonas" on "Zonas"."Cve_Zon" = "Sucursales"."Cve_Zon"
where "Version" = 'A2' and "Cve_Reg"='9000'


IBExpert says that Firebird is using the next plan :
Code:
Adapted Plan  PLAN JOIN (AsignacionClientes INDEX (PK_AsignacionClientes),ArbolOficiales INDEX (PK_ArbolOficiales),Sucursales INDEX (PK_Sucursales),
Zonas INDEX (PK_Zonas),Clientes INDEX (PK_Clientes),Segmentos INDEX (PK_Segmentos),Temp3 INDEX (PK_Temp3))  


With the same query, assigning the next Plan manually it takes less than 20 seconds to spit all the 1035 rows:
Code:
plan join ( "Temp3" natural,  "Clientes" INDEX ("PK_Clientes"), "Segmentos" INDEX ("PK_Segmentos"),       "AsignacionClientes" INDEX ("PK_AsignacionClientes"), "ArbolOficiales" INDEX ("PK_ArbolOficiales"),
       "Sucursales" INDEX ("PK_Sucursales"), "Zonas" INDEX ("PK_Zonas") )

Any suggestion?

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > How to force a Plan to a view?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT