You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@metamodel.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/12/09 12:08:58 UTC

[jira] [Commented] (METAMODEL-1132) Metamodel doesn't support a native paging on SQL Server and Oracle database

    [ https://issues.apache.org/jira/browse/METAMODEL-1132?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15735166#comment-15735166 ] 

ASF GitHub Bot commented on METAMODEL-1132:
-------------------------------------------

GitHub user rposkocil opened a pull request:

    https://github.com/apache/metamodel/pull/137

    Metamodel 1132 sql native paging

    fixes https://issues.apache.org/jira/browse/METAMODEL-1132

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/rposkocil/metamodel METAMODEL-1132-sql-native-paging

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/metamodel/pull/137.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #137
    
----
commit 002c23778cbcbcb442e6e51a596a9461c504251e
Author: rposkocil <r....@gmc.net>
Date:   2016-12-08T19:52:42Z

    Added OffsetFetchQueryRewriter to support the OFFSET-FETCH clause
    - set for SQLServer 2012+ and Oracle 12+
    - added new tests of the clause creation
    - fix tests of SQL Server and Oracle

commit 717fc0049515339911a78466748dba1dfc4efc78
Author: rposkocil <r....@gmc.net>
Date:   2016-12-09T12:04:57Z

    Added OffsetFetchQueryRewriter to support the OFFSET-FETCH clause
    - moved the code pieces to better places

----


> Metamodel doesn't support a native paging on SQL Server and Oracle database
> ---------------------------------------------------------------------------
>
>                 Key: METAMODEL-1132
>                 URL: https://issues.apache.org/jira/browse/METAMODEL-1132
>             Project: Apache MetaModel
>          Issue Type: Bug
>    Affects Versions: 4.5.4
>         Environment: Metamodel with SQL Server or Oracle database
>            Reporter: Radek Poskočil
>              Labels: performance
>
> h2. Problem description
> If a database contains a lot of records, let say a million of records, and user wants to execute a query with a good performance then he will probably use a native paging constucts of the database dialect. Without this feature the user cannot efficiently execute select queries.
> The MetaModel supports it just in MySQL and PostgreSQL. In this case a query properties firstRow and maxRows are rewritten to OFFSET and LIMIT constructs. See MySQLQueryRewriter which extends LimitOffsetQueryRewriter where you can find the method with it.
> SQLServerQueryRewriter supports the special construct TOP which equals maxRows but says nothing about firstRow. Althrough the user set the firstRow attribute. It will be IGNORED and couse a big performance issue.
> A similar issue you can find in OracleQueryRewriter.
> h2. Current behavior
> OracleQueryRewriter and SQLServerQueryRewriter ignores Query.setFirstRow(). OracleQueryRewriter ignores maxRows, too.
> h2. Expected behavior
> There are possibilities to rewrite queries to SQL Server and Oracle dialects.
> for example: SQL Server 2012+ or Oracle 12c 
> SELECT fieldA,fieldB 
> FROM table 
> ORDER BY fieldA 
> OFFSET 5 ROWS FETCH NEXT 14 ROWS ONLY;



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)