partitioning – What’s the best way performance-wise to SELECT from a PARTITIONed table in MySQL: explicit partition selection, pruning with a WHERE clause, or both?

Say you have:

CREATE TABLE  demo (
    amount ,
    year ,
    cycle ,
    otherStuff ,
    PRIMARY KEY ( id , year , cycle )
) ENGINE = INNODB
PARTITION BY RANGE ( year )
SUBPARTITION BY KEY ( cycle ) 
SUBPARTITIONS 12 (
    PARTITION p2020 VALUES LESS THAN (2021) ,
    PARTITION p2021 VALUES LESS THAN (2022) ,
    PARTITION p2022 VALUES LESS THAN (2023) ,
    PARTITION pmax VALUES LESS THAN MAXVALUE
);

What’s the best SELECT to run on that table?

A:

SELECT otherStuff FROM demo WHERE amount > 10 AND year = 2022 AND cycle = 1;

B:

SELECT otherStuff FROM demo (p2022, p1) WHERE amount > 10;

or

C:

SELECT otherStuff FROM demo (p2022, p1) WHERE amount > 10 AND year = 2022 AND cycle = 1;

I’m sure that there is some extra overhead in pruning—some preliminary step for the storage engine to take to figure out which partitions match the WHERE clause. But, where only one partition and subpartition match the WHERE clause and the pruning WHERE clause contains only simple equals comparisons, what I’m trying to figure out is whether the extra overhead is nominal for performance. The reason I want to figure that out is because I want to know if I can get away with pruning, which offers an advantage in design: if I ever wanted to, I could get rid of my partitions and have no queries to change. In other words, explicit partition selection introduces a dependency I’d rather avoid.

Thanks.

partitioning – Best (viz., most performant) way to SELECT from a PARTITIONed table in MySQL: explicit partition selection, WHERE clause, or both?

In other words, say you have:

CREATE TABLE  demo (
    id ,
    year ,
    cycle ,
    otherStuff ,
    PRIMARY KEY ( id , year , cycle )
) ENGINE = INNODB
PARTITION BY RANGE ( year )
SUBPARTITION BY KEY ( `cycle` ) 
SUBPARTITIONS 12 (
    PARTITION p2020 VALUES LESS THAN (2021) ,
    PARTITION p2021 VALUES LESS THAN (2022) ,
    PARTITION p2022 VALUES LESS THAN (2023) ,
    PARTITION pmax VALUES LESS THAN MAXVALUE
);

What’s the best SELECT to run on that table?

A:

SELECT otherStuff FROM demo WHERE id = 1 AND year = 2022 AND cycle = 1;

B:

SELECT otherStuff FROM demo (p2022, p1) WHERE id = 1;

or

C:

SELECT otherStuff FROM demo (p2022, p1) WHERE id = 1 AND year = 2022 AND cycle = 1;

Thanks.

partitioning – How partition works with files?

I’m new to ubuntu.. I didn’t find a better title but that’s the context :

now in windows for example if i created 5 partition it will take names like E:, C:, D: etc and every partiton will store the files i put in, but in linux i can’t locate the partitions.. all my files, folders is in a slash, /etc, /home etc, and the partition are actually files in /dev/sda* and if i created a partition it will create a file like that, also i can’t cat /dev/sda1 so can anyone explain how this works?

Thanks.

Slow boot after partitioning on Ubuntu 20.04 (not a swap issue)

I have repartitioned my SSD recently, and after that, my machine takes over 1 minute to boot. During the partitioning I deleted the swap partition and fixed the related problems with the help of this.
It seems that my root partition takes 30 seconds to mount.
What am I missing?

/etc/fstab:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name 
devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda4 during installation
UUID=001df782-6f77-4838-a23b-ca9dae4c5265 /               ext4    
errors=remount-ro 0       1
# /boot/efi was on /dev/sda2 during installation
UUID=AC24-A33D  /boot/efi       vfat    umask=0077      0       1
# /home was on /dev/sda6 during installation
UUID=dea563d6-ef07-43c3-a181-c1aa2d074447 /home           ext4    
defaults        0       2
# swap was on /dev/sda5 during installation
UUID=a77231a3-8f96-4fa4-873e-628b5c1e6c18   none            swap    sw              0       0

lsblk:

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 223.6G  0 disk 
├─sda1   8:1    0  14.7G  0 part (SWAP)
├─sda2   8:2    0   100M  0 part /boot/efi
├─sda5   8:5    0  52.8G  0 part /
└─sda7   8:7    0 155.6G  0 part /home
sdb      8:16   0   1.8T  0 disk 
└─sdb1   8:17   0   1.8T  0 part 

dmesg:

...
(    4.012563) Btrfs loaded, crc32c=crc32c-intel
(   35.535953) EXT4-fs (sda5): mounted filesystem with ordered data mode. Opts: (null)
(   35.678647) systemd(1): Inserted module 'autofs4'
(   35.721534) systemd(1): systemd 245.4-4ubuntu3.6 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid)
(   35.738166) systemd(1): Detected architecture x86-64.
(   35.759334) systemd(1): Set hostname to <bilibraker-ThinkPad-T450>.
(   35.759850) Lockdown: systemd: /dev/mem,kmem,port is restricted; see man kernel_lockdown.7
(   35.807724) systemd-sysv-generator(353): stat() failed on /etc/init.d/httpd, ignoring: No such file or directory
(   35.813219) systemd-sysv-generator(353): stat() failed on /etc/init.d/mysqld, ignoring: No such file or directory
(   35.909992) systemd(1): Created slice system-modprobe.slice.
(   35.910245) systemd(1): Created slice system-systemdx2dfsck.slice.
(   35.910430) systemd(1): Created slice User and Session Slice.
(   35.910480) systemd(1): Started Forward Password Requests to Wall Directory Watch.
(   35.910688) systemd(1): Set up automount Arbitrary Executable File Formats File System Automount Point.
(   35.910726) systemd(1): Reached target User and Group Name Lookups.
(   35.910737) systemd(1): Reached target Remote File Systems.
(   35.910745) systemd(1): Reached target Slices.
(   35.910759) systemd(1): Reached target System Time Set.
(   35.910766) systemd(1): Reached target System Time Synchronized.
(   35.910869) systemd(1): Listening on Syslog Socket.
(   35.910936) systemd(1): Listening on fsck to fsckd communication Socket.
(   35.910975) systemd(1): Listening on initctl Compatibility Named Pipe.
(   35.911123) systemd(1): Listening on Journal Audit Socket.
(   35.911186) systemd(1): Listening on Journal Socket (/dev/log).
(   35.911259) systemd(1): Listening on Journal Socket.
(   35.911342) systemd(1): Listening on udev Control Socket.
(   35.911398) systemd(1): Listening on udev Kernel Socket.
(   35.912194) systemd(1): Mounting Huge Pages File System...
(   35.913063) systemd(1): Mounting POSIX Message Queue File System...
(   35.914352) systemd(1): Mounting Kernel Debug File System...
(   35.915692) systemd(1): Mounting Kernel Trace File System...
(   35.917176) systemd(1): Starting Journal Service...
(   35.918810) systemd(1): Starting Set the console keyboard layout...
(   35.920280) systemd(1): Starting Create list of static device nodes for the current kernel...
(   35.920365) systemd(1): Condition check resulted in Load Kernel Module drm being skipped.
(   35.920945) systemd(1): Condition check resulted in Set Up Additional Binary Formats being skipped.
(   35.920986) systemd(1): Condition check resulted in File System Check on Root Device being skipped.
(   35.923590) systemd(1): Starting Load Kernel Modules...
(   35.924748) systemd(1): Starting Remount Root and Kernel File Systems...
(   35.926112) systemd(1): Starting udev Coldplug all Devices...
(   35.927413) systemd(1): Starting Uncomplicated firewall...
(   35.929595) systemd(1): Mounted Huge Pages File System.
(   35.929916) systemd(1): Mounted POSIX Message Queue File System.
(   35.930176) systemd(1): Mounted Kernel Debug File System.
(   35.930413) systemd(1): Mounted Kernel Trace File System.
(   35.931046) systemd(1): Finished Create list of static device nodes for the current kernel.
(   35.940197) EXT4-fs (sda5): re-mounted. Opts: errors=remount-ro
(   35.941957) systemd(1): Finished Remount Root and Kernel File Systems.
(   35.943491) systemd(1): Condition check resulted in Rebuild Hardware Database being skipped.
(   35.943529) systemd(1): Condition check resulted in Platform Persistent Storage Archival being skipped.
(   35.946542) systemd(1): Starting Load/Save Random Seed...
(   35.947905) systemd(1): Starting Create System Users...
(   35.967176) lp: driver loaded but no devices found
(   35.969578) bpfilter: Loaded bpfilter_umh pid 388
(   35.969894) Started bpfilter
(   35.982598) systemd(1): Finished Load/Save Random Seed.
(   35.984767) systemd(1): Finished Create System Users.
(   35.986045) systemd(1): Starting Create Static Device Nodes in /dev...
(   35.986065) ppdev: user-space parallel port driver
(   35.996791) systemd(1): Finished Load Kernel Modules.
(   35.998251) systemd(1): Mounting FUSE Control File System...
(   35.999547) systemd(1): Mounting Kernel Configuration File System...
(   36.000740) systemd(1): Starting Apply Kernel Variables...
(   36.010567) systemd(1): Mounted FUSE Control File System.
(   36.010964) systemd(1): Mounted Kernel Configuration File System.
(   36.027814) systemd(1): Finished Create Static Device Nodes in /dev.
(   36.029113) systemd(1): Starting udev Kernel Device Manager...
(   36.031437) systemd(1): Finished Set the console keyboard layout.
(   36.031657) systemd(1): Reached target Local File Systems (Pre).
(   36.035785) systemd(1): Finished Apply Kernel Variables.
(   36.038451) systemd(1): Started Journal Service.
(   36.046875) systemd-journald(362): Received client request to flush runtime journal.
(   36.620178) cfg80211: Loading compiled-in X.509 certificates for regulatory database
(   36.620487) cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
(   36.623305) RAPL PMU: API unit is 2^-32 Joules, 4 fixed counters, 655360 ms ovfl timer
(   36.623307) RAPL PMU: hw unit of domain pp0-core 2^-14 Joules
(   36.623308) RAPL PMU: hw unit of domain package 2^-14 Joules
(   36.623308) RAPL PMU: hw unit of domain dram 2^-14 Joules
(   36.623309) RAPL PMU: hw unit of domain pp1-gpu 2^-14 Joules
(   36.656911) Intel(R) Wireless WiFi driver for Linux
(   36.656913) Copyright(c) 2003- 2015 Intel Corporation
(   36.677432) iwlwifi 0000:03:00.0: Found debug destination: EXTERNAL_DRAM
(   36.677435) iwlwifi 0000:03:00.0: Found debug configuration: 0
(   36.677776) iwlwifi 0000:03:00.0: loaded firmware version 29.1654887522.0 op_mode iwlmvm
(   36.721482) iwlwifi 0000:03:00.0: Detected Intel(R) Dual Band Wireless AC 7265, REV=0x210
(   36.735234) iwlwifi 0000:03:00.0: Applying debug destination EXTERNAL_DRAM
(   36.736438) iwlwifi 0000:03:00.0: Allocated 0x00400000 bytes for firmware monitor.
(   36.744453) iwlwifi 0000:03:00.0: base HW address: 94:65:9c:1e:a6:04
(   36.756759) Non-volatile memory driver v1.3
(   36.765038) thinkpad_acpi: ThinkPad ACPI Extras v0.26
(   36.765040) thinkpad_acpi: http://ibm-acpi.sf.net/
(   36.765041) thinkpad_acpi: ThinkPad BIOS JBET51WW (1.16 ), EC JBHT14WW
(   36.765042) thinkpad_acpi: Lenovo ThinkPad T450, model 20BUS0EW11
(   36.769565) thinkpad_acpi: radio switch found; radios are enabled
(   36.769588) thinkpad_acpi: This ThinkPad has standard ACPI backlight brightness control, supported by the ACPI video driver
(   36.769589) thinkpad_acpi: Disabling thinkpad-acpi brightness events by default...
(   36.784648) thinkpad_acpi: rfkill switch tpacpi_bluetooth_sw: radio is unblocked
(   36.808197) thinkpad_acpi: battery 2 registered (start 0, stop 100)
(   36.810364) ieee80211 phy0: Selected rate control algorithm 'iwl-mvm-rs'
(   36.810374) thinkpad_acpi: battery 1 registered (start 0, stop 100)
(   36.810380) battery: new extension: ThinkPad Battery Extension
(   36.810447) input: ThinkPad Extra Buttons as /devices/platform/thinkpad_acpi/input/input12
(   36.810810) thermal thermal_zone3: failed to read out thermal zone (-61)
(   36.817849) snd_hda_intel 0000:00:03.0: bound 0000:00:02.0 (ops i915_audio_component_bind_ops (i915))
(   36.832484) input: HDA Intel HDMI HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:03.0/sound/card0/input13
(   36.832556) input: HDA Intel HDMI HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:03.0/sound/card0/input14
(   36.832627) input: HDA Intel HDMI HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:03.0/sound/card0/input15
(   36.832702) input: HDA Intel HDMI HDMI/DP,pcm=9 as /devices/pci0000:00/0000:00:03.0/sound/card0/input16
(   36.832763) input: HDA Intel HDMI HDMI/DP,pcm=10 as /devices/pci0000:00/0000:00:03.0/sound/card0/input17
(   36.843573) snd_hda_codec_realtek hdaudioC1D0: autoconfig for ALC3232: line_outs=1 (0x14/0x0/0x0/0x0/0x0) type:speaker
(   36.843577) snd_hda_codec_realtek hdaudioC1D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
(   36.843579) snd_hda_codec_realtek hdaudioC1D0:    hp_outs=2 (0x16/0x15/0x0/0x0/0x0)
(   36.843580) snd_hda_codec_realtek hdaudioC1D0:    mono: mono_out=0x0
(   36.843581) snd_hda_codec_realtek hdaudioC1D0:    inputs:
(   36.843583) snd_hda_codec_realtek hdaudioC1D0:      Dock Mic=0x19
(   36.843585) snd_hda_codec_realtek hdaudioC1D0:      Mic=0x1a
(   36.843586) snd_hda_codec_realtek hdaudioC1D0:      Internal Mic=0x12
(   36.904907) input: HDA Intel PCH Dock Mic as /devices/pci0000:00/0000:00:1b.0/sound/card1/input18
(   36.904986) input: HDA Intel PCH Mic as /devices/pci0000:00/0000:00:1b.0/sound/card1/input19
(   36.905063) input: HDA Intel PCH Dock Headphone as /devices/pci0000:00/0000:00:1b.0/sound/card1/input20
(   36.905128) input: HDA Intel PCH Headphone as /devices/pci0000:00/0000:00:1b.0/sound/card1/input21
(   36.940446) intel_rapl_common: Found RAPL domain package
(   36.940449) intel_rapl_common: Found RAPL domain core
(   36.940450) intel_rapl_common: Found RAPL domain uncore
(   36.940451) intel_rapl_common: Found RAPL domain dram
(   36.953691) iwlwifi 0000:03:00.0 wlp3s0: renamed from wlan0
(   36.970273) Adding 15353852k swap on /dev/sda1.  Priority:-2 extents:1 across:15353852k SSFS
(   37.044959) EXT4-fs (sda7): mounted filesystem with ordered data mode. Opts: (null)
(   37.136263) audit: type=1400 audit(1632445166.795:2): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/cups/backend/cups-pdf" pid=740 comm="apparmor_parser"
(   37.136269) audit: type=1400 audit(1632445166.795:3): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/sbin/cupsd" pid=740 comm="apparmor_parser"
(   37.136272) audit: type=1400 audit(1632445166.795:4): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/sbin/cupsd//third_party" pid=740 comm="apparmor_parser"
(   37.139507) audit: type=1400 audit(1632445166.799:5): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/sbin/tcpdump" pid=741 comm="apparmor_parser"
(   37.147669) audit: type=1400 audit(1632445166.807:6): apparmor="STATUS" operation="profile_load" profile="unconfined" name="ippusbxd" pid=742 comm="apparmor_parser"
(   37.150533) audit: type=1400 audit(1632445166.811:7): apparmor="STATUS" operation="profile_load" profile="unconfined" name="nvidia_modprobe" pid=743 comm="apparmor_parser"
(   37.150537) audit: type=1400 audit(1632445166.811:8): apparmor="STATUS" operation="profile_load" profile="unconfined" name="nvidia_modprobe//kmod" pid=743 comm="apparmor_parser"
(   37.164055) audit: type=1400 audit(1632445166.823:9): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/bin/man" pid=748 comm="apparmor_parser"
(   37.164059) audit: type=1400 audit(1632445166.823:10): apparmor="STATUS" operation="profile_load" profile="unconfined" name="man_filter" pid=748 comm="apparmor_parser"
(   37.164061) audit: type=1400 audit(1632445166.823:11): apparmor="STATUS" operation="profile_load" profile="unconfined" name="man_groff" pid=748 comm="apparmor_parser"
(   38.223221) Lockdown: Xorg: raw io port access is restricted; see man kernel_lockdown.7
(   38.605663) iwlwifi 0000:03:00.0: Applying debug destination EXTERNAL_DRAM
(   38.703867) iwlwifi 0000:03:00.0: Applying debug destination EXTERNAL_DRAM
(   38.705159) iwlwifi 0000:03:00.0: FW already configured (0) - re-configuring
(   38.720836) vboxdrv: loading out-of-tree module taints kernel.
(   38.731420) vboxdrv: Found 4 processor cores
(   38.750939) vboxdrv: TSC mode is Invariant, tentative frequency 2294684551 Hz
(   38.750940) vboxdrv: Successfully loaded version 6.1.22 (interface 0x00300000)
(   38.961270) VBoxNetFlt: Successfully started.
(   38.964017) Bluetooth: Core ver 2.22
(   38.964046) NET: Registered protocol family 31
(   38.964047) Bluetooth: HCI device and connection manager initialized
(   38.964051) Bluetooth: HCI socket layer initialized
(   38.964054) Bluetooth: L2CAP socket layer initialized
(   38.964058) Bluetooth: SCO socket layer initialized
(   38.964979) VBoxNetAdp: Successfully started.
(   39.010334) mc: Linux media interface: v0.10
(   39.027983) videodev: Linux video capture interface: v2.00
(   39.102543) usbcore: registered new interface driver btusb
(   39.118003) Bluetooth: hci0: read Intel version: 370810011003110e00
(   39.119066) Bluetooth: hci0: Intel Bluetooth firmware file: intel/ibt-hw-37.8.10-fw-1.10.3.11.e.bseq
(   39.141794) Bluetooth: BNEP (Ethernet Emulation) ver 1.3
(   39.141796) Bluetooth: BNEP filters: protocol multicast
(   39.141803) Bluetooth: BNEP socket layer initialized
(   39.187184) uvcvideo: Found UVC 1.00 device Integrated Camera (04f2:b449)
(   39.203546) input: Integrated Camera: Integrated C as /devices/pci0000:00/0000:00:14.0/usb2/2-8/2-8:1.0/input/input22
(   39.204143) uvcvideo: Found UVC 1.00 device HD Web Camera (05a3:9331)
(   39.247096) uvcvideo: Failed to query (GET_INFO) UVC control 12 on unit 2: -32 (exp. 1).
(   39.273105) uvcvideo: Failed to query (GET_INFO) UVC control 11 on unit 2: -32 (exp. 1).
(   39.299943) input: HD Web Camera: HD Web Camera as /devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3.4/2-3.4:1.0/input/input23
(   39.300092) usbcore: registered new interface driver uvcvideo
(   39.300093) USB Video Class driver (1.1.1)
(   39.407988) Bluetooth: hci0: unexpected event for opcode 0xfc2f
(   39.425024) Bluetooth: hci0: Intel firmware patch completed and activated
(   39.515665) NET: Registered protocol family 38
(   39.886153) usb 2-3.4: Warning! Unlikely big volume range (=3072), cval->res is probably wrong.
(   39.886156) usb 2-3.4: (6) FU (Mic Capture Volume) ch = 1, val = -1536/1536/1
(   39.886347) usbcore: registered new interface driver snd-usb-audio
(   40.612009) Lockdown: systemd-logind: hibernation is restricted; see man kernel_lockdown.7
(   40.622856) Lockdown: systemd-logind: hibernation is restricted; see man kernel_lockdown.7
(   40.829743) Bluetooth: RFCOMM TTY layer initialized
(   40.829750) Bluetooth: RFCOMM socket layer initialized
(   40.829754) Bluetooth: RFCOMM ver 1.11
(   42.477105) wlp3s0: authenticate with c4:3c:ea:eb:61:fc
(   42.481985) wlp3s0: send auth to c4:3c:ea:eb:61:fc (try 1/3)
(   42.483954) wlp3s0: authenticated
(   42.486125) wlp3s0: associate with c4:3c:ea:eb:61:fc (try 1/3)
(   42.487192) wlp3s0: RX AssocResp from c4:3c:ea:eb:61:fc (capab=0x411 status=0 aid=2)
(   42.489000) wlp3s0: associated
(   42.573474) wlp3s0: Limiting TX power to 30 (30 - 0) dBm as advertised by c4:3c:ea:eb:61:fc
(   42.574426) IPv6: ADDRCONF(NETDEV_CHANGE): wlp3s0: link becomes ready
(   50.174235) usb 3-2: new SuperSpeed Gen 1 USB device number 2 using xhci_hcd
(   50.195309) usb 3-2: New USB device found, idVendor=0bc2, idProduct=61b5, bcdDevice= 7.10
(   50.195315) usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
(   50.195318) usb 3-2: Product: M3 Portable
(   50.195321) usb 3-2: Manufacturer: Seagate
(   50.195324) usb 3-2: SerialNumber: NM16H1L1
(   50.780814) usbcore: registered new interface driver usb-storage
(   50.786134) scsi host3: uas
(   50.786257) usbcore: registered new interface driver uas
(   50.787473) scsi 3:0:0:0: Direct-Access     Seagate  M3 Portable      0710 PQ: 0 ANSI: 6
(   50.788235) sd 3:0:0:0: Attached scsi generic sg1 type 0
(   54.320166) sd 3:0:0:0: (sdb) 3907029167 512-byte logical blocks: (2.00 TB/1.82 TiB)
(   54.320169) sd 3:0:0:0: (sdb) 4096-byte physical blocks
(   54.320327) sd 3:0:0:0: (sdb) Write Protect is off
(   54.320329) sd 3:0:0:0: (sdb) Mode Sense: 53 00 00 08
(   54.320624) sd 3:0:0:0: (sdb) Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
(   54.320880) sd 3:0:0:0: (sdb) Optimal transfer size 33553920 bytes not a multiple of physical block size (4096 bytes)
(   54.669126)  sdb: sdb1
(   54.670963) sd 3:0:0:0: (sdb) Attached SCSI disk
(  490.811778) show_signal: 18 callbacks suppressed
(  490.811785) traps: ibus-ui-gtk3(4271) trap int3 ip:7f2de1f03295 sp:7ffef63fd970 error:0 in libglib-2.0.so.0.6400.6(7f2de1ec7000+84000)
(  490.811981) traps: nm-applet(4318) trap int3 ip:7f1372350295 sp:7ffca08a7a30 error:0 in libglib-2.0.so.0.6400.6(7f1372314000+84000)
(  490.831054) traps: blueman-tray(4411) trap int3 ip:7f86369ce295 sp:7ffd3c8efc10 error:0 in libglib-2.0.so.0.6400.6(7f8636992000+84000)
(  498.318741) traps: nm-applet(39940) trap int3 ip:7f7e8724a295 sp:7fff7e6eb1d0 error:0 in libglib-2.0.so.0.6400.6(7f7e8720e000+84000)

