On 21 September 2011 17:59, <haman...@t-online.de> wrote: > If I try to get many items on a prefix match > select code .... where code ~ wantcode > things go very slow. Explain shows a nested loop, so seemingly the table is > rescanned > for every wanted item in the other table. A test run (3000 wanted codes > against a > shortened table of 10000 ones) took about 200 seconds to complete >
What is the output of explain? You say 'the other table', so presumably we're dealing with a foreign key here. Is there an index on that column? -- If you can't see the forest for the trees, Cut the trees and you'll see there is no forest.