Используя Таблицу Кэша в SQLServer, действительно ли я являюсь сумасшедшим?

Ускорение имеет функцию сильного разделения: boost ::gorith :: split .

Пример программы:

#include 
#include 

int main() {
    auto s = "a,b, c ,,e,f,";
    std::vector fields;
    boost::split(fields, s, boost::is_any_of(","));
    for (const auto& field : fields)
        std::cout << "\"" << field << "\"\n";
    return 0;
}

Вывод:

"a"
"b"
" c "
""
"e"
"f"
""

8
задан FlySwat 7 July 2009 в 22:59
поделиться

2 ответа

I have done that before, especially when I did not have the luxury to edit the application. I think its a valid approach sometimes, but in general having a cache/distributed cache in the application is preferred, cause it better reduces the load on the DB and scales better.

The tricky thing with the naive "just do it in the application" solution, is that many time you have multiple applications interacting with the DB which can put you in a bind if you have no application messaging bus (or something like memcached), cause it can be expensive to have one cache per application.

Obviously, for your problem the ideal solution is to be able to do the paging in a cheaper manner, and not need to churn through ALL the data just to get page N. But sometimes its not possible. Keep in mind that streaming data out of the db can be cheaper than streaming data out of the db back into the same db. You could introduce a new service that is responsible for executing these long queries and then have your main application talk to the db via the service.

3
ответ дан 6 December 2019 в 00:08
поделиться

Ваша tempdb может взлетать как сумасшедшая под нагрузкой, так что я бы посмотрел это. Может быть проще поместить дорогостоящие объединения в представление и проиндексировать представление, чем пытаться кэшировать таблицу для каждого пользователя.

1
ответ дан 6 December 2019 в 00:08
поделиться
Другие вопросы по тегам:

Похожие вопросы: