This is with gist index but I'm not sure if django is using the index idk how to check.
Remove 1 characters:
Average speed of 1.6956
Remove 2 characters:
Average speed of 1.4245999999999999
Remove 3 characters:
Average speed of 1.4855999999999998
Remove 4 characters:
Wrong matchthe beatles the beatles
Wrong matchceline dion alone
Wrong matchradiohead
Average speed of 1.383
Remove 5 characters:
Wrong matchdanny elfman home
Wrong matchfrank sinatra santa claus is coming town
Average speed of 1.6916
Strange thing : sing the debugsqlshell values are very differents, seems like connections.queries time is in seconds :s
SELECT lookup_field,
similarity(lookup_field, 'bily joel just the way you are') AS sml
FROM music_test
WHERE lookup_field % 'bily joel just the way you are'
ORDER BY sml DESC,
lookup_field
LIMIT 1; [1605.92ms]
[]
SELECT lookup_field,
similarity(lookup_field, 'air suply chances') AS sml
FROM music_test
WHERE lookup_field % 'air suply chances'
ORDER BY sml DESC,
lookup_field
LIMIT 1; [1210.12ms]
[]
Average speed of 0.0
Remove 2 characters:
SELECT "music_test"."id",
"music_test"."lookup_field"
FROM "music_test"
ORDER BY RANDOM() ASC
LIMIT 5 [126.79ms]
SELECT lookup_field,
similarity(lookup_field, 'nirvana spk thru') AS sml
FROM music_test
WHERE lookup_field % 'nirvana spk thru'
ORDER BY sml DESC,
lookup_field
LIMIT 1; [1236.88ms]
[]
SELECT lookup_field,
similarity(lookup_field, 'onty python bshop at home mr stoddart') AS sml
FROM music_test
WHERE lookup_field % 'onty python bshop at home mr stoddart'
ORDER BY sml DESC,
lookup_field
LIMIT 1; [1723.88ms]
[]
SELECT lookup_field,
similarity(lookup_field, 'macy gray do somethingrdio edit') AS sml
FROM music_test
WHERE lookup_field % 'macy gray do somethingrdio edit'
ORDER BY sml DESC,
lookup_field
LIMIT 1; [1523.17ms]
[]
Wrong matchmacy gray do something edit
SELECT lookup_field,
similarity(lookup_field, 'frank snatra when your lover has goe') AS sml
FROM music_test
WHERE lookup_field % 'frank snatra when your lover has goe'
ORDER BY sml DESC,
lookup_field
LIMIT 1; [1724.64ms]
[]
SELECT lookup_field,
similarity(lookup_field, 'th beatlesmadman 1444') AS sml
FROM music_test
WHERE lookup_field % 'th beatlesmadman 1444'
ORDER BY sml DESC,
lookup_field
LIMIT 1; [1310.41ms]
[]
Average speed of 0.0
Remove 3 characters:
SELECT "music_test"."id",
"music_test"."lookup_field"
FROM "music_test"
ORDER BY RANDOM() ASC
LIMIT 5 [130.80ms]
SELECT lookup_field,
similarity(lookup_field, 'peter ceer perfect orld') AS sml
FROM music_test
WHERE lookup_field % 'peter ceer perfect orld'
ORDER BY sml DESC,
lookup_field
LIMIT 1; [1357.97ms]
[]
^C^C
SELECT lookup_field,
similarity(lookup_field, 'depeche mode th best ofdepeche mode a sort film') AS sml
FROM music_test
WHERE lookup_field % 'depeche mode th best ofdepeche mode a sort film'
ORDER BY sml DESC,
lookup_field
LIMIT 1; [1978.78ms]