This is a discussion on is there a goto instruction in mysql? within the MySQL forums, part of the Database Server Software category; --> Willem Bogaerts wrote: >> hi guys, i am doin a project in HPC. i am just a beginner in ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Willem Bogaerts wrote: >> hi guys, i am doin a project in HPC. i am just a beginner in >> databases.so i just wanna know if there is any function in SQL which >> lets me to jump to a particular record directly.say something like >> 'gotorecord' or somethin... > > As others already said, there is no fixed order in a database. Better > put: there is no _single_ fixed order. There are as many orders as you > like, and they are implemented with indexes. > No, order is not implemented with indexes. Order is implemented only with the ORDER BY clause. > Many tables have an autonumber column with a primary key. That is the > closest thing to a record position. But it is better than just a > position: it remains the same through the whole life of the table. So > positions will not be reused. > But it may not be in any order in the table. Rows with autoincrement columns are not necessarily added at the end of the table. > Now to the question: is there a GOTO? > > Yes, there is. SELECT is by far the most used data retrieval command, > but there is another one, that is very MySQL specific: HANDLER. > > The HANDLER command allows you do things the ISAM way: this table, that > index, number 7 please. Oh, and pass me the next one as well, will you? > > Again, this command is rarely used (although I use it quite often, but > not as a GOTO). I would not recommend beginners to use HANDLER, as it > can give you dirty data. You should know what it does exactly and you > should know what you are doing. > > If you describe what you want to select, we can help you with the > appropriate queries. > > Best regards, HANDLER can be a good diagnostic tool, but generally should not be used in live code. It is not portable and can give inconsistent results (i.e. dirty reads are possible). -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
| |||
| ok let me tell u guys exactly what i want..see i have a cluster of nodes which i have to use to process a single table contents.My idea is to make the search faster by dividing the search for a particular key betweeen these nodes.so it would have been very helpfull if i could just make each node to search a different part of the table .say ,the first node will search record nos 1-100,the second one 100-200 and so on. if u guys have any good solution for this,please do suggest. |
| |||
| moses wrote: > ok let me tell u guys exactly what i want..see i have a cluster of > nodes which i have to use to process a single table contents.My idea > is to make the search faster by dividing the search for a particular > key betweeen these nodes.so it would have been very helpfull if i > could just make each node to search a different part of the > table .say ,the first node will search record nos 1-100,the second one > 100-200 and so on. > if u guys have any good solution for this,please do suggest. > I doubt that will make a search faster. The overhead of splitting the request then joining the output would probably be much higher than letting MySQL do it itself. Additionally, multiple nodes should not be accessing the same physical table. Before you look for ways to solve a problem, I suggest you first ensure you HAVE a problem. RDBMS's are quite good at searching; they almost always do better than what you can do yourself because that's what they're optimized to do. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
| |||
| moses: > ...very helpfull if i > could just make each node to search a different part of the > table .say ,the first node will search record nos 1-100,the second one > 100-200 and so on. Does each node have a number (1-10, for instance) and does each node 'know' its own number? Also, if you give each node its own range, are you sure to cover the whole bunch with all your nodes? |
| |||
| On Mar 17, 5:24*pm, Erick T. Barkhuis <erick.use...@ardane.c-o-m> wrote: > Does each node have a number (1-10, for instance) and does each node > 'know' its own number? > Also, if you give each node its own range, are you sure to cover the > whole bunch with all your nodes? yes each node has its own number.and i am interfacing the Database through the C API to read the data.The nodes communicate using the Message Passing Interface(LAM/MPI using SPMD concept).so If i can just find an instruction which will help me split the search ,my pblm would be solved. |
| |||
| On Mar 17, 6:22*pm, Jerry Stuckle <jstuck...@attglobal.net> wrote: > Before you look for ways to solve a problem, I suggest you first ensure > you HAVE a problem. *RDBMS's are quite good at searching; they almost > always do better than what you can do yourself because that's what > they're optimized to do. i know RDBMS have very efficient search engines.so i am infact trying to utilize it to my advantage.the only thing i want to do is to make different nodes to search through different records simultaneously. |
| |||
| moses wrote: > On Mar 17, 6:22 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote: >> Before you look for ways to solve a problem, I suggest you first ensure >> you HAVE a problem. RDBMS's are quite good at searching; they almost >> always do better than what you can do yourself because that's what >> they're optimized to do. > > i know RDBMS have very efficient search engines.so i am infact trying > to utilize it to my advantage.the only thing i want to do is to make > different nodes to search through different records simultaneously. > Please read the rest of my message. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp\0\0\0jstucklex@attglobal.net ================= |
| |||
| moses wrote: > On Mar 17, 5:24 pm, Erick T. Barkhuis <erick.use...@ardane.c-o-m> > wrote: >> Does each node have a number (1-10, for instance) and does each node >> 'know' its own number? >> Also, if you give each node its own range, are you sure to cover the >> whole bunch with all your nodes? > > yes each node has its own number.and i am interfacing the Database > through the C API to read the data.The nodes communicate using the > Message Passing Interface(LAM/MPI using SPMD concept).so If i can just > find an instruction which will help me split the search ,my pblm would > be solved. > How many rows are we talking about, anyway? -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
| |||
| On Mar 17, 6:22*pm, Jerry Stuckle <jstuck...@attglobal.net> wrote: > > I doubt that will make a search faster. *The overhead of splitting the > request then joining the output would probably be much higher than > letting MySQL do it itself. *Additionally, multiple nodes should not be > accessing the same physical table. > The overhead involved is not a problem as i am using a MPI program to take care of that.And since the queries run on each nodes is the same ,but on different records,there shouldn't be a problem of splitting and joining them together. But i would like to know more about what u said about why multiple nodes cant access the same table..is it really a constraint set by the DBMS? |
| ||||
| moses: > On Mar 17, 5:24*pm, Erick T. Barkhuis <erick.use...@ardane.c-o-m> > wrote: > > Does each node have a number (1-10, for instance) and does each node > > 'know' its own number? > > Also, if you give each node its own range, are you sure to cover the > > whole bunch with all your nodes? > > yes each node has its own number.and i am interfacing the Database > through the C API to read the data.The nodes communicate using the > Message Passing Interface(LAM/MPI using SPMD concept).so If i can just > find an instruction which will help me split the search ,my pblm would > be solved. Assuming you have read Jerry's comment (databases generally search really fast), why don't you construct an algorithm which turns a node number into a record range? In its simplest form: SELECT yourfields FROM yourtable WHERE yourtable.key > ((@nodeNumber-1)*100) AND yourtable.key <= (@nodeNumber * 100) or similar. Instead of '100' you may use something like (numberOfRecords / numberOfNodes) |