什么更快? C ++向量在数据库中排序或排序 [英] What is faster? C++ vector sort or sort in database
问题描述
我必须从数据库中获取值并将它们存储在
我的c ++应用程序中的矢量中。
什么更快?如果我使用sql语句中的
''order by''子句获取从数据库中排序的值,或者如果我将它们取回到未分类的
向量并排序然后向量?
谢谢你的帮助
格雷茨
Jens
" JerryJ" < JE **** @ gmx.de>在消息中写道
新闻:e9 ************************* @ posting.google.co m ... < blockquote class =post_quotes>我必须从数据库中获取值并将它们存储在我的c ++应用程序的矢量中。
什么更快?如果我使用sql语句中的
''order by''子句获取从数据库中排序的值,或者如果我将它们取回到未排序的
向量中并对该向量进行排序呢?
Thanx为您提供帮助
只有一种方法可以回答这个问题,尝试两种方式并计时。
john
" JerryJ" < JE **** @ gmx.de>在消息中写道
新闻:e9 ************************* @ posting.google.co m ... < blockquote class =post_quotes>我必须从数据库中获取值并将它们存储在我的c ++应用程序的矢量中。
什么更快?如果我使用sql语句中的
''order by''子句获取从数据库中排序的值,或者如果我将它们取回到未排序的
向量并对矢量进行排序呢?
更快的方法是消耗
最少的时间。只有一种方法可以确定
那个。
-Mike
JerryJ写道:
我必须从数据库中获取值并将它们存储在我的c ++应用程序中的矢量中。
什么更快?如果我使用sql语句中的
''order by''子句获取从数据库中排序的值,或者如果我将它们取回到未排序的
向量中并对该向量进行排序呢?
Thanx为你提供帮助
Greetz
Jens
这个问题一般无法解答,可以决定性能的外部因素太多了。
您唯一的选择是根据每种方法的经验检查性能
并在那时作出决定。
I have to fetch values from a database and store them in a vector in
my c++ application.
What is faster? if i fetch the values sorted from the database with a
''order by'' clause in the sql-statement or if i fetch them into the
vector unsorted and sort the vector then?
Thanx for your help
Greetz
Jens
"JerryJ" <je****@gmx.de> wrote in message
news:e9*************************@posting.google.co m...I have to fetch values from a database and store them in a vector in
my c++ application.
What is faster? if i fetch the values sorted from the database with a
''order by'' clause in the sql-statement or if i fetch them into the
vector unsorted and sort the vector then?
Thanx for your help
There is only one way to answer that, try them both and time it.
john
"JerryJ" <je****@gmx.de> wrote in message
news:e9*************************@posting.google.co m...I have to fetch values from a database and store them in a vector in
my c++ application.
What is faster? if i fetch the values sorted from the database with a
''order by'' clause in the sql-statement or if i fetch them into the
vector unsorted and sort the vector then?
The faster method will be the one which consumes
the least amount of time. Only one way to determine
that.
-Mike
JerryJ wrote:
I have to fetch values from a database and store them in a vector in
my c++ application.
What is faster? if i fetch the values sorted from the database with a
''order by'' clause in the sql-statement or if i fetch them into the
vector unsorted and sort the vector then?
Thanx for your help
Greetz
Jens
That question can not be generally answered, there are just too many external
factors that can determine performance.
Your only option is to examine the performance empirically between each method
and make a decision at that point.
这篇关于什么更快? C ++向量在数据库中排序或排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!