---
title: "Discussion on \"Effective querying in belongs to associations\" | Hashnode"
description: "Discussion on \"Effective querying in belongs to associations\". In this post i'll go through how to write efficient queries for belongs_to associations. I primarly work with Rails so it will focus on that a bit but i'll share the SQL versions too so you can implement similarly everywhere.\nExample domain model\nLet..."
url: "https://hashnode.com/posts/belongstoquery/65377d43e3fd75cd13754cbf"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Effective querying in belongs to associations](https://www.dsdev.in/belongstoquery?utm_source=hashnode&utm_medium=feed)

In this post i'll go through how to write efficient queries for belongs\_to associations. I primarly work with Rails so it will focus on that a bit but i'll share the SQL versions too so you can implement similarly everywhere. Example domain model Let...

Jan 8, 2022 · 1 min read · dsdev.in  
Read the article

-   [#ruby-on-rails](https://hashnode.com/tag/ruby-on-rails)
-   [#activerecord](https://hashnode.com/tag/activerecord)
-   [#sql](https://hashnode.com/tag/sql)
-   [#backend](https://hashnode.com/tag/backend)
-   [#performance](https://hashnode.com/tag/performance)

## Written by

[Dhaval Singh](https://hashnode.com/@DhavalSingh)

@DhavalSingh · Bangalore, India

  
[View profile](https://hashnode.com/@DhavalSingh)

Writing about Software Development, Backend in particular!

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
