GithubHelp home page GithubHelp logo

doorisopen / infra-subway-db Goto Github PK

View Code? Open in Web Editor NEW

This project forked from next-step/infra-subway-db

0.0 0.0 0.0 4.14 MB

License: MIT License

JavaScript 7.64% Java 35.29% HTML 0.33% Vue 20.86% SCSS 35.88%

infra-subway-db's Introduction

npm node Website GitHub


인프라공방 샘플 서비스 - 지하철 노선도


🚀 Getting Started

Install

npm 설치

cd frontend
npm install

frontend 디렉토리에서 수행해야 합니다.

Usage

webpack server 구동

npm run dev

application 구동

./gradlew clean build

미션

  • 미션 진행 후에 아래 질문의 답을 작성하여 PR을 보내주세요.

1단계 - 쿼리 최적화

  1. 인덱스 설정을 추가하지 않고 아래 요구사항에 대해 200ms 이하(M1의 경우 2s)로 반환하도록 쿼리를 작성하세요.
  • 활동중인(Active) 부서의 현재 부서관리자 중 연봉 상위 5위안에 드는 사람들이 최근에 각 지역별로 언제 퇴실했는지 조회해보세요. (사원번호, 이름, 연봉, 직급명, 지역, 입출입구분, 입출입시간)
select 
	t1.id as 사원번호, 
	t1.last_name as 이름, 
	t1.annual_income as 연봉, 
	t1.position_name as 직급명, 
	r.time as 입출입시간, 
	r.region as 지역, 
	r.record_symbol as 입출입구분
from (
	select e.id, e.last_name, p.position_name, s.annual_income
	from tuning.department d 
		inner join tuning.manager m on m.department_id = d.id and m.end_date = '9999-01-01'
		inner join tuning.employee e on e.id = m.employee_id
		inner join tuning.position p on p.id = e.id and p.position_name = 'manager' and p.end_date = '9999-01-01'
		inner join tuning.salary s on s.id = e.id and s.end_date = '9999-01-01'
	where d.note = 'active'
	order by s.annual_income desc
	limit 5
) t1 inner join tuning.record r on r.employee_id = t1.id and r.record_symbol = 'O'
order by t1.id;

sql_explain

sql_visual_explain


2단계 - 인덱스 설계

  1. 인덱스 적용해보기 실습을 진행해본 과정을 공유해주세요

추가 미션

  1. 페이징 쿼리를 적용한 API endpoint를 알려주세요

infra-subway-db's People

Contributors

brainbackdoor avatar doorisopen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.