systemd-analyze:

Startup finished in 35.657s (kernel) + 9.383s (userspace) = 45.041s 
graphical.target reached after 9.031s in userspace

systemd-analyze blame:

6.800s NetworkManager-wait-online.service                                                       
1.405s vboxdrv.service                                                                          
1.025s dev-sda5.device                                                                          
 727ms blueman-mechanism.service                                                                
 500ms accounts-daemon.service                                                                  
 486ms udisks2.service                                                                          
 450ms systemd-logind.service                                                                   
 426ms apport-autoreport.service                                                                
 328ms plymouth-read-write.service                                                              
 303ms avahi-daemon.service                                                                     
 291ms NetworkManager.service                                                                   
 284ms networkd-dispatcher.service                                                              
 269ms polkit.service                                                                           
 242ms apport.service                                                                           
 239ms upower.service                                                                           
 239ms systemd-tmpfiles-clean.service                                                           
 237ms tlp.service                                                                              
 233ms ufw.service                                                                              
 225ms ModemManager.service                                                                     
 221ms lightdm.service                                                                          
 194ms plymouth-quit-wait.service                                                               
 191ms grub-common.service                                                                      
 190ms alsa-restore.service                                                                     
 170ms systemd-resolved.service                                                                 
 168ms wpa_supplicant.service                                                                   
 143ms preload.service                                                                          
 142ms systemd-journal-flush.service                                                            
 140ms lm-sensors.service                                                                       
 133ms systemd-udev-trigger.service                                                             
 132ms systemd-udevd.service                                                                    
 128ms rsyslog.service                                                                          
 121ms systemd-journald.service                                                                 
 112ms keyboard-setup.service                                                                   
 109ms colord.service                                                                           
 105ms e2scrub_reap.service                                                                     
 104ms gpu-manager.service                                                                      
 102ms apparmor.service                                                                         
  97ms user@1000.service                                                                        
  96ms systemd-timesyncd.service                                                                
  92ms pppd-dns.service                                                                         
  88ms uwsgi.service                                                                            
  87ms ssh.service                                                                              
  73ms systemd-modules-load.service                                                             
  68ms systemd-fsck@dev-disk-byx2duuid-AC24x2dA33D.service                                    
  46ms ubuntu-fan.service                                                                       
  46ms setvtrgb.service                                                                         
  45ms dev-disk-byx2duuid-a77231a3x2d8f96x2d4fa4x2d873ex2d628b5c1e6c18.swap                
  44ms systemd-fsck@dev-disk-byx2duuid-dea563d6x2def07x2d43c3x2da181x2dc1aa2d074447.service
  42ms kerneloops.service                                                                       
  41ms systemd-tmpfiles-setup-dev.service                                                       
  36ms systemd-sysusers.service                                                                 
  36ms systemd-random-seed.service                                                              
  35ms systemd-sysctl.service                                                                   
  33ms systemd-tmpfiles-setup.service                                                           
  32ms binfmt-support.service                                                                   
  31ms plymouth-start.service                                                                   
  24ms grub-initrd-fallback.service                                                             
  23ms home.mount                                                                               
  22ms systemd-user-sessions.service                                                            
  22ms bluetooth.service                                                                        
  20ms user-runtime-dir@1000.service                                                            
  20ms systemd-backlight@leds:tpacpi::kbd_backlight.service                                     
  17ms dev-hugepages.mount                                                                      
  17ms systemd-remount-fs.service                                                               
  16ms boot-efi.mount                                                                           
  16ms dev-mqueue.mount                                                                         
  15ms sys-kernel-debug.mount                                                                   
  15ms systemd-update-utmp.service                                                              
  14ms sys-kernel-tracing.mount                                                                 
  14ms vboxweb-service.service                                                                  
  13ms console-setup.service                                                                    
  12ms proc-sys-fs-binfmt_misc.mount                                                            
  12ms sys-fs-fuse-connections.mount                                                            
  12ms systemd-update-utmp-runlevel.service                                                     
  11ms sys-kernel-config.mount                                                                  
  10ms kmod-static-nodes.service                                                                
   8ms openvpn.service                                                                          
   7ms systemd-backlight@backlight:intel_backlight.service                                      
   7ms rtkit-daemon.service                                                                     
   5ms vboxballoonctrl-service.service                                                          
   2ms vboxautostart-service.service 

                                                       

