Re: Optimize query

2020-12-15 Thread Raul Giucich
Hi Yambu, the btree index type is optimized for this kind of operators (>,
>=, <, <=, =).
For deep understanding on how to plan an query optimization I would
recommend https://classroom.google.com/c/MTQ4MzczNDExMjM4 and
https://use-the-index-luke.com.
Another tip is use in the select clause only the columns that are
significant to answer the question you user is making executing this query.
Sorry for my foreign english.
Best regards.
Raúl.


El mar, 15 dic 2020 a las 11:18, Yambu () escribió:

> Hi
>
> How would you optimize a query with greater than in where clause eg
>
> select * from table1 where id > 1000
>
> and there is an index on id column
>
> regards
>


Re: PostgreSQL Replication

2021-02-16 Thread Raul Giucich
This article will help you
https://wiki.postgresql.org/wiki/Multimaster.

El mar., 16 feb. 2021 10:56, Mutuku Ndeti  escribió:

> Hi,
>
> Need some advice here. I have an application using PostgreSQL. I need to
> install it on 2 servers for redundancy purposes and have 2 databases. I
> need the DBs to replicate to each other, in real-time. Writes can be done
> on both DBs.
>
> Please let me know if this is a feasible setup and the best way to
> proceed.
>
> Thank you
>
> --
> www.agile.co.ke
>
>


Re: postgres sql assistance

2024-01-16 Thread Raul Giucich
Hi Arun, can you share the sql used for this insert. Visually it seems some
character are affecting the data.
Best regards,
Raul

El mar, 16 ene 2024 a la(s) 9:35 a.m., arun chirappurath (
arunsnm...@gmail.com) escribió:

> Dear all,
>
> I am an accidental postgres DBA and learning things every day. Apologies
> for my questions if not properly drafted.
>
> I am trying to load data from the temp table to the main table and catch
> the exceptions inside another table.
>
> temp table is cast with the main table data type and trying to load the
> data.
>
> temp table is below.
>
> category_name  |description
>| is_active
>
> ---+-+---
>  *Tech123212312312323233213123123123123*| Furniture and home decor
>  | true
>  *Tech123212312312323233213123123123123*| Electronic devices and
> accessories  | true
>  Elec| Books of various genres
> | *15*
>  TV  | Books
> | *12*
>  cla | Apparel and fashion accessories
> | true
>
> category name is varchar(25) and is_active is boolean in main table. So i
> should get exceptions for 1st,2nd for category_name rows and 4 and 5th rows
> for boolean. In exception table results,its only showing
>
> Exception table is below. Here instead of showing exception for value 12
> in the is_active table its showing old exception for 15 itself.. Script is
> attached,,...SQLERRM value is not getting updated for row 12..WHat could be
> the reason for this?
>
> value too long for type character varying(25) category_name 1 2024-01-16
> 16:17:01.279 +0530 value too long for type character varying(25)
> description 2 2024-01-16 16:17:01.279 +0530 invalid input syntax for type
> boolean: "15" is_active 3 2024-01-16 16:17:01.279 +0530 *invalid input
> syntax for type boolean: "15" * 4 2024-01-16 16:17:01.279 +0530 *invalid
> input syntax for type boolean: "15"* 5 2024-01-16 16:17:01.279 +0530
>
>