Open leandrosardi opened 2 years ago
Server has 16MB RAM, but you are limiting SQL to 5MB.
You can use GUI or the script below
EXEC sys.sp_configure N'show advanced options', N'1' RECONFIGURE WITH OVERRIDE
GO
EXEC sys.sp_configure N'max server memory (MB)', N'12000'
GO
RECONFIGURE WITH OVERRIDE
GO
The index for that particular query (and current column list ) would be
CREATE NONCLUSTERED INDEX [IX_drl_minutely_stats__id_client__ininvite_hit_time] ON [dbo].[drl_minutely_stats]
(
[id_client] ASC,
[ininvite_hit_time] ASC
)
INCLUDE
(
-- !!!! 33 columns!!!!
id_search, id_pipeline, id_message, id_lnuser, id_result, id_profile, ininvite_start_time, ininvite_end_time, inmessage_start_time, inmessage_end_time, inreply_time, inreply_positive, wlt_time, id_message_2, id_message_1, inmessage_1_start_time, inmessage_1_end_time, gct_1, gct_2, gct, gct_1_id_user, gct_2_id_user, gct_id_user, snapshot_time, searchable, location, industry, company, name, visit_time, click_time, create_time, mirror_time
)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF,
DROP_EXISTING = ON,
ONLINE = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
cal you please grant me with the following permissions?
USE master
GO
--- Grant permission to view Sql Server Logs
Grant EXECUTE ON master.sys.xp_readerrorlog TO dev
GO
-- permissions to see Agent Jobs
USE [msdb]
GO
CREATE USER [dev] FOR LOGIN [dev]
GO
USE [msdb]
GO
ALTER ROLE [SQLAgentReaderRole] ADD MEMBER [dev]
GO
USE [msdb]
GO
ALTER ROLE [SQLAgentUserRole] ADD MEMBER [dev]
GO
ALTER INDEX IX_drl_minutely_stats__id_client__ininvite_hit_time ON euler..drl_minutely_stats REORGANIZE; GO Rebuild index ALTER INDEX IX_drl_minutely_stats__id_client__ininvite_hit_time ON euler..drl_minutely_stats REBUILD; GO
I have to comment on that explicitly. And need more details about the server.
If you have SSD drives, you don't care much about index rebuild. You care about STATISTICS rebuild.
If you rebuild an index, as a side effect, you update statistics and cache your data to RAM.
I am working on an initial action list I recommend to perform.
After the memory was increased and the index added the server behaves better. You might still see some queries be slow but overall it is better. I don't see excessive disk reads and see a lot of NULL (which is expected) Before
after
There is still room for improvements of overall server performance and some particular queries after that
@leandrosardi can you please confirm that the index was changed?
This is happening again:
Failing Query
Possible solution
Mirror the first X records only
Mirror nore thant X days aged records only
Reorganize index