dqmhgz5848 2014-02-08 14:25
浏览 31
已采纳

RDBMS对Golang的影响[关闭]

I'm not going to make a big long rattle on this question about what I've tested and number crunching. I'm more interested in actual up-to-date practice performances.

I've read tons of articles already and some of them are pretty skeptical or either very pro to one library. I'm currently testing a bit with gorp, yet I have no clue how to compare the performances of such a library towards others.

I know gorp is an extra layer that tries to add ORM to the basic SQL driver/implementation, but seeing Go's extremely clear code and being it very close to the bone on everything it does. It's not like with PHP/Python/JAVA what I'm used too, where you have to navigate through endless layers of complexity to actually see what a package does in its essence.

So my question is if anyone can share (benchmarks are always welcome :) ) their experience and knowledge on this subject.

I don't think a NoSQL-type solution is an option for my projects. All my projects always strongly depend on business logic and intertwined relationships. I also wonder if Postgres will be a win over MySQL. With Django (Python) I noticed significant performance gain using Postgres, but I never found prove on that matter if it was due to the Postgres core implementation or just Django's way of using the wrapper.

Small update

After rereading the question I noticed I kind of missed the actual goal of it. I'm actually looking for the most suitable SQL solution that will least slow down Golang itself. I know the SQL runs concurrent, but also concerning heavy traffic when running it as a web service. I won't be really bothered to drop the ORM part again if that will get me major gain on performance.

  • 写回答

1条回答 默认 最新

  • dqkmn26444 2014-02-21 17:29
    关注

    If you need to use an ORM sqlx or gorp are good Go options. Personally, I am a bit old school and I would rather for a given type Foo, I would rather write a FooDB struct that implements a FooDS interface. Everything in your app just uses FooDS. (DB = database, DS = datastore)

    Your FooDB implementation could be using any number of underlying technologies MongoDB, LevelDB, SQL, etc and it can change as your app changes and this change is transparent to the rest of your app (since the rest of your app uses FooDS).

    I would default to using database/sql (Prepared statements, etc) and the most mature Go SQL driver is Julien Schmidt's MySQL driver: https://github.com/go-sql-driver/mysql

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 求解vmware的网络模式问题 别拿AI回答
  • ¥24 EFS加密后,在同一台电脑解密出错,证书界面找不到对应指纹的证书,未备份证书,求在原电脑解密的方法,可行即采纳
  • ¥15 springboot 3.0 实现Security 6.x版本集成
  • ¥15 PHP-8.1 镜像无法用dockerfile里的CMD命令启动 只能进入容器启动,如何解决?(操作系统-ubuntu)
  • ¥30 请帮我解决一下下面六个代码
  • ¥15 关于资源监视工具的e-care有知道的嘛
  • ¥35 MIMO天线稀疏阵列排布问题
  • ¥60 用visual studio编写程序,利用间接平差求解水准网
  • ¥15 Llama如何调用shell或者Python
  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?