Hi Eric, Sure, that is one option. But I'm just wondering if inside the xBestIndex() we can get the value field, we can do a much better job to give the cardinality info.
Jilong -----Original Message----- From: sqlite-users-bounces at mailinglists.sqlite.org [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Eric Hill Sent: Wednesday, May 13, 2015 7:46 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] xBestIndex() implementation question I'm just a few days into an xBestIndex/xFilter implementation myself, but my approach is, if I can create the requested index, I set the cost to log(number of rows) of the table, and if I am choosing not to create the requested index, I set the cost to number of rows. I suspect that gives SQLite enough information to optimize the query. Eric From: Jilong Kuang<mailto:jilong.ku...@samsung.com> Sent: ?Wednesday?, ?May? ?13?, ?2015 ?10?:?05? ?PM To: General Discussion of SQLite Database<mailto:sqlite-users at mailinglists.sqlite.org> Hello, I'm working on a project using SQLite virtual table. Now I have a problem about the implementation of xBestIndex() function, in particular, the estimatedRow and estimatedCost variables. As the aConstraint array does not contain the RHS expression value for each constraint (only iColumn and op), how am I supposed to deduce the appropriate value for both estimatedRow and estimatedCost? For example, let's say one constraint "...Where id > 50...". The value of 50 is not passed into the sqlite3_index_info struct. Can you explain how to handle this situation? I just want to have a more accurate cardinality estimation to improve query performance. But I do not know how to do it without the value field. Thank you very much for your time. Best regards, Jilong _______________________________________________ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users