Too many value tests per predicate in the query expression
或
Client error : Too many value tests per predicate in the query expression.
像這類的語法都不行:
SELECT * FROM domain WHERE id='1' OR id='2' OR ... id='20' OR id='21' SELECT * FROM domain WHERE id in ('1', '2', ... '20', '21') SELECT * FROM domain WHERE id in ('1', '2', ... '20') OR id in ('21', ...)
只能考慮分批一次抓20個,然後再合併處理。
2012/05/07 發現一種可以破解20個條件限制的辦法:
SELECT * FROM `domain` WHERE account in ('key1', 'key2', 'key3', 'key4', 'key5', 'key6', 'key7', 'key8', 'key9', 'key10', 'key11', 'key12', 'key13', 'key14', 'key15', 'key16', 'key17', 'key18', 'key19', 'key20') OR dummy IS NOT NULL OR account in ('key21', 'key22', 'key23', 'key24', 'key25', 'key26', 'key27', 'key28', 'key29', 'key30', 'key31', 'key32', 'key33', 'key34', 'key35', 'key36', 'key37', 'key38', 'key39', 'key40')沒錯,就是加了"OR dummy IS NOT NULL"這個多餘的條件在中間就可以下達多個條件了!
不過當你有這樣的需求時,就應該想一下是不是設計面有問題,或是該用 relational database了。
參考資料
Amazon SimpleDB » Developer Guide » Amazon SimpleDB Concepts » Limits
Query 101: Building Amazon SimpleDB Queries