So far I have tried these:

slow boot after deleting partitions

Boot much slower after partition resize

Slow boot time after resizing partitions. Editing fstab did not work

partitioning – A strange index that is always marked pg_index.indisvalid=false . Why indexes with ON ONLY option are always rebuilt in invalid state?

I’m looking in database (postresql 11.10) and see an index on a partitioned table that marked as invalid:

SELECT 
        indrelid::regclass, indexrelid::regclass, indisvalid, ddlx_create_index(indexrelid)
    FROM 
        pg_catalog.pg_index 
    WHERE
        indrelid = 'document'::regclass
        AND NOT indisvalid 
indrelid indexrelid indisvalid ddlx_create_index
document ix_doc_file false CREATE INDEX ix_doc_file ON ONLY public.document USING btree (file) INCLUDE (document_type);

If I do:

DROP INDEX ix_doc_file;
CREATE INDEX ix_doc_file ON ONLY public.document USING btree (file) INCLUDE (document_type);

this index is created/reindexed without any warnings but again in invalid state.

What’s the most strange is that I can’t find nothing extraordinary in this index.

On the same table similar indexes exists:

indrelid indexrelid indisvalid ddlx_create_index
document ix_doc_org_id_idx true CREATE INDEX ix_doc_org_id_idx ON ONLY public.document USING btree (org_id);
document ix_doc_last_modified_user_idx true CREATE INDEX ix_doc_last_modified_user_idx ON ONLY public.document USING btree (last_modified_user);
document ix_document_file_document_flags true CREATE INDEX ix_document_file_document_flags ON ONLY public.document USING btree (file) INCLUDE (document_flags);

