Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Generated count queries with CriteriaBuilder
Generated count queries with CriteriaBuilder [message #1713192] Mon, 02 November 2015 08:55
Maciej Lizewski is currently offline Maciej LizewskiFriend
Messages: 2
Registered: October 2015
Junior Member
Hi,

I am using eclipselink with spring data and postgresql. I noticed that when getting paged results generated count queries looks like this:

SELECT COUNT(id) FROM table WHERE [condition]

where "id" is primary key of "table" and [condition] is generated according to provided specification (and criteria builder). I traced whole process and it seems it is up to eclipselink to provide count query in this particular form.

Now - for very large tables COUNT(id) is (as in my case explain shows) about 10 times slower than COUNT(*), because COUNT(id) reaches for every row "id" value and checks if it is not null, while COUNT(*) counts every row matching criteria. This makes it impossible to use indexes.

Is it possible to change behavior of eclipselink so that it generates COUNT(*) instead of COUNT(id)? *any* way?

thanks in advance for any feedback.
Previous Topic:Cursor memory issues
Next Topic:EclipseLink ignores GeneratedValue(strategy=GenerationType.IDENTITY)
Goto Forum:
  


Current Time: Sat Mar 02 14:55:38 GMT 2024

Powered by FUDForum. Page generated in 0.01693 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top