{"id":21186699,"url":"https://github.com/emmanuelaaron/vet-clinic-database","last_synced_at":"2026-01-02T02:41:48.940Z","repository":{"id":46275948,"uuid":"423887894","full_name":"Emmanuelaaron/vet-clinic-database","owner":"Emmanuelaaron","description":null,"archived":false,"fork":false,"pushed_at":"2021-11-02T23:11:38.000Z","size":1105,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2025-01-21T13:06:42.723Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Emmanuelaaron.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-02T15:00:20.000Z","updated_at":"2021-11-16T14:22:48.000Z","dependencies_parsed_at":"2022-08-31T07:10:26.126Z","dependency_job_id":null,"html_url":"https://github.com/Emmanuelaaron/vet-clinic-database","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Emmanuelaaron%2Fvet-clinic-database","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Emmanuelaaron%2Fvet-clinic-database/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Emmanuelaaron%2Fvet-clinic-database/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Emmanuelaaron%2Fvet-clinic-database/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Emmanuelaaron","download_url":"https://codeload.github.com/Emmanuelaaron/vet-clinic-database/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243639557,"owners_count":20323511,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-20T18:25:25.775Z","updated_at":"2026-01-02T02:41:48.902Z","avatar_url":"https://github.com/Emmanuelaaron.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# VET CLINIC DATABASE AUDIT\n\n- This task involved auditing the database of a Vet clinic and improving on the perfomance of some select queries as below.\n\n## Problem 1\n\n### SELECT COUNT(*) FROM visits where animal_id = 4;\n\n\u003cimg src=\"./img/VisitsQuery/visits_count.png\" width=\"800\" height=\"600\"\u003e\u003cbr/\u003e\n- Before perfomance tuning \u003cbr/\u003e\n\n\n\u003cimg src=\"./img/VisitsQuery/visits_count_fixed.png\" width=\"800\" height=\"600\"\u003e\u003cbr/\u003e\n- After perfomance tuning \u003cbr/\u003e\n\n### Explanantion of problem and solution\n\n- For the first part we verify the tables and realize that there was no need to modify any of the tables, but we agree that the problem was on the data query itself, so we modify the request to be: \n```\nSELECT COUNT(animal_id) FROM visits where animal_id = 4;\n```\nSo the query only takes in cosideration the animal_id colum. \n\nWhen we test it out we realize that the execution time was reduce from 1751ms to just 829ms.\n\n\n## Problem 2\n\n### SELECT * FROM visits where vet_id = 2;\n\n\u003cimg src=\"./img/VisitsQuery/visitsQuery2.png\" width=\"700\" height=\"400\"\u003e\u003cbr/\u003e\n- Before perfomance tuning \u003cbr/\u003e\n\n\n\u003cimg src=\"./img/VisitsQuery/visitsQuery2FIXED.png\" width=\"700\" height=\"400\"\u003e\u003cbr/\u003e\n- After perfomance tuning \u003cbr/\u003e\n\n### Explanantion of problem and solution\n\n- For this part we created an index for the column vet_id using:\n   ```CREATE INDEX visits_vet_id_asc ON visits(vet_id ASC);```\n\nWhen we tested it we realized that the execution time reduced from 3995.222 ms to 3621.804 ms\n\n## Problem 3\n\n### SELECT * FROM owners where email = 'owner_18327@mail.com';\n\n\u003cimg src=\"./img/owner_email_query/owners_email_query.png\" width=\"800\" height=\"400\"\u003e\u003cbr/\u003e\n- Before perfomance tuning \u003cbr/\u003e\n\n\n\u003cimg src=\"./img/owner_email_query/ownser_email_nonclustered_index.png\" width=\"800\" height=\"400\"\u003e\u003cbr/\u003e\n- After perfomance tuning \u003cbr/\u003e\n\n\n### Explanantion of problem and solution\n\n- For thus problem since the query was using the email as the conditional, we created a Non-clustered index on the email column of the owners table.\n\n- It reduced the execution time from 2337.774 ms to 0.142 ms\n\n## Authors\n\n👤 **Opeyemi Oyelesi**\n\n- GitHub: [@AdedayoOpeyemi](https://github.com/AdedayoOpeyemi)\n- Twitter: [@Oyelesiopy](https://twitter.com/oyelesiopy)\n- LinkedIn: [Opeyemi Oyelesi](https://linkedin.com/in/opeyemioyelesi)\n\n👤 **Jose Alberto Arriaga Ramos** \n- Github: [@jaarkira](https://github.com/jaar91)\n- Twitter: [@91_jaar](https://twitter.com/91_jaar)\n- Linkedin: [Jose Arriaga](https://www.linkedin.com/in/jaar/)\n\n👤 **Emmanuel Isabirye** \n- Github: [@gEmmanuelaaron](https://github.com/emmanuelaaron)\n- Twitter: [@Emmanuel Isabirye](https://twitter.com/EmmanuelIsabir1)\n- Linkedin: [Emmanuel Isabirye](https://www.linkedin.com/in/fullstackwebdev-emma/) \n\n\n\n## 🤝 Contributing\n\nContributions, issues, and feature requests are welcome!\n\nFeel free to check the [issues page](https://github.com/emmanuelaaron/issues).\n\n## Show your support\n\nGive a ⭐️ if you like this project!\n\n## Acknowledgments\n\n- Hat tip to anyone whose code was used\n- Inspiration\n- etc\n\n## 📝 License\n\nThis project is [MIT](./MIT.md) licensed.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femmanuelaaron%2Fvet-clinic-database","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femmanuelaaron%2Fvet-clinic-database","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femmanuelaaron%2Fvet-clinic-database/lists"}