|
Posted by Anze on 01/05/08 17:56
Hi!
Good Man wrote:
> ...
> I know you don't want to change the database, but note that you're asking
> for this:
>
> "WHERE t.visible=1 and t.open=1"
>
> So, unless you have an index on those columns, the MySQL optimizer (or any
> other optimizer) has no choice but to examine every single row to check
> for those conditions.
Sorry for late response, I didn't see the answers till now...
Actually i solved it by fetching a bit more records and discarding the ones
that are not visible / open. In theory it could happen that there are less
records fetched because of that, but it doesn't matter in this case - this
is "last X posts in forum" and the posts are being added every minute (they
are almost always visible), besides, it is very important that it's fast
but it's not that important that it's accurate...
So thanks again, I have solved it without the index, and I prefer it that
way... (The forum is being supported by someone else so I don't want to
mess things there :)
Thanks,
Anze
Navigation:
[Reply to this message]
|