[MDEV-17902] CONNECT engine JDBC and ODBC very unclear documentation on Memory option Created: 2018-12-04 Updated: 2022-10-05 Resolved: 2022-10-05 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Documentation, Storage Engine - Connect |
| Affects Version/s: | 10.3.11 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Robert Dyas | Assignee: | Ian Gilfillan |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
centos7 |
||
| Attachments: |
|
| Description |
|
The documentation on Connect Engine ODBC - which Connect Engine JDBC references - is very unclear with regards to the Memory option. Suggest a clean rewrite of that doc section. Memory=0 what does it mean? can it be used with order by? can it be used with random access (columns specified as indexed)? Memory=1 same questions Memory=2 same questions similar to but not directly related, a new section clearly indicating how random access is enabled if column is indexed - what will happen? Thank you. |
| Comments |
| Comment by Olivier Bertrand [ 2018-12-07 ] | |||||||||||||
|
Sorry. I don't know why, but the online documentation has shifted numbers from the original document. You can find it attach here. Connect-1.6.8.docx
Let me know whether it is still unclear. | |||||||||||||
| Comment by Robert Dyas [ 2018-12-07 ] | |||||||||||||
|
What does Memory=3 do? I use it and it doesn't generate an error? is it deprecated? | |||||||||||||
| Comment by Olivier Bertrand [ 2018-12-07 ] | |||||||||||||
|
Memory=3 does not exists. Indeed it should be flagged as an error. About ORDER BY see MDEV-17461. | |||||||||||||
| Comment by Robert Dyas [ 2018-12-11 ] | |||||||||||||
|
Hi Olivier, Yes still unclear. Your existing documentation is more on how it works internally... what would be better is documentation on how a user would choose which option is best. IF the following is correct, maybe something like I'm sure there is more to it than that, but that is the type of info I believe most people will benefit from. Also a table listing the same type of info for when to INDEX a column and when not to would be helpful. Same for scrollable=YES/NO. Thank you! | |||||||||||||
| Comment by Olivier Bertrand [ 2018-12-15 ] | |||||||||||||
|
Here is how the corresponding chapter could be re-written: Random Access of ODBC TablesNote: In CONNECT version 1.03 ODBC tables are not indexable. Version 1.04 adds remote indexing facility to the ODBC table type. However, some queries require random access to an ODBC table; for instance, when it is joined to another table or used in an order by queries applied to a long column or large tables. There are several ways to enable random (position) access to a CONNECT ODBC table. They are depending on eventual indexing or from the following table options:
Using memory means that the data retrieved from the remote table will be locally memory stored. It is not always possible, for instance with large tables, but is the faster way to deal with random access. When dealing with small tables, the simpler way to enable random access is to specify a rowset size equal or larger than the table size (or the result set size if a push down where clause is used). This means that the whole result is in memory on the first FETCH and CONNECT will use it for further positional accesses. Another way to have the result set in memory is to use the MEMORY option. This option can be set to the following values: 0 - No memory used (the default). Best when the table is read sequentially as in SELECT statements with only eventual WHERE clauses. Note that the best way to handle ORDER BY is to set the max_length_for_sort_data variable to a larger value (its default value is 1024 that is pretty small). Indeed, it requires less memory to be used, particularly when a WHERE clause limits the retrieved data set. This is because in the case of an ORDER BY query, MariaDB firstly retrieves sequentially the result set and the position of each records. Often the sort can be done from that result set if it is not too big. But if it is too big, or if it implies some “long” columns, only the positions are sorted and MariaDB retrieves the final result from the table read in random order. If setting the max_length_for_sort_data variable is not feasible or does not work, to be able to retrieve table data from memory after the first sequential read, the MEMORY option must be set to 2. For tables too large to be stored in memory another possibility is to make your table to use a scrollable cursor. In this case each randomly accessed row can be retrieved from the data source specifying its cursor position, which is reasonably fast. However, scrollable cursors are not supported by all data sources. From CONNECT version 1.04, another way to provide random access is to specify some columns to be indexed. This should be done only when the corresponding column of the source table is also indexed. This can be used for tables too large to be stored in memory and is similar to the remote indexing used by the MYSQL table type and by the FEDERATED engine. Then remains the possibility to sequentially extract the requested data from the external table and to construct another local table from the data source. For instance, to construct a table containing the CUSTOMER table data, create the table as:
Now you can use custloc for fast database operations on the copied customer table data, eventually restricted by a WHERE clause. | |||||||||||||
| Comment by markus makela [ 2022-10-03 ] | |||||||||||||
|
The latest comment seems identical to what is in the KB right now. Should this be closed as the documentation seems complete? |