Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Table read before inserting a record using Recordset update

2 réponses
Avatar
cbaskara
Hi,

Trying to insert a record using the records section option
(rs.addNew()). I think it reads the whole table. I'm using the query
"select * from table where primary key = 1" for opening the record
set. My DBA is reporting that she is seeing "select * from table"
query is issued very frequently (where as we never issue this query
from any where else).

I'm suspecting that addNew() function reads the whole table before
inserting the record, but not sure. Any ideas or suggestions?

Thanks !

Regards,
Baskar

2 réponses

Avatar
Trevor Best
On 14 Aug 2003 08:12:44 -0700 in comp.databases.ms-access,
(baskar) wrote:

Hi,

Trying to insert a record using the records section option
(rs.addNew()). I think it reads the whole table. I'm using the query
"select * from table where primary key = 1" for opening the record
set. My DBA is reporting that she is seeing "select * from table"
query is issued very frequently (where as we never issue this query
from any where else).

I'm suspecting that addNew() function reads the whole table before
inserting the record, but not sure. Any ideas or suggestions?


Are you using ADO or DAO?

I don't see it in DAO or ADO.

Perhaps you have forms based on tables? Queries written in Access that
are so complex that Access doesn't know how to translate to T-SQL and
so pulls all records and filters on the workstation?

--
Ride Free (but you still have to pay for the petrol)

(replace sithlord with trevor for email)

Avatar
Matthew Reeves
"baskar" wrote in message
news:
Hi,

Trying to insert a record using the records section option
(rs.addNew()). I think it reads the whole table. I'm using the query
"select * from table where primary key = 1" for opening the record
set. My DBA is reporting that she is seeing "select * from table"
query is issued very frequently (where as we never issue this query
from any where else).

I'm suspecting that addNew() function reads the whole table before
inserting the record, but not sure. Any ideas or suggestions?

Thanks !

Regards,
Baskar


You are correct. Upon opening the recordset the first time, and using the
AddNew function, the entire recordset is enumerated before returning control
to the code.

However, here's a cute quirk. If all you need to do with this particular
recordset is to append new records, then you can open the recordset with
this SQL:
"SELECT TOP 1 * FROM TABLE;"

...which will only spend time enumerating one record from the source table.
Then you can AddNew to your heart's content, without the overhead delay of
Access enumerating the entire table. This is especially advantageous on
tables with thousands of records.