Setting INDEXNAME using MYSQL lazarus / 16-Databases ---------------------------------------------------------------------- majlumbo · 2009-01-12 15:25 I have attempted to set the INDEXNAME property of the TSQLQUERY component to the name of an already defined unique index on my MYSQL db.  As soon as I finish typing the name of my index, it automatically gets reset to DEFAULT_ORDER.  I previously used an order by in the sql statement, but found that after inserting a new record, the list is not in index order until I close and re-open the query, prompting the need to use the index instead. Any ideas? ---------------------------------------------------------------------- Loesje · 2009-01-15 11:01 The indexname property can not be used to select an index on your server. You can use it when you define a local index. Easiest is to assign the fields on which you want to sort to the 'indexfieldnames' property. That will generate a temporary index based on those fields. Else you have to create an index yourself. (The indexdefs property) But Lazarus doesn't have an editor to do that, I just saw. so you have to do it with code... ---------------------------------------------------------------------- majlumbo · 2009-01-15 14:13 Thanks Loesje, Seems to work now.  Is there any benefit to maintaining the MySQL server defined index? ---------------------------------------------------------------------- Loesje · 2009-01-18 17:56 Yes, it can make joins faster, and the result when you use 'order by'. The TSQLQuery also had a ServerIndexDefs-property. This is used to obtain the primary key, which is used when updating data. (with ApplyUpdates)