Thanks, Colin. I have already tried that and nothing changed. Sorry about posting to the wrong list! Like I said, I'm new to this!! Chris -----Original Message----- From: Colin Williams [mailto:colin.williams@xxxxxxxxxxxx] Sent: Thursday, June 05, 2003 10:11 AM To: 'Web Enabling the AS400 / iSeries' Subject: RE: [WEB400] DB2 & Visual Basic Chris, Why don't you just drop the order by, and sort the data once you have it in your localSQL Server database, that should be much quicker (in theory anyway). Give it a try and see what happens! Not sure if this is a web related question though, might be better on the midrange list. Cheers Colin.W -----Original Message----- From: Varnadoe, Chris [mailto:cvarnadoe@xxxxxxxxxx] Sent: 05 June 2003 13:51 To: web400@xxxxxxxxxxxx Subject: [WEB400] DB2 & Visual Basic Hi! I'm new to this list and fairly new to the iSeries. My company is a small, specialized insurance company and we use a policy management system (POINT) from Computer Sciences Corporation (CSC, formerly PMSC). We are an outsourcing customer and access their iSeries system via a T1 line. Their operating system is V5R1 and here we are using Client Access Express V5R1M0 with the latest service pack installed. Here is my problem: I have written a Visual Basic 6.0 program that goes through ODBC to pull certain data out of the database and then store that data into a local SQL Server database. The query on one of the tables is excruciatingly slow. In working with Access and SQL Server my first thought was to add an index, but evidently the DB2 database uses "logical" files as indexes. In talking with the systems people at CSC, they felt like it was the "order by" clause on my SQL query that was causing the delay. This logical file has 13 fields as the key and I only have 6 of them in my "order by" clause. I am used to the indexes being formed from the fields being used in the "where" clause. Below I have listed the SQL query that is taking so long (the questions marks just indicate where VB will put data). I am thinking about asking them to create a new logical file with the fields from my "where" clause, but since that costs me money I thought I would see if anyone here could give ! me some insight first. select * from ASBYCPL1 where BYASTX = ? and BYADNB = ? and BYAGTX = ? and BYBRNB = ? and BYEGNB = ? order by BYAACD, BYABCD, BYARTX, BYASTX, BYADNB, BYAOTX Thanks, Chris Varnadoe Information Systems Manager Southern Mutual Church Insurance Co. _______________________________________________ This is the Web Enabling the AS400 / iSeries (WEB400) mailing list To post a message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/web400 or email: WEB400-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/web400. For the latest on Bertram Books products and services and for up-to-the-minute book news visit www.bertrams.com This e-mail and any attachments may contain information that is confidential and privileged and is solely for the use of the intended recipient. If you are not the intended recipient please notify the sender and delete this e-mail and any attachments immediately _______________________________________________ This is the Web Enabling the AS400 / iSeries (WEB400) mailing list To post a message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/web400 or email: WEB400-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/web400.