As you can see one of valid indexes is almost the same:

CREATE INDEX ix_document_file_document_flags ON ONLY public.document USING btree (file) INCLUDE (document_flags);

The only difference is that document_type is text and document_flags is bigint.

(it’s completely another question that maybe some indexes are not needed)

I’m puzzled: What could prevent rebuilding index in valid state?

Notes:

  • instance is not under load
  • it’s not a production server
  • IDK if it matters but that’s Amazon RDS Postgresql 11.10
  • it’s an index on partitioned table

I will be grateful for any ideas for where to look.

UPDATE

The culprit was the option ON ONLY.

So: any index built with ON ONLY option is invalid.

If I remove ON ONLY then index successfully rebuilt with valid status.

So updated question is: why indexes with ON ONLY option are always invalid?

partitioning – Lenovo T490 shut down and will not boot into Ubuntu without using grub2 bootloader from USB

There is a boot loader issue for many Lenovo laptops. I do not know why. Specifically this laptop was stuck trying to PXE boot as seen by many IT professionals.

After messing around a bit, I created a bootable USB and loaded the boot loader on my T490’s memory from the stick. It then gives me the option to “boot from next volume” and by selecting this I am able to actually load the Ubuntu OS into memory.

Under what cases would the BIOS not be able to find the bootloader?

How can I install the correct boot loader into the master boot record of my SSD while I have ubuntu booted?

I can see the different block devices with

$ sudo fdisk -l

But I do not see a boot loader.

I suppose I would

  1. Create a partition
  2. Copy GRUB2 to this partition (I am using Ubuntu 20.04)
  3. Restart the computer and point the BIOS to boot from that partition.
  4. My problem is solved?

I am not dual-booting because I don’t like Windows. At all. MacOS & Ubuntu over Windows every time.

partitioning – “alternate gpt header not at the end of the disk” when trying to boot Ubuntu 21.10 from bootable USB

I’d like to try the latest 21.10 daily build on the off-chance that it fixes some minor hardware compatibility issues I’m having with 21.04. I only want to boot it from the USB to try it out, not actually install it. I downloaded the latest build a few hours ago and made the USB with the Startup Disk Creator. It mostly boots fine from USB, but then stops, giving me a few related messages about the GPT header, including “alternate gpt header not at the end of the disk”. I’ve since tried formatting the stick and cloning it over again (which shouldn’t change anything afaik due to the way cloning works, but why not) and it did not solve the issue.

It seems like that’s the kind of thing that can be solved with GNU Parted, but I’m not at all familiar enough with the issue to try solving it.

partitioning – Proper way to expand storage on Ubuntu running on VirtualBox with Dynamically Allocated storage? Docker keeps running out of space

I used the VirtualBox Media Manager to resize the disk from 10gb to 50gb.

I then used GParted Live to expand the partition to 50gb.

When I boot into Ubuntu and run df -h it shows that ‘/dev/mapper/vg_cloud-Log…’ which is mounted on ‘/‘ is at 100% usage.

What do I need to do to get Ubuntu to see all the disk space?

Ps: I’m running Ubuntu without a GUI.

query performance – SQL Server Partitioning by Local And Remote database

Question – we have a table related to documents(about 17b records on one table), and another one for properties of that documents.
And team decided to archive old entries. I though about partitioning with filegroups, which can be placed in other storage drive
But it will be still same server/host
So, does SQL Server have ability to partitioning data by date and send queries for older data to another SQL Server instance, while having same filtering in local server ?

And if that possible, does we’ll have performance impact except network IO ?

algorithms – What is the value returned by Hoare partitioning?

Following the article about Quicksort from Wikipedia, there is an implementation of Hoare partitioning:

def partition(A, left, right):
    pivot_idx = (left + right) // 2
    pivot_val = A(pivot_idx)
    while True:
        while A(left) < pivot_val:
            left += 1
        while A(right) > pivot_val:
            right -= 1
        if left >= right:
            return right
        A(left), A(right) = A(right), A(left)
        left += 1
        right -= 1

And running this for the following inputs:

A = (4, 6, 2, 7, 1)
ret = partition(A, 0, len(A)-1) # pivot_val=2
print(A) # (1, 2, 6, 7, 4)
print(A(ret)) # 2

A = (5, 3, 6, 1, 2)
ret =  partition(A, 0, len(A)-1) # pivot_val=6
print(A) # (5, 3, 2, 1, 6)
print(A(ret)) # 1

In the first case, the returned index points to the original pivot which was 2. However, in the second case the returned index points to element 1, which is one position before the original pivot 6.

It seems that for Lomuto partitioning the returned index is always the pivot. However for Hoare partitioning it’s not always the case. How could be interpreted the value returned by Hoare partitioning? All elements from the returned index are less or equal than the pivot?