24.09.2012 23:04, Howard Chu пишет:
Roman Rybalko wrote:
> 24.09.2012 22:23, Howard Chu пишет:
>>> (&(logTime>=201209201440+0400)(logTime<=201209201450+0400)) -
57sec
>>> (|(logTime=20120920144001+0400)(logTime=20120920144008+0400)) -
>>> 0.03sec
>> Use a correct filter. Your clauses above use invalid syntax.
> Point me please, where exactly my syntax is invalid?
You must be blind. You wrote:
(&(logTime>=201209201440+0400)(logTime<=201209201450+0400)) - 57sec
Check the proper format of a GeneralizedTime value. You have omitted
the seconds field, so you're effectively looking for every entry
greater than the year 20, December 09. The index lookup for this will
most likely hit every entry in your DB, which is why it takes 57 seconds.
Many
thanks for suggestion. Apologies for my extra curiosity.
I tried full GeneralizedTime format (with seconds, with fractions) but
the search works also slow.
Even the search
(|(logTime=20120920144001+0400)(logTime=20120920144008+0400))
that works less than second and returns 2 entries, when reformatted as
(&(logTime>=20120920144001+0400)(logTime<=20120920144008+0400))
works more than 50 seconds.
According to RFC4517 (
http://tools.ietf.org/html/rfc4517#section-3.3.13), GeneraalizedTime has
the syntax:
GeneralizedTime = century year month day hour
[ minute [ second / leap-second ] ]
[ fraction ]
g-time-zone
which means that minutes and seconds may be omitted. Probably that's not
implemented... no problem.
openldap version 2.4.23
How may I optimize (&(>=)(<=)) searches?
--
WBR,
Roman Rybalko