Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. how to make select fast use ODBC

how to make select fast use ODBC

Scheduled Pinned Locked Moved Database
databasejsonperformancetutorial
8 Posts 3 Posters 57 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bighare
    wrote on last edited by
    #1

    I use VFP98 open a database named abc.dbf,only spend 5 second include show all the data in database. But,when I use ODBC API open the abc.dbf,and show all the data ,It spend much more times,and make the computer shutdown!!(There is not enough memory!!) Thanks! hi

    L 1 Reply Last reply
    0
    • B bighare

      I use VFP98 open a database named abc.dbf,only spend 5 second include show all the data in database. But,when I use ODBC API open the abc.dbf,and show all the data ,It spend much more times,and make the computer shutdown!!(There is not enough memory!!) Thanks! hi

      L Offline
      L Offline
      l a u r e n
      wrote on last edited by
      #2

      how are you using the odbc stuff? you posting doesnt give enough details to say much about what is causing the problems --- "every year we invent better idiot proof systems and every year they invent better idiots"

      B 1 Reply Last reply
      0
      • L l a u r e n

        how are you using the odbc stuff? you posting doesnt give enough details to say much about what is causing the problems --- "every year we invent better idiot proof systems and every year they invent better idiots"

        B Offline
        B Offline
        bighare
        wrote on last edited by
        #3

        Sorry,the following is the detail! Notice: The abc.dbf has 500 million records!!!! The code is too long,I can only give you virtual code!(Using VC++ with ODBC API) 1.SQLDriverConnect(); //connect the database abc.dbf . 2.SQLSetStmtOption(...SQL_CURSOR_DYNAMIC);//Create a scrollable cursor. 3.SQLExecDirect(); //Execute SQL directly.(Select * from tablename) 4.SQLNumResultCols(); //Get selected column numbers.(The fields count) 5.SQLDescribeCol(); //Save column describe in an object array. 6.SQLBindCol(); //Bind every column(fields) with a variable which described in step 5.Saved in an object array. 7.SQLFetchScroll(...SQL_FETCH_LAST);//Move cursor to last record,to get selected records count!It related to step 6. 8.Use ListView show the records data which saved in an object array in setp 6. Notice: whith the 500 million records. Setp 1 to 6 spend a few second,but in step 7,it take much more time ,and make my compter shutdown because there is not enough memory! Thanks! hi

        T 1 Reply Last reply
        0
        • B bighare

          Sorry,the following is the detail! Notice: The abc.dbf has 500 million records!!!! The code is too long,I can only give you virtual code!(Using VC++ with ODBC API) 1.SQLDriverConnect(); //connect the database abc.dbf . 2.SQLSetStmtOption(...SQL_CURSOR_DYNAMIC);//Create a scrollable cursor. 3.SQLExecDirect(); //Execute SQL directly.(Select * from tablename) 4.SQLNumResultCols(); //Get selected column numbers.(The fields count) 5.SQLDescribeCol(); //Save column describe in an object array. 6.SQLBindCol(); //Bind every column(fields) with a variable which described in step 5.Saved in an object array. 7.SQLFetchScroll(...SQL_FETCH_LAST);//Move cursor to last record,to get selected records count!It related to step 6. 8.Use ListView show the records data which saved in an object array in setp 6. Notice: whith the 500 million records. Setp 1 to 6 spend a few second,but in step 7,it take much more time ,and make my compter shutdown because there is not enough memory! Thanks! hi

          T Offline
          T Offline
          Tomasz Sowinski
          wrote on last edited by
          #4

          Why can't you just use "select count(*) from ..." instead of traversing 500 million records? Tomasz Sowinski -- http://www.shooltz.com.pl

          B 1 Reply Last reply
          0
          • T Tomasz Sowinski

            Why can't you just use "select count(*) from ..." instead of traversing 500 million records? Tomasz Sowinski -- http://www.shooltz.com.pl

            B Offline
            B Offline
            bighare
            wrote on last edited by
            #5

            Thanks! You can resolve the record numbers of the table,but how to show every record data much more fast like VFP98. In my way,I use SQLFetchScroll(...SQL_FETCH_NEXT) to get and show record data one by one,It takes much more time!I want to make it fast,how can I do?:-O hi

            T 1 Reply Last reply
            0
            • B bighare

              Thanks! You can resolve the record numbers of the table,but how to show every record data much more fast like VFP98. In my way,I use SQLFetchScroll(...SQL_FETCH_NEXT) to get and show record data one by one,It takes much more time!I want to make it fast,how can I do?:-O hi

              T Offline
              T Offline
              Tomasz Sowinski
              wrote on last edited by
              #6

              You have to use some caching scheme. You simply can't store 500 million records from your table in RAM. Read records in the background thread to improve UI response time. Tomasz Sowinski -- http://www.shooltz.com.pl

              B 2 Replies Last reply
              0
              • T Tomasz Sowinski

                You have to use some caching scheme. You simply can't store 500 million records from your table in RAM. Read records in the background thread to improve UI response time. Tomasz Sowinski -- http://www.shooltz.com.pl

                B Offline
                B Offline
                bighare
                wrote on last edited by
                #7

                Thanks! I will try it,and then talk about it!:-O hi

                1 Reply Last reply
                0
                • T Tomasz Sowinski

                  You have to use some caching scheme. You simply can't store 500 million records from your table in RAM. Read records in the background thread to improve UI response time. Tomasz Sowinski -- http://www.shooltz.com.pl

                  B Offline
                  B Offline
                  bighare
                  wrote on last edited by
                  #8

                  But today I use SQL Server open the same .dbf(conver to .mdb),the SQL Server can not locate the last record in time.But VFP locate the last record in a few seconds.Somebody tell me than VFP use a special technology ,such as RUSHMORE..... Who can tell me how about RUSHMORE?What is the relationship with the SQL?:-O hi

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups