With 'FilterSQL' (TmyTable) and use SQL statement (TmyQuery), which is faster?
example:
x := TmyTable.Create(nil);
x.tablename := 'stock';
x.filtersql := 'Reff=20';
x.open;
y := tmyQuery.create(nil)
y.sql.text := 'select reff, name from stock where reff=20';
y.open;
x or y is faster?
which is faster?
-
eduardosic
- Posts: 387
- Joined: Fri 18 Nov 2005 00:26
- Location: Brazil
Re: which is faster?
"Y" is more Faster, because MySQL Server return only Row where Reff=20.anwar5218 wrote:With 'FilterSQL' (TmyTable) and use SQL statement (TmyQuery), which is faster?
example:
x := TmyTable.Create(nil);
x.tablename := 'stock';
x.filtersql := 'Reff=20';
x.open;
y := tmyQuery.create(nil)
y.sql.text := 'select reff, name from stock where reff=20';
y.open;
x or y is faster?
"X", MySQL return all records and the filter is applied in the client Side, but all records are transfered on the network.
The second way (with y) should be a bit faster because you have restricted field list in the SELECT statement. The second way will be much faster if there is a BLOB field that is not required on the client in the stock table. In the first case all the fields from the table will be retrieved from the server.x or y is faster?
In both cases filtering is performed on the server.