sql server – Benefits of not having a clustered index on tables (Heaps)

What are the benefits of not having a clustered index on a table in SQL server. Will a

SELECT * INTO TABLE_A FROM TABLE_B

Be faster if TABLE_A is a heap? Which operation will benefit if the table is a heap?
I am quite sure UPDATE‘s and DELETE‘s will benefit from a clustered index. What about INSERTS? My understanding is that INSERT “might” benefit from the table being a heap, both in term of speed but also other resources and hardware (I/O, CPU, memory and storage…).

What is the most scarce resource in terms of hardware? In terms of storage is a heap going to occupy less space? Is disk storage not the least expensive resource? If so is it rational to keep table as heap in order to save disk space? How will a heap affect CPU and I/O with SELECT, INSERT, UPDATE and DELETE? What cost goes up when table is a heap and we SELECT, UPDATE and DELETE from it?

Thansk

php – Inside Array – “unidentified index” error with “prepare was called incorrectly” despite not calling the prepared statement with wordpress

I know that there is a very old answer that details unidentified index but using the methods there I can not figure out how to make isset work with the code I have. It is below but doesnt solve the issue.

Plus it my error is paired with the PREPARE error AND the fact that my understanding is that answer with ISSET is NOT a safe way anymore to prevent SQL injections. Someone please correct me if I am wrong. As per request I have also included the entire error message.

I am getting a couple of errors with the code below and am not sure why it thinks this isnt prepared properly. Can anyone shed light on this for me? Thanks.

for each line that has a $POST, it is telling me that the “Notice: Undefined index”

     if (!empty($_POST)) {
        global $wpdb;
        $table = "mytablenameplaceholder";
            if(isset($_POST('name')) && isset($_POST('emailaddress'))){
  $number1 = $_POST('name'); 
  $message = $_POST('emailaddress'); 
  $message = urlencode($message); 
        $data = array(
            'name' => $_POST('name'),
            'emailaddress'    => $_POST('emailaddress'),
            'phonenumber'    => $_POST('phonenumber')
        );
        $format = array(
            '%s',
            '%s'
        );
        $success=$wpdb->insert( $table, $data, $format );
        if($success){
            echo 'data has been saved' ; 
        }
    } else {
?>
    <form action="" method="post" >
        <input type="text"  id="name" name="name" value="John">
        <input type="text" name="email">
        <input type="text" name="phonenumber">
        <input type="submit">
    </form>
<?php
    }

I am also receiving a “Notice: wpdb::prepare was called incorrectly.” notice despite not having a prepare statement currently in the code. I know I need to add it.

enter image description here

javascript – How to access index of .map() method outside of it in react

I want to access the index number outside of that map method because I want to use that index conditionally to show other component like if that index is checked then the component will show but I can’t figure out how to access that outside of that map method. I have googled it but couldn’t find any proper solution of that.

Here is my code!

import React, { Component, Fragment } from "react";
import Clear from "./clear";
import Display from "./display";
import NoOfItems from "./noOfItems";

class MainPage extends Component {
  constructor() {
    super();
    this.state = {
      data: (
        {
          name: "",
          completed: false,
        },
      ),
      data: (),
      checkValue: false,
    };
  }

  handleChange = (e) => {
    e.preventDefault();

    this.setState({ name: e.target.value });
  };

  handleSubmit = (e) => {
    e.preventDefault();

    this.setState({
      data: (...this.state.data, { name: this.state.name, completed: false }),
    });
    e.target.reset();
  };

  handleDelete = (index) => {
    const newList = (...this.state.data);
    newList.splice(index, 1);

    this.setState({ data: newList });
  };

  handleAllCheck = (e) => {
    e.preventDefault();
  };

  handleCheckChange = (index) => {
    let newData = (...this.state.data);
    newData(index).completed = !newData(index).completed;
    this.setState({ data: newData });
  };

  render() {
    return (
      <Fragment>
        <h1 className="display-1 text-center" style={{ color: "#f7c6c6" }}>
          todos
        </h1>
        <form className="todo-form" onSubmit={this.handleSubmit}>
          <label className="label" onClick={this.handleAllCheck}>
            ^
          </label>
          <input
            autoFocus
            type="text"
            onChange={this.handleChange}
            className="new-todo shadow-lg p-3 mb-5 bg-white"
            placeholder="What needs to be done?"
          />
          <ul className="list-group">
            {this.state.data.map((data, index) => {
              return (
                <div key={"todo-" + index} className="div-list">
                  <input
                    className="check"
                    onChange={() => this.handleCheckChange(index)}
                    type="checkbox"
                    style={{
                      cursor: "pointer",
                    }}
                    defaultChecked={this.state.data.completed}
                  />
                  <li
                    className="list-group-item disabled w-50 p-3 mx-auto"
                    style={{
                      textDecoration:
                        this.state.data(index).completed && "line-through",
                    }}
                  >
                    {data.name}
                  </li>
                  <button
                    onClick={() => this.handleDelete(index)}
                    type="button"
                    className="close"
                    aria-label="Close"
                  >
                    <span aria-hidden="true">&times;</span>
                  </button>
                </div>
              );
            })}
          </ul>
          {this.state.data.length > 0 && <Display />}
          {this.state.data.length > 0 && (
            <NoOfItems noOfTodos={this.state.data.length} />
          )}
          {this.state.data.completed && <Clear />}
        </form>
      </Fragment>
    );
  }
}

export default MainPage;

Just ignore the rest and see the map method and its index. At the end of the code I have used this.state.data.completed at this point I want to use the index like this this.state.data(index).completed but its saying invalid declaration of Index. Please help me I am stuck!

Thank you in advance!

magento2.3.5 – Undefined index: rule_id when trying to create a cart rule (coupons) after upgrading from magento 2.1 to 2.3.5

When upgrading from 2.1 to 2.3.5, I am now getting the following error when I try to create a new cart rule:

(2020-09-19 15:53:49) main.CRITICAL: Notice: Undefined index: rule_id in /var/www/html/magento2/vendor/stripe/module-payments/Observer/CouponEditObserver.php on line 29 {“exception”:”(object) (Exception(code: 0): Notice: Undefined index: rule_id in /var/www/html/magento2/vendor/stripe/module-payments/Observer/CouponEditObserver.php on line 29 at /var/www/html/magento2/vendor/magento/framework/App/ErrorHandler.php:61)”} ()

I emailed stripe support and they’ve told me it’s not them.
Any help would be appreciated. Thank you.

How do I get the index file name to display on browsers as a part of the URL?

I need a way to force the URL to display /index.html

EX:
https://ameriwebhosting.com/
should display as the URL automaticall… | Read the rest of https://www.webhostingtalk.com/showthread.php?t=1822663&goto=newpost

index – Tagging implementation in Dynamodb

I’m trying to design a table optimized for tag-searching. My initial design for my table is to have a set field for the list of tags, but I have no idea how to optimized it for querying. I’m aware that only top-level elements can be indexed and I can’t find any good resources or examples on tagging implementation on Dynamodb.

What does it mean that a “clustered index does not store pointers to the data”?

A heap is just a bunch of pages with rows on it, there isn’t really any information about what is where aper form SQL Server keeping track of “that table is represented by this list of pages”. To find anything, it has to scan the whole lot (unless you use TOP 1 or TOP <n> or OFFSET/FETCH in which case it might get away with scanning until enough rows is found).

An index is a tree structure that makes finding things a lot faster than scanning everything. I’ll not going into detail on index/tree structures (see blow for a useful reference though) but using an index means you can find a specific thing in just a few page reads instead of many thousands. Trees have a root node at the top, leaf nodes at the bottom layer, and branch nodes in between.

A non-clustered index on a heap in SQL Server has in its leaf nodes references to where the data is in the DB: the file, page, and row number within that page. So once you get to the bottom of the tree you still have on page read to do, potentially one per found row if there are many matching.

A clustered index in SQL Server (the term means something a little different in postgres and elsewhere) contains the actual row data in the leaf nodes: no extra lookups required. This is why clustered indexes are particularly useful for range queries: you could find the data for several, maybe a few hundred of, rows that match the filter all on the same page so no further lookups to do.

A non-clustered index on a table with a clustered index is very similar to one on a heap. The difference is that instead of the leaf nodes containing pointers to where the data is in the heap they contain the clustering key for the row so the extra data can be found via the clustered index (unless all you need is contained in the indexed values, the INCLUDED values, and the clustering key, in which case no further lookups are needed).

It may seem like a non-clustered index on a clustered table could be less efficient than on a non-clustered one, but the search in the clustered index is only going to be a page or few and there are other factors that can make the heap lookup less efficient than reading the one page that is pointed to by the index, and heaps can be inefficient in other ways too.

google sheets – Countifs with index match and importrange

I have two worksheets
https://docs.google.com/spreadsheets/d/141IcRU2RE_WmBGK4bMOI-_zyz1-hwU1TTylfbBz2pIE/edit?usp=sharing

https://docs.google.com/spreadsheets/d/1kGJaIu6leOzeXWyAyfaZsllMib8b8esOuDWYwzlxyYo/edit?usp=sharing

I am trying to count the number of instances each person has in each tab of sheet 2 and then import that total to sheet 1. Im unsure which formulas I should be using of if this is even possible. I’ve included a small description on each tab of sheet 2.

If someone could help me understand what I should be using to accomplish this I’d be grateful

performance – Clustered Index during data load in MS SQL Server

Until today, I was under impression that it’s been considered as a best practice to disable the indexes in sql tables during the data load. And with the fact that one cannot disable the clustered indexes in MS Sql server, you would have to delete that and then perform the data load operation. But today, I performed the data load operation of around 30M records with 10-15 columns of different column types and I was surprised to see the result where keeping the clustered index out performs the load compared to dropping the clustered index, loading data and then creating the clustered index.

In my test, the data which was being inserted was presorted in the source table and that might be one reason for the difference, but I just want to understand is it still considered as a best practice to drop the clustered index prior to data load and recreate it after or keeping the clustered index is the optimal way?

Magento 2.3 re-index failing for sales rule index

When I trying to re-index salesrule_rule index, It gives me bellow error and the sales rule grid is not loading in magento admin. Please advice.

Item (MagentoSalesRuleModelRuleInterceptor) with the same ID "165" already exists.