7
MalekL
7y

I started working my new job as a programmer(c#, java, etc.) in a very good programming company.

My first task was to optimise their DB. The DB has indexes and around 3mil rows. The db is slowwww as fuck.

So i made a windows service that reorganises indexes (Depending on blank pages and fragmentation of the index) in DB each week on time.

But as soon as new rows start to come in, the fragmentation of the indexes just sky rocket.

I tried with changing idexes so there will accually be onli indexes we need.

Can anyone help me how can i fix fragmentation problem so the select querries will be much faster.

Sorry if I don't know the solution, I'm new at this task.

Thank you!

Comments
  • 4
    Oh wow, my friend spent the last 3 years studying databases to become a good db engineer, and your company just straight up dumps the task on a developer.

    My suggestion is to refactor the tables into smaller ones, and if your sql supports it, save some search queries so they dont always get implicitly called
  • 2
    @BindView Thank you man. I guess they think i can handle anything if I'm a programmer. Now my only option is to learn DB to solve such things.
  • 1
    you could look up pl/sql practices, even if you use something else, most of the features can be accomplished in other dbms's
  • 1
    What is the DB system?
    SQL Server has built in scheduling for maintenance. @iAmNaN will have to speak to Oracle. I’m guessing they don’t have a DBA and there is no telling what is wrong with the system because of other programmers doing DBA “fixes”.
  • 0
    @MalekL which DBMS?
  • 0
    @iAmNaN Microsoft sql server management studio
  • 2
    Leverage the built in Server Agent to schedule jobs/scripts. https://docs.microsoft.com/en-us/...

    As you are an “Accidental DBA” look into Ola’s prebuilt stuff. https://ola.hallengren.com It isn’t perfect for all cases but if the DB was Dev built you probably aren’t using advance stuff like “clustered column store”.
Add Comment