473,657 Members | 2,385 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

performance question: resultset's vs sql

Does anyone know what the relative performance would be of using updateable
result sets versus using individual insert or update statements?
(Specifically at the moment I'm dealing with JSP programs using J/Connector
on Tomcat, if that matters.) For example, if I want to read ten records and
update them, would I be better off to use an updateable result set and
update each as I go, or to issue UPDATE statements for each? (Intuitively it
seems to me that the ResultSet should be faster, but who knows?) Similarly,
if I want to insert 10 records, would I be better off to issue 10 INSERT
calls, or to create an empty Result Set and then add records to it?

Another efficiency question: I'm working on a JSP program where I build a
display based on a select, the user fills in some fields that relate to each
record, and then when Submit is pressed I re-read the records and do my
processing. I was just assuming because it sounded right to me that I am
better off to SELECT all the records, get the result set back, and then loop
through, matching the records read against the fields off the web form, and
whenever I see that I have to do something, I go off and do it (updating
various tables based on input). But it occurs to me that an obvious
alternative, and easier to code, would have been to loop through the web
form fields, for each do a select that retrieves that one record, and then
process it. That is, it seems to me intuitively that I am better off to do
one select that retrieves 100 records and loop through the result set
processing them, rather than to do 100 queries that each retrieve 1 record.
Is this true?

Thanks for any help!

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #1
0 1094

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
2671
by: Good Man | last post by:
Hey there I have a dumb question.... Let's say i have a database full of 4000 people.... I select everything from the database by: $result = mysql_query("SELECT * FROM People");
0
3641
by: RoyalScorpion | last post by:
hi guys, i get an updatable resultset from a connection then used it to insert a new row but the result set doesn't chane after insertion, i mean the no of rows before insertion is the same after insertion and also the data, this is the code prove what i say int currentRow = resultset.getRow(); display(resultset); resultset.moveToInsertRow(); for (int i = 0; i < fields.size(); i++) {
0
1168
by: Mark Jay Johansen | last post by:
Does anyone know what the relative performance would be of using updateable result sets versus using individual insert or update statements? (Specifically at the moment I'm dealing with JSP programs using J/Connector on Tomcat, if that matters.) For example, if I want to read ten records and update them, would I be better off to use an updateable result set and update each as I go, or to issue UPDATE statements for each? (Intuitively it...
1
2566
by: Raquel | last post by:
Have a question on the Stored procedure method code generated by DB2 development center for Java stored procedures. Suppose I have a requirement to return the resultset consisting of FIRSTNME, LASTNAME of all employees belonging to a particular department, following is the stored procedure method code generated by "DB2 development center": public static void sproc3mtd ( String workdept, String firstnme,
4
3030
by: bala | last post by:
hi!!! the following is the sql which is veri slow cos of the 'Not In' clause, would appreciate if u anyone can suggest any other way to bring about the same result SELECT Id, LOC, AGENCY, BATCH FROM tblRows WHERE tblRows.AGENCY NOT IN (SELECT DISTINCT B.AGENCY FROM tblRows AS A, tblRows AS B
4
1774
by: Bob Alston | last post by:
Some more, rather specific Access performance questions. IN a split front-end & back-end Access/Jet ONLY LAN situation, and with all query criteria fields and join fields indexed: 1. Is is good form to have a single query with base table with criteria joined to a related table - all in one query? Or should I do a two-step, first query does selection of main table and then join with other table? 2. I have a table with multiple...
4
4442
by: _link98 | last post by:
Problem: java ResultSet cursor from SQL/PL stored-procedure is FORWARD_ONLY. Is it possible to have ResultSet cursors from SQL/PL procedures to scroll forward and backwards? Perhaps I am missing something. Environment: client UDB 8.1 FP9a on Win32, server UDB 8.1 FP9a on Solaris 8 (64BIT). The JDK version on the WinXP client is
1
547
by: Phil | last post by:
Hello, I'm trying to get the result of a set intersection and I'm sure that I've made a very basic error. A Google search has helped but I'm still not quite there. Can someone show me the error? set<intfirstSet;
4
383
by: bobiron | last post by:
Hi, any ideas to improve the above ugly and not efficient code? Thanks Roberto <!-- source XML NOTE: elements "col" changes from source to source --> <?xml version="1.0"?> <resultset> <header>
2
2766
by: sdanda | last post by:
Hi , Do you have any idea how to improve my java class performance while selecting and inserting data into DB using JDBC Connectivity ......... This has to work for more than 8,00,000 of records ..... Can you give some performance tips if you have known 1) For this I am using oci driver ( because I m using oracle 10g) instead of thin driver 2) In that programme I m using prepared statement instead of statement 3) I am...
0
8324
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8842
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8516
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8617
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7353
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.