Board index » delphi » sql query from secondary index (InterBase.6 / FireBird.1.5)
Gianni Filippini
![]() Delphi Developer |
Gianni Filippini
![]() Delphi Developer |
sql query from secondary index (InterBase.6 / FireBird.1.5)2005-11-22 08:10:29 PM delphi172 Hello Group, please excuse my ignorance, having created a secondary index on a table how can I read it (in Paradox I treated it as a table) in run time (not thru Object Inspector) ... select * from table1 ...index?? Many thanks in advance & regards, Gianni Filippini |
Arno Brinkman
![]() Delphi Developer |
2005-11-22 08:20:30 PM
Re:sql query from secondary index (InterBase.6 / FireBird.1.5)
Hi,
Quoteplease excuse my ignorance, Arno Brinkman ABVisie -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- General database developer support: www.databasedevelopmentforum.com Firebird open source database (based on IB-OE) with many SQL-99 features: www.firebirdsql.org www.firebirdsql.info Support list for Interbase and Firebird users: XXXX@XXXXX.COM Nederlandse firebird nieuwsgroep: |
Bill Todd
![]() Delphi Developer |
2005-11-22 10:07:47 PM
Re:sql query from secondary index (InterBase.6 / FireBird.1.5)
By "read it" do you mean read the data in index order? If so, use an
ORDER BY clause in your SELECT statement. -- Bill Todd (TeamB) |
Gianni Filippini
![]() Delphi Developer |
2005-11-23 07:09:02 PM
Re:sql query from secondary index (InterBase.6 / FireBird.1.5)
Bill, many thanks for your reply,
hence, a secondary index works only behind the scenes and it is never used directly (except in Object Inspector, for Tables), am I right ? Best regards, Gianni Filippini |
Bill Todd
![]() Delphi Developer |
2005-11-23 08:10:30 PM
Re:sql query from secondary index (InterBase.6 / FireBird.1.5)
When and if any index is used is determined by the optimizer. I am not
sure what you mean by "in Object Inspector, for Tables". If you are referring to the IndexName property of TTable, do not every use a table component with a SQL database server unless you want poor performance with any by the smallest tables. -- Bill Todd (TeamB) |
adalberto baldini
![]() Delphi Developer |
2005-11-23 09:55:15 PM
Re:sql query from secondary index (InterBase.6 / FireBird.1.5)
Gianni Filippini writes:
QuoteBill, many thanks for your reply, Plan ( Cities ORDER Cities_1) ORDER BY CITY Optimization of query using an index for ordering ... Adalberto Baldini |
Arno Brinkman
![]() Delphi Developer |
2005-11-23 10:05:30 PM
Re:sql query from secondary index (InterBase.6 / FireBird.1.5)
Hi,
QuoteI have seen an example in Language Reference manual pag. 146 : Regards, Arno Brinkman ABVisie -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- General database developer support: www.databasedevelopmentforum.com Firebird open source database (based on IB-OE) with many SQL-99 features: www.firebirdsql.org www.firebirdsql.info Support list for Interbase and Firebird users: XXXX@XXXXX.COM Nederlandse firebird nieuwsgroep: |
adalberto baldini
![]() Delphi Developer |
2005-11-24 12:01:47 AM
Re:sql query from secondary index (InterBase.6 / FireBird.1.5)
Arno Brinkman writes:
QuoteHi, Adalberto |
Jeff Overcash (TeamB)
![]() Delphi Developer |
2005-11-24 01:20:28 AM
Re:sql query from secondary index (InterBase.6 / FireBird.1.5)
adalberto baldini writes:
Quote
much more expensive than reading whole pages in sequentially and sorting. QuoteAdalberto (Please do not email me directly unless asked. Thank You) Your friends will know you better in the first minute you meet than your acquaintances will know you in a thousand years. (R Bach) |
Bill Todd
![]() Delphi Developer |
2005-11-24 04:40:47 AM
Re:sql query from secondary index (InterBase.6 / FireBird.1.5)
In addition to the specific issues with using an index for sorting, the
optimizer usually has a good reason for not using an index. Unless you know exactly what you are doing writing plan statements is not a good idea. -- Bill Todd (TeamB) |
Robert Schieck (TeamB)
![]() Delphi Developer |
2005-11-24 06:23:22 PM
Re:sql query from secondary index (InterBase.6 / FireBird.1.5)
adalberto baldini writes:
QuoteWhat have you against this Interbase example ? hth -- Rob Schieck TeamB |
Gianni Filippini
![]() Delphi Developer |
2005-11-24 06:56:55 PM
Re:sql query from secondary index (InterBase.6 / FireBird.1.5)
Thanks a lot to Bill Todd
and to everyone for replying best regards, Gianni Filippini |