Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: time of parsing of huge IN-list (or searching inside it?) in 3.0 much greater than in 2.5.x [CORE4728] #5034

Closed
firebird-automations opened this issue Mar 31, 2015 · 5 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @pavel-zotov

Attachments:
inlist_1500_elements.zip

The following batch will generate script with list of 1500 literals for testing of performance of:

SELECT 1 FROM RDB$DATABASE WHERE :n IN ( <this_huge_list> ):

@echo off
setlocal enabledelayedexpansion enableextensions
set sql=inlist.sql
del %sql% 2>nul
set n=1500
echo show version;>>%sql%
echo set stat on;>>%sql%
echo select 1 from>>%sql%
echo rdb$database where %n% in(>>%sql%
set /a k=2147483647
set str=(
for /l %%i in (1, 1, %n%) do (
echo !k!
if .%%i.==.1. (
echo !k!>>%sql%
) else (
if .%%i.==.%n%. (
echo ,%n%>>%sql%
) else (
echo ,!k!>>%sql%
)
)
set /a k=!k!-1
)
echo );>>%sql%

(script can be taken also from attached .zip)

Results in 3.0 and old 2.5.0:

ISQL Version: WI-T3.0.0.31756 Firebird 3.0 Beta 2
Server version:
Firebird/Windows/Intel/i386 (access method), version "WI-T3.0.0.31756 Firebird 3.0 Beta 2"
Firebird/Windows/Intel/i386 (remote server), version "WI-T3.0.0.31756 Firebird 3.0 Beta 2/tcp (csprog)/P13"
Firebird/Windows/Intel/i386 (remote interface), version "WI-T3.0.0.31756 Firebird 3.0 Beta 2/tcp (csprog)/P13"
on disk structure version 12.0

CONSTANT

============
1

Current memory = 94624048
Delta memory = 57537952
Max memory = 94692960
Elapsed time= 0.794 sec
Buffers = 8192
Reads = 1
Writes = 0
Fetches = 12

=== vs ===

ISQL Version: WI-V2.5.0.26074 Firebird 2.5
Server version:
Firebird/x86/Windows NT (access method), version "WI-V2.5.0.26074 Firebird 2.5"
Firebird/x86/Windows NT (remote server), version "WI-V2.5.0.26074 Firebird 2.5/tcp (csprog)/P12"
Firebird/x86/Windows NT (remote interface), version "WI-V2.5.0.26074 Firebird 2.5/tcp (csprog)/P12"
on disk structure version 11.2

CONSTANT

============
1

Current memory = 36255732
Delta memory = 727292
Max memory = 36314920
Elapsed time= 0.02 sec
Buffers = 8192
Reads = 17
Writes 0
Fetches = 263

Why the elapsed time in 3.0 is more than 100x worse than in 2.5.x ?

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

Attachment: inlist_1500_elements.zip [ 12690 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

PS. It seems that is is PARSER who works too slow: if I change the place of value 1500 (which is looked for) from the end to the beginning of list then time remains the same. I suppose that engine stops immediatelly when search found value, so this time should be reduced - but it was not so.

@dyemanov
Copy link
Member

Just tested the attached script with different FB versions:

v3.0.11 - 0.005s
v4.0.4 - 0.002s
v5.0.0 - 0.001s

@pavel-zotov, could you please verify ?

@pavel-zotov
Copy link

could you please verify ?

Done (Windows 8.1). Results:

6.0.0.210: 0.004s
5.0.1.1307: 0.004s
4.0.5.3049: 0.023s
3.0.12.33726: 0.015s

@pavel-zotov
Copy link

PS

3.0.0.32483 (15-apr-2016):
when '1500' is at the start of IN-list: 0.016s
when '1500' is at the end of IN-list: 0.017s

Soon of all, this bug was fixed in ~2015 or at the beginning of 2016.
No sense to make test ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants