Eric,

Yes, the optimizer can use an index with a WHERE on a VIEW, but only when the 
view is local, not when using EXECUTE STATEMENT on an external database.

With regards,

Martijn Tonies
Upscene Productions
http://www.upscene.com



From: Eric Guéguiniat eric.gueguin...@gmail.com [firebird-support] 
Sent: Monday, January 6, 2020 4:52 PM
To: firebird-support@yahoogroups.com 
Subject: Re: [firebird-support] Create view on external table




Index are used with a view when the source is a table and not if it's a stored 
proc 
This view CUST_VIEW use index : SELECT * FROM CUSTOMER => SELECT * FROM 
CUST_VIEW WHERE IDCUSTOMER = 1 , INDEX on IDCUSTOMER is used
The view CUST_SPVIEW don't use index : select * FROM STORED_PROC_CUSTOMER =>  
SELECT * FROM CUST_SPVIEW WHERE IDCUSTOMER = 1 , No index

That why I need to select directly an external table in a view, instead a 
stored procedure

Thanks
Eric



Le lun. 6 janv. 2020 à 16:35, Dimitry Sibiryakov s...@ibphoenix.com 
[firebird-support] <firebird-support@yahoogroups.com> a écrit :

    
  06.01.2020 14:48, Eric Guéguiniat eric.gueguin...@gmail.com 
[firebird-support] wrote:
  > I can't use Stored procedure to do this, because index are not used with it

  Index cannot be used with ES either, so there is no difference and no need in 
a view.

  -- 
  WBR, SD.






  • ... Eric Guéguiniat eric.gueguin...@gmail.com [firebird-support]
    • ... Dimitry Sibiryakov s...@ibphoenix.com [firebird-support]
      • ... Eric Guéguiniat eric.gueguin...@gmail.com [firebird-support]
        • ... Dimitry Sibiryakov s...@ibphoenix.com [firebird-support]
        • ... 'Martijn Tonies (Upscene Productions)' m.ton...@upscene.com [firebird-support]
          • ... Eric Guéguiniat eric.gueguin...@gmail.com [firebird-support]

Reply